-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkioskscreenpreview.html
More file actions
537 lines (474 loc) · 20.9 KB
/
kioskscreenpreview.html
File metadata and controls
537 lines (474 loc) · 20.9 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Screen Resolution Window - Simulator</title>
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg: #0a0a0a;
--surface: #111111;
--surface2: #1a1a1a;
--surface3: #222222;
--border: rgba(255,255,255,0.07);
--border2: rgba(255,255,255,0.13);
--border3: rgba(255,255,255,0.22);
--text: #f0f0f0;
--muted: #888888;
--muted2: #444444;
--danger: #ff5f5f;
--danger-bg: rgba(255,95,95,0.08);
--radius: 10px;
--radius-sm: 6px;
}
html, body {
height: 100%;
background: var(--bg);
color: var(--text);
font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
font-size: 14px;
line-height: 1.5;
}
#mobile-wall {
display: none;
position: fixed;
inset: 0;
background: var(--bg);
z-index: 9999;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
padding: 2rem;
}
#mobile-wall .mw-icon { width: 64px; height: 64px; margin: 0 auto 1.5rem; opacity: 0.3; }
#mobile-wall h2 { font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: 0.75rem; }
#mobile-wall p { font-size: 14px; color: var(--muted); max-width: 280px; line-height: 1.6; }
@media (max-width: 900px) {
#mobile-wall { display: flex; }
#app { display: none; }
}
#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 2rem;
height: 56px;
border-bottom: 1px solid var(--border2);
background: var(--surface);
flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
width: 28px; height: 28px;
background: #fff;
border-radius: 6px;
display: flex; align-items: center; justify-content: center;
}
.brand-icon svg { width: 15px; height: 15px; }
.brand-name { font-size: 13.5px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.brand-name span { color: var(--muted); font-weight: 400; }
.header-badge {
font-size: 10px; padding: 3px 10px; border-radius: 20px;
background: transparent; border: 1px solid var(--border3);
color: var(--muted); letter-spacing: 0.08em; font-weight: 500;
}
main { display: flex; flex: 1; overflow: hidden; }
aside {
width: 288px; flex-shrink: 0;
background: var(--surface);
border-right: 1px solid var(--border2);
display: flex; flex-direction: column;
overflow-y: auto;
scrollbar-width: thin; scrollbar-color: var(--muted2) transparent;
}
aside::-webkit-scrollbar { width: 4px; }
aside::-webkit-scrollbar-thumb { background: var(--muted2); border-radius: 4px; }
.sidebar-section { padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border); }
.sidebar-section:last-child { border-bottom: none; }
.section-title {
font-size: 9.5px; font-weight: 600;
text-transform: uppercase; letter-spacing: 0.12em;
color: var(--muted2); margin-bottom: 0.85rem;
}
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.preset-btn {
background: var(--surface2); border: 1px solid var(--border);
border-radius: var(--radius-sm); padding: 8px 10px;
cursor: pointer; text-align: left;
transition: border-color 0.12s, background 0.12s; color: var(--text);
}
.preset-btn:hover { border-color: var(--border3); background: var(--surface3); }
.preset-btn.active { border-color: #fff; background: var(--surface3); }
.preset-label { font-size: 11px; font-weight: 600; color: var(--text); display: block; }
.preset-res { font-size: 10px; color: var(--muted); display: block; margin-top: 1px; font-variant-numeric: tabular-nums; }
.field { margin-bottom: 0.9rem; }
.field:last-child { margin-bottom: 0; }
label { display: block; font-size: 11px; font-weight: 500; color: var(--muted); margin-bottom: 5px; letter-spacing: 0.02em; }
input[type="number"], input[type="text"] {
width: 100%; background: var(--surface2); border: 1px solid var(--border2);
border-radius: var(--radius-sm); padding: 8px 11px;
font-size: 13px; color: var(--text); outline: none;
transition: border-color 0.12s; font-family: inherit;
}
input[type="number"]:focus, input[type="text"]:focus { border-color: rgba(255,255,255,0.5); }
input[type="number"]::-webkit-inner-spin-button { opacity: 0.3; }
.res-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; }
.res-sep { font-size: 16px; color: var(--muted2); text-align: center; padding-top: 15px; }
.url-wrapper { position: relative; display: flex; align-items: center; }
.url-wrapper svg { position: absolute; left: 10px; width: 13px; height: 13px; color: var(--muted); pointer-events: none; flex-shrink: 0; }
.url-wrapper input { padding-left: 30px; }
input[type="range"] { width: 100%; accent-color: #fff; cursor: pointer; }
.slider-row { display: flex; align-items: center; gap: 10px; }
.slider-val { font-size: 12px; font-weight: 600; color: var(--text); min-width: 36px; text-align: right; font-variant-numeric: tabular-nums; }
#error-msg {
display: none; background: var(--danger-bg);
border: 1px solid rgba(255,95,95,0.3); border-radius: var(--radius-sm);
padding: 9px 12px; font-size: 12px; color: var(--danger);
margin-top: 0.75rem; line-height: 1.55;
}
.launch-btn {
width: 100%; background: #fff; border: none;
border-radius: var(--radius-sm); padding: 10px;
font-size: 13px; font-weight: 600; color: #000;
cursor: pointer; transition: opacity 0.12s, transform 0.1s;
letter-spacing: 0.01em; font-family: inherit;
}
.launch-btn:hover { opacity: 0.88; }
.launch-btn:active { transform: scale(0.98); }
.info-row {
display: flex; justify-content: space-between; align-items: center;
padding: 5px 0; font-size: 12px;
border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-row .key { color: var(--muted); }
.info-row .val { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.info-row .val.ok { color: #aaa; }
.info-row .val.warn { color: var(--danger); }
#canvas {
flex: 1; display: flex; flex-direction: column;
align-items: center; justify-content: flex-start;
overflow: auto;
background: var(--bg);
background-image:
linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
background-size: 36px 36px;
padding: 2.5rem 2rem;
scrollbar-width: thin; scrollbar-color: var(--muted2) transparent;
}
#canvas::-webkit-scrollbar { width: 5px; }
#canvas::-webkit-scrollbar-thumb { background: var(--muted2); border-radius: 4px; }
#empty-state {
display: flex; flex-direction: column; align-items: center;
gap: 1rem; opacity: 0.25; pointer-events: none;
text-align: center; margin: auto;
}
#empty-state svg { width: 52px; height: 52px; }
#empty-state p { font-size: 13px; color: var(--muted); max-width: 220px; line-height: 1.6; }
#monitor-wrap { display: none; flex-direction: column; align-items: center; margin: auto; }
.monitor-outer {
background: #181818; border-radius: 12px;
border: 1.5px solid #2a2a2a; padding: 10px 10px 0 10px;
box-shadow: 0 0 0 1px #0a0a0a, 0 28px 64px rgba(0,0,0,0.85);
}
.monitor-toolbar { display: flex; align-items: center; gap: 6px; padding: 0 2px 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-a { background: #333; }
.dot-b { background: #2c2c2c; }
.dot-c { background: #252525; }
.monitor-url-bar {
flex: 1; background: rgba(255,255,255,0.04);
border: 1px solid rgba(255,255,255,0.07); border-radius: 4px;
height: 22px; display: flex; align-items: center;
padding: 0 8px; font-size: 10px; color: rgba(255,255,255,0.28);
overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
max-width: 420px; font-family: 'SF Mono', 'Consolas', monospace;
}
.monitor-screen {
background: #000; display: block; position: relative; overflow: hidden;
}
/*
* The iframe is sized to the full target resolution (e.g. 1920x1080),
* then CSS-scaled down. pointer-events: auto lets the user click and
* scroll inside it naturally — the browser maps pointer coords through
* the CSS transform automatically.
*/
.monitor-screen iframe {
display: block; border: none;
transform-origin: top left;
pointer-events: auto;
}
.monitor-stand { width: 56px; height: 13px; background: #181818; border-left: 1.5px solid #2a2a2a; border-right: 1.5px solid #2a2a2a; margin: 0 auto; }
.monitor-base { width: 110px; height: 7px; background: #181818; border-radius: 0 0 7px 7px; border: 1.5px solid #2a2a2a; border-top: none; margin: 0 auto; }
.res-label { margin-top: 1.1rem; font-size: 11.5px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.res-label strong { color: #ccc; font-weight: 600; }
.loading-overlay {
position: absolute; inset: 0; background: rgba(0,0,0,0.8);
display: flex; flex-direction: column; align-items: center;
justify-content: center; gap: 10px; z-index: 20;
}
.spinner {
width: 26px; height: 26px;
border: 2px solid rgba(255,255,255,0.08);
border-top-color: rgba(255,255,255,0.65);
border-radius: 50%; animation: spin 0.65s linear infinite;
}
.loading-text { font-size: 11px; color: rgba(255,255,255,0.3); letter-spacing: 0.04em; }
@keyframes spin { to { transform: rotate(360deg); } }
footer {
height: 36px; display: flex; align-items: center; justify-content: center;
border-top: 1px solid var(--border); background: var(--surface);
font-size: 11px; color: var(--muted2); flex-shrink: 0; letter-spacing: 0.03em;
}
footer span { color: var(--muted); font-weight: 600; }
</style>
</head>
<body>
<div id="mobile-wall">
<svg class="mw-icon" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="8" y="14" width="48" height="32" rx="4" stroke="white" stroke-width="2.5"/>
<path d="M24 46L24 52M40 46L40 52M18 52L46 52" stroke="white" stroke-width="2.5" stroke-linecap="round"/>
</svg>
<h2>Desktop view required</h2>
<p>This simulator is designed for Desktop or Tablet. Please open it on a larger screen for the best experience.</p>
</div>
<div id="app">
<header>
<div class="brand">
<div class="brand-icon">
<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="1" y="2" width="13" height="9" rx="1.5" stroke="#000" stroke-width="1.5"/>
<path d="M5 11L5 13M10 11L10 13M3 13L12 13" stroke="#000" stroke-width="1.5" stroke-linecap="round"/>
<rect x="3.5" y="4" width="4.5" height="4.5" rx="0.75" fill="rgba(0,0,0,0.2)"/>
</svg>
</div>
<span class="brand-name">Screen Resolution Window <span>- Simulator</span></span>
</div>
<span class="header-badge">KIOSK PREVIEW</span>
</header>
<main>
<aside>
<div class="sidebar-section">
<div class="section-title">Presets</div>
<div class="preset-grid">
<button class="preset-btn" onclick="applyPreset(1920,1080,this)">
<span class="preset-label">Full HD</span>
<span class="preset-res">1920 x 1080</span>
</button>
<button class="preset-btn" onclick="applyPreset(1366,768,this)">
<span class="preset-label">Laptop</span>
<span class="preset-res">1366 x 768</span>
</button>
<button class="preset-btn" onclick="applyPreset(1280,800,this)">
<span class="preset-label">Laptop HD</span>
<span class="preset-res">1280 x 800</span>
</button>
<button class="preset-btn" onclick="applyPreset(1024,768,this)">
<span class="preset-label">XGA</span>
<span class="preset-res">1024 x 768</span>
</button>
<button class="preset-btn" onclick="applyPreset(1024,600,this)">
<span class="preset-label">Kiosk Small</span>
<span class="preset-res">1024 x 600</span>
</button>
<button class="preset-btn" onclick="applyPreset(800,600,this)">
<span class="preset-label">SVGA</span>
<span class="preset-res">800 x 600</span>
</button>
<button class="preset-btn" onclick="applyPreset(1280,1024,this)">
<span class="preset-label">SXGA</span>
<span class="preset-res">1280 x 1024</span>
</button>
<button class="preset-btn" onclick="applyPreset(2560,1440,this)">
<span class="preset-label">QHD</span>
<span class="preset-res">2560 x 1440</span>
</button>
</div>
</div>
<div class="sidebar-section">
<div class="section-title">Custom Resolution</div>
<div class="field">
<div class="res-row">
<div>
<label>Width (px)</label>
<input type="number" id="inp-w" placeholder="1920" min="320" max="7680" value="">
</div>
<div class="res-sep">x</div>
<div>
<label>Height (px)</label>
<input type="number" id="inp-h" placeholder="1080" min="240" max="4320" value="">
</div>
</div>
</div>
<div id="error-msg"></div>
</div>
<div class="sidebar-section">
<div class="section-title">Target URL</div>
<div class="field">
<label>URL to preview</label>
<div class="url-wrapper">
<svg viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7" cy="7" r="5.5" stroke="currentColor" stroke-width="1.2"/>
<path d="M7 1.5C7 1.5 5 4 5 7C5 10 7 12.5 7 12.5" stroke="currentColor" stroke-width="1.2"/>
<path d="M7 1.5C7 1.5 9 4 9 7C9 10 7 12.5 7 12.5" stroke="currentColor" stroke-width="1.2"/>
<path d="M1.5 7H12.5" stroke="currentColor" stroke-width="1.2"/>
</svg>
<input type="text" id="inp-url" placeholder="https://example.com" value="https://example.com">
</div>
</div>
</div>
<div class="sidebar-section">
<div class="section-title">Preview Zoom</div>
<div class="slider-row">
<input type="range" id="zoom-slider" min="20" max="100" value="60" step="1" oninput="updateZoom(this.value)">
<span class="slider-val" id="zoom-label">60%</span>
</div>
</div>
<div class="sidebar-section">
<button class="launch-btn" onclick="launchPreview()">Launch Preview</button>
</div>
<div class="sidebar-section" id="stats-panel" style="display:none;">
<div class="section-title">Simulation Info</div>
<div class="info-row"><span class="key">Target resolution</span><span class="val" id="stat-res">-</span></div>
<div class="info-row"><span class="key">Aspect ratio</span><span class="val" id="stat-ar">-</span></div>
<div class="info-row"><span class="key">Your screen</span><span class="val" id="stat-screen">-</span></div>
<div class="info-row"><span class="key">Fits on screen</span><span class="val" id="stat-fits">-</span></div>
<div class="info-row"><span class="key">Scale factor</span><span class="val" id="stat-scale">-</span></div>
</div>
</aside>
<div id="canvas">
<div id="empty-state">
<svg viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="4" y="8" width="48" height="32" rx="4" stroke="white" stroke-width="2"/>
<path d="M20 40L20 48M36 40L36 48M14 48L42 48" stroke="white" stroke-width="2" stroke-linecap="round"/>
<circle cx="28" cy="24" r="7" stroke="white" stroke-width="2"/>
<path d="M28 20V24L31 26" stroke="white" stroke-width="2" stroke-linecap="round"/>
</svg>
<p>Select a preset or enter a custom resolution, then click Launch Preview</p>
</div>
<div id="monitor-wrap">
<div class="monitor-outer">
<div class="monitor-toolbar">
<div class="dot dot-a"></div>
<div class="dot dot-b"></div>
<div class="dot dot-c"></div>
<div class="monitor-url-bar" id="url-bar-display"></div>
</div>
<div class="monitor-screen" id="monitor-screen">
<div class="loading-overlay" id="loading-overlay">
<div class="spinner"></div>
<div class="loading-text">Loading preview...</div>
</div>
<iframe id="preview-frame" scrolling="yes"></iframe>
</div>
</div>
<div class="monitor-stand"></div>
<div class="monitor-base"></div>
<div class="res-label" id="res-label"></div>
</div>
</div>
</main>
<footer>Powered by <span> Beebotix</span></footer>
</div>
<script>
var currentZoom = 60;
var currentW = 0;
var currentH = 0;
document.getElementById('stat-screen').textContent = window.screen.width + ' x ' + window.screen.height;
document.getElementById('inp-w').addEventListener('input', clearPresets);
document.getElementById('inp-h').addEventListener('input', clearPresets);
function clearPresets() {
document.querySelectorAll('.preset-btn').forEach(function(b) { b.classList.remove('active'); });
}
function applyPreset(w, h, btn) {
document.getElementById('inp-w').value = w;
document.getElementById('inp-h').value = h;
clearPresets();
btn.classList.add('active');
hideError();
}
function showError(msg) {
var el = document.getElementById('error-msg');
el.textContent = msg;
el.style.display = 'block';
}
function hideError() {
document.getElementById('error-msg').style.display = 'none';
}
function updateZoom(val) {
currentZoom = parseInt(val);
document.getElementById('zoom-label').textContent = val + '%';
if (currentW && currentH) {
renderMonitor(currentW, currentH, false, null);
}
}
function gcd(a, b) { return b === 0 ? a : gcd(b, a % b); }
function getAspectRatio(w, h) { var d = gcd(w, h); return (w/d) + ':' + (h/d); }
function launchPreview() {
hideError();
var w = parseInt(document.getElementById('inp-w').value);
var h = parseInt(document.getElementById('inp-h').value);
var url = document.getElementById('inp-url').value.trim();
if (!w || !h || w < 1 || h < 1) {
showError('Please enter a valid width and height.');
return;
}
var sw = window.screen.width;
var sh = window.screen.height;
if (w > sw || h > sh) {
showError('Resolution ' + w + ' x ' + h + ' exceeds your screen (' + sw + ' x ' + sh + '). Please enter a resolution within your actual screen size.');
return;
}
if (!url) { showError('Please enter a URL to preview.'); return; }
if (!url.startsWith('http://') && !url.startsWith('https://')) {
url = 'https://' + url;
document.getElementById('inp-url').value = url;
}
currentW = w;
currentH = h;
renderMonitor(w, h, true, url);
}
function renderMonitor(w, h, setUrl, url) {
var scale = currentZoom / 100;
var screenW = Math.round(w * scale);
var screenH = Math.round(h * scale);
var monitorScreen = document.getElementById('monitor-screen');
monitorScreen.style.width = screenW + 'px';
monitorScreen.style.height = screenH + 'px';
monitorScreen.style.overflow = 'hidden';
var iframe = document.getElementById('preview-frame');
iframe.style.width = w + 'px';
iframe.style.height = h + 'px';
iframe.style.transform = 'scale(' + scale + ')';
iframe.style.transformOrigin = 'top left';
iframe.style.pointerEvents = 'auto';
if (setUrl && url) {
document.getElementById('loading-overlay').style.display = 'flex';
document.getElementById('url-bar-display').textContent = url;
iframe.onload = function() {
document.getElementById('loading-overlay').style.display = 'none';
};
iframe.src = url;
}
document.getElementById('empty-state').style.display = 'none';
document.getElementById('monitor-wrap').style.display = 'flex';
var ar = getAspectRatio(w, h);
document.getElementById('stats-panel').style.display = 'block';
document.getElementById('stat-res').textContent = w + ' x ' + h + ' px';
document.getElementById('stat-ar').textContent = ar;
var fitsEl = document.getElementById('stat-fits');
var fits = (w <= window.screen.width && h <= window.screen.height);
fitsEl.textContent = fits ? 'Yes' : 'No';
fitsEl.className = 'val ' + (fits ? 'ok' : 'warn');
document.getElementById('stat-scale').textContent = Math.round(scale * 100) + '%';
document.getElementById('res-label').innerHTML =
'<strong>' + w + ' x ' + h + '</strong> | Aspect ' + ar +
' | Scale ' + Math.round(scale * 100) + '%';
}
</script>
</body>
</html>