-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDEVOS.html
More file actions
173 lines (147 loc) · 6.22 KB
/
DEVOS.html
File metadata and controls
173 lines (147 loc) · 6.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DevOS | Integrated Workspace</title>
<style>
:root {
--bg: #0d1117;
--panel: #161b22;
--border: #30363d;
--accent: #58a6ff;
--text: #c9d1d9;
}
body, html {
margin: 0; padding: 0; height: 100%;
background: var(--bg); color: var(--text);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
overflow: hidden;
}
/* Layout Structure */
.wrapper { display: flex; height: 100vh; flex-direction: column; }
nav {
height: 50px; background: var(--panel);
border-bottom: 1px solid var(--border);
display: flex; align-items: center; padding: 0 20px;
justify-content: space-between;
}
.main-content { display: flex; flex: 1; overflow: hidden; }
/* Left: Editor */
.editor-container { width: 40%; display: flex; flex-direction: column; border-right: 1px solid var(--border); }
textarea {
flex: 1; background: transparent; color: #e6edf3;
border: none; padding: 20px; font-family: 'SFMono-Regular', Consolas, monospace;
font-size: 14px; outline: none; resize: none;
}
/* Center: Preview */
.preview-container { flex: 1; background: white; position: relative; }
iframe { width: 100%; height: 100%; border: none; }
/* Right: Sidebar Tools */
.sidebar-tools {
width: 300px; background: var(--panel);
border-left: 1px solid var(--border);
padding: 20px; overflow-y: auto;
}
/* Tool Components */
.tool-box { margin-bottom: 25px; }
.tool-box h3 { font-size: 12px; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; border-bottom: 1px solid var(--border); padding-bottom: 5px; }
input, select {
width: 100%; background: var(--bg); border: 1px solid var(--border);
color: white; padding: 8px; border-radius: 4px; margin: 5px 0;
}
.btn-sm {
background: #238636; color: white; border: none; padding: 8px;
border-radius: 4px; cursor: pointer; width: 100%; font-weight: 600;
}
.btn-sm:hover { background: #2ea043; }
.tag { font-size: 11px; background: #21262d; padding: 2px 6px; border-radius: 10px; border: 1px solid var(--border); }
</style>
</head>
<body>
<div class="wrapper">
<nav>
<div style="font-weight: bold; letter-spacing: 1px;">DEV<span style="color:var(--accent)">OS</span> v1.0</div>
<div class="tag">Live Sync: ON</div>
</nav>
<div class="main-content">
<div class="editor-container">
<div style="padding: 10px; font-size: 12px; background: #010409; color: var(--accent)">● index.html</div>
<textarea id="code-input" spellcheck="false">
<!DOCTYPE html>
<html>
<body style="display:grid; place-items:center; height:90vh; font-family:sans-serif; background:#f0f2f5;">
<div style="text-align:center; background:white; padding:40px; border-radius:20px; box-shadow:0 10px 25px rgba(0,0,0,0.1);">
<h1 style="color:#58a6ff;">Editor Connected</h1>
<p>Type code on the left to update this view.</p>
</div>
</body>
</html></textarea>
</div>
<div class="preview-container">
<iframe id="preview-window"></iframe>
</div>
<div class="sidebar-tools">
<div class="tool-box">
<h3>Aspect Ratio Calc</h3>
<div style="display: flex; gap: 5px;">
<input type="number" id="w" placeholder="W" oninput="runTools()">
<input type="number" id="h" placeholder="H" oninput="runTools()">
</div>
<div id="ratio-out" style="font-size: 14px; margin-top: 5px; font-weight: bold;">Result: --</div>
</div>
<div class="tool-box">
<h3>JSON Formatter</h3>
<textarea id="json-input" style="height: 100px; font-size: 11px; background: #010409; width: 100%;" placeholder="Paste JSON..."></textarea>
<button class="btn-sm" onclick="formatJSON()">Prettify</button>
</div>
<div class="tool-box">
<h3>Text Case</h3>
<button class="btn-sm" style="background:#30363d; margin-bottom:5px;" onclick="textCase('up')">UPPERCASE</button>
<button class="btn-sm" style="background:#30363d;" onclick="textCase('low')">lowercase</button>
</div>
</div>
</div>
</div>
<script>
const codeInput = document.getElementById('code-input');
const previewWindow = document.getElementById('preview-window').contentWindow.document;
// --- CODE PLAYGROUND LOGIC ---
function updatePreview() {
previewWindow.open();
previewWindow.write(codeInput.value);
previewWindow.close();
}
let timeout;
codeInput.addEventListener('input', () => {
clearTimeout(timeout);
timeout = setTimeout(updatePreview, 500);
});
// --- RATIO LOGIC ---
function gcd(a, b) { return b ? gcd(b, a % b) : a; }
function runTools() {
const w = document.getElementById('w').value;
const h = document.getElementById('h').value;
if (w && h) {
const common = gcd(w, h);
document.getElementById('ratio-out').textContent = `Ratio: ${w/common}:${h/common}`;
}
}
// --- JSON LOGIC ---
function formatJSON() {
const area = document.getElementById('json-input');
try {
area.value = JSON.stringify(JSON.parse(area.value), null, 2);
} catch(e) { alert("Invalid JSON"); }
}
// --- TEXT CASE LOGIC ---
function textCase(mode) {
const area = document.getElementById('json-input'); // Reusing the JSON area for text transforms
if(mode === 'up') area.value = area.value.toUpperCase();
if(mode === 'low') area.value = area.value.toLowerCase();
}
// Initialize
updatePreview();
</script>
</body>
</html>