Repository navigation
Expand file tree
/
Copy pathHTML.html
More file actions
442 lines (421 loc) · 13.5 KB
/
Copy pathHTML.html
File metadata and controls
442 lines (421 loc) · 13.5 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Chronos Portal</title>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600&family=Orbitron:wght@700&display=swap" rel="stylesheet">
<style>
:root {
--primary: #0af;
--secondary: #05f2c7;
--bg1: #101624;
--bg2: #181f32;
--accent: #281d58;
--shadow: 0 0 32px #00ffe633;
--radius: 14px;
--transition: 0.22s cubic-bezier(0.7,0,0.2,1);
}
body {
background: linear-gradient(120deg, var(--bg1) 60%, var(--bg2) 100%);
color: var(--primary);
font-family: 'JetBrains Mono', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
min-height: 100vh;
user-select: none;
}
header {
text-align: center;
padding: 32px 0 16px 0;
background: linear-gradient(90deg, #080e2a 60%, #100d38 100%);
box-shadow: 0 2px 16px #0af2;
}
header h1 {
font-family: 'Orbitron', monospace;
color: var(--secondary);
font-size: 2.4rem;
letter-spacing: 2px;
margin: 0;
text-shadow: 0 2px 18px #0af9, 0 0 2px #fff3;
}
header p {
color: #1ad3ffcc;
font-size: 1.1rem;
margin-top: 12px;
font-family: 'JetBrains Mono', monospace;
opacity: 0.8;
}
main {
flex: 1;
display: flex;
flex-direction: column;
align-items: stretch;
justify-content: flex-start;
max-width: 900px;
margin: 0 auto;
padding: 36px 12px 0 12px;
width: 100%;
}
.controls {
display: flex;
flex-wrap: wrap;
gap: 12px;
justify-content: center;
margin-bottom: 20px;
}
.input-group {
display: flex;
flex-wrap: wrap;
gap: 12px;
width: 100%;
margin-bottom: 12px;
}
input[type="text"], textarea, select {
font-family: 'JetBrains Mono', monospace;
font-size: 1rem;
border: none;
border-radius: var(--radius);
padding: 13px 18px;
background: var(--bg2);
color: var(--primary);
transition: box-shadow var(--transition);
box-shadow: 0 0 0 #0af0 inset;
outline: none;
}
input[type="text"]:focus, textarea:focus, select:focus {
box-shadow: 0 0 8px #0af7 inset;
}
input[type="text"] {
flex: 2 1 280px;
min-width: 180px;
}
textarea {
min-height: 85px;
flex: 1 1 100%;
resize: vertical;
margin-bottom: 0;
}
select {
flex: 1 1 130px;
min-width: 100px;
cursor: pointer;
}
button {
border: none;
padding: 13px 22px;
font-family: 'JetBrains Mono', monospace;
font-size: 1rem;
color: #fff;
font-weight: 700;
border-radius: var(--radius);
background: linear-gradient(135deg, #0af 50%, #05f2c7 100%);
box-shadow: 0 4px 22px #00ffe622, 0 2px 10px #0af8;
cursor: pointer;
margin-right: 0;
margin-bottom: 0;
transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
outline: none;
}
button:hover, button:focus {
background: linear-gradient(135deg, #05f2c7 50%, #0af 100%);
box-shadow: 0 6px 24px #0afbb, 0 2px 18px #05f2c788;
transform: scale(1.045);
}
.quicklinks-bar {
display: flex;
gap: 10px;
margin-bottom: 18px;
justify-content: center;
flex-wrap: wrap;
}
.quicklink-btn {
background: linear-gradient(90deg, #0af4 60%, #05f2c7cc 100%);
color: #fff;
border: none;
font-size: 0.98rem;
font-family: inherit;
border-radius: 8px;
padding: 9px 16px;
cursor: pointer;
box-shadow: 0 0 8px #0af6;
transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}
.quicklink-btn:hover {
background: linear-gradient(90deg, #05f2c7 60%, #0af 100%);
box-shadow: 0 0 18px #05f2c7bb;
transform: scale(1.07);
}
iframe {
flex-grow: 1;
border: 2.2px solid var(--primary);
border-radius: var(--radius);
width: 100%;
min-height: 380px;
margin: 0 auto;
margin-bottom: 22px;
box-shadow: 0 0 60px #0af2;
background: #181f32;
transition: box-shadow var(--transition);
}
iframe.fullscreen, .iframe-fake-fullscreen {
position: fixed !important;
top: 0; left: 0; right: 0; bottom: 0;
width: 100vw !important;
height: 100vh !important;
z-index: 9999;
border-radius: 0 !important;
box-shadow: 0 0 60px #00ffe6cc;
margin: 0 !important;
background: #101624;
}
.footer {
text-align: center;
font-size: 15px;
margin: 18px 0 6px 0;
color: #0af8;
opacity: 0.7;
font-family: 'JetBrains Mono', monospace;
letter-spacing: 1px;
}
.footer a {
color: #05f2c7;
text-decoration: underline;
font-weight: bold;
}
@media (max-width: 650px) {
header h1 { font-size: 1.25rem; }
.controls, .input-group, .quicklinks-bar { flex-direction: column; gap: 8px; }
button, .quicklink-btn { width: 100%; }
main { padding: 16px 4px 0 4px; }
.footer { font-size: 13px; }
}
</style>
</head>
<body>
<header>
<h1>Chronos Portal 🚀</h1>
<p>Ultra-fast iframe loader, HTML renderer & downloader <span style="color:#3ef6;">| Chromebook optimized</span></p>
</header>
<main>
<div class="quicklinks-bar">
<button class="quicklink-btn" onclick="setUrlAndLoad('https://www.google.com')">Google</button>
<button class="quicklink-btn" onclick="setUrlAndLoad('https://classroom.google.com')">Classroom</button>
<button class="quicklink-btn" onclick="setUrlAndLoad('https://docs.google.com/document/u/0/')">Docs</button>
<button class="quicklink-btn" onclick="setUrlAndLoad('https://drive.google.com')">Drive</button>
<button class="quicklink-btn" onclick="setUrlAndLoad('https://youtube.com')">YouTube</button>
<button class="quicklink-btn" onclick="setUrlAndLoad('https://bing.com')">Bing</button>
<button class="quicklink-btn" onclick="setUrlAndLoad('about:blank')">Blank</button>
</div>
<div class="input-group">
<input id="urlInput" type="text" placeholder="Enter URL (e.g. https://example.com)" autocomplete="off" spellcheck="false" />
<select id="cloakSelect" title="Cloak tab as">
<option value="">Cloak As...</option>
<option value="classroom">Google Classroom</option>
<option value="docs">Google Docs</option>
<option value="drive">Google Drive</option>
<option value="none">No Cloak</option>
</select>
<button onclick="loadIframe()">Load Link</button>
<button onclick="openDirect()">Open</button>
<button onclick="toggleFakeFullscreen()" id="fullscreenBtn">Fullscreen</button>
</div>
<div class="input-group">
<textarea id="htmlInput" placeholder="Paste HTML to render or view"></textarea>
<button onclick="loadHtmlCode()">Render HTML</button>
<button onclick="downloadIframeContent()">Download</button>
<button onclick="viewHtmlSource()">View Source</button>
<button onclick="copyIframeUrl()" title="Copy iframe URL to clipboard">Copy URL</button>
<button onclick="clearIframe()">Clear</button>
</div>
<iframe id="myIframe" sandbox="allow-scripts allow-same-origin allow-forms allow-popups" title="Content iframe"></iframe>
</main>
<div class="footer">
Developed for Chromebook by <a href="https://github.com/7-7-7-15" target="_blank">7-7-7-9</a> — v2.0<br>
<span style="font-size:12px;">Tip: Use the quick links or paste HTML directly!</span>
</div>
<script>
// Elements
const iframe = document.getElementById('myIframe');
const urlInput = document.getElementById('urlInput');
const cloakSelect = document.getElementById('cloakSelect');
const fullscreenBtn = document.getElementById('fullscreenBtn');
const htmlInput = document.getElementById('htmlInput');
// Favicons for cloaking
const faviconMap = {
classroom: 'https://ssl.gstatic.com/classroom/favicon.png',
docs: 'https://ssl.gstatic.com/docs/documents/images/kix-favicon7.ico',
drive: 'https://ssl.gstatic.com/images/branding/product/1x/drive_2020q4_48dp.png'
};
function setFavicon(url) {
let link = document.querySelector("link[rel~='icon']");
if (!link) {
link = document.createElement('link');
link.rel = 'icon';
document.head.appendChild(link);
}
link.href = url || "data:,"; // Use blank if no favicon
}
function setTitle(text) {
document.title = text;
}
cloakSelect.addEventListener('change', () => {
const val = cloakSelect.value;
if (val === 'none' || val === '') {
setTitle('Chronos Portal');
setFavicon('');
} else {
setTitle('Google ' + val.charAt(0).toUpperCase() + val.slice(1));
setFavicon(faviconMap[val] || '');
}
});
// Quicklinks
function setUrlAndLoad(url) {
urlInput.value = url;
loadIframe();
}
// Load URL in iframe
function loadIframe() {
let url = urlInput.value.trim();
if (!url) {
urlInput.focus();
urlInput.style.boxShadow = "0 0 10px #fa0559";
setTimeout(()=>urlInput.style.boxShadow = "", 500);
return;
}
if (!url.startsWith('http://') && !url.startsWith('https://') && url !== "about:blank") {
url = 'https://' + url;
}
iframe.removeAttribute('srcdoc');
iframe.src = url;
}
// Load HTML in iframe
function loadHtmlCode() {
const html = htmlInput.value;
if (!html.trim()) {
htmlInput.focus();
htmlInput.style.boxShadow = "0 0 10px #fa0559";
setTimeout(()=>htmlInput.style.boxShadow = "", 500);
return;
}
iframe.removeAttribute('src');
iframe.srcdoc = html;
}
// Download iframe content (HTML)
function downloadIframeContent() {
try {
const doc = iframe.contentDocument || iframe.contentWindow.document;
const htmlContent = doc.documentElement.outerHTML;
const blob = new Blob([htmlContent], { type: 'text/html' });
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = 'chronos_download.html';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
} catch (e) {
alert('Cannot access iframe content due to cross-origin restrictions.');
}
}
// Open URL direct in new tab
function openDirect() {
let url = urlInput.value.trim();
if (!url) {
urlInput.focus();
urlInput.style.boxShadow = "0 0 10px #fa0559";
setTimeout(()=>urlInput.style.boxShadow = "", 500);
return;
}
if (!url.startsWith('http://') && !url.startsWith('https://') && url !== "about:blank") {
url = 'https://' + url;
}
window.open(url, '_blank', 'noopener,noreferrer');
}
// Fake fullscreen for best Chromebook compatibility
function toggleFakeFullscreen() {
if (!iframe.classList.contains('iframe-fake-fullscreen')) {
iframe.classList.add('iframe-fake-fullscreen');
fullscreenBtn.textContent = 'Exit Fullscreen';
} else {
iframe.classList.remove('iframe-fake-fullscreen');
fullscreenBtn.textContent = 'Fullscreen';
}
}
// View HTML source of URL
async function viewHtmlSource() {
const url = urlInput.value.trim();
if (!url) {
urlInput.focus();
urlInput.style.boxShadow = "0 0 10px #fa0559";
setTimeout(()=>urlInput.style.boxShadow = "", 500);
return;
}
let fetchUrl = url;
if (!fetchUrl.startsWith('http://') && !fetchUrl.startsWith('https://')) {
fetchUrl = 'https://' + fetchUrl;
}
try {
const response = await fetch(fetchUrl, { mode: 'cors' });
if(!response.ok) {
alert('Failed to fetch HTML source: ' + response.status + ' ' + response.statusText);
return;
}
const text = await response.text();
showPopup('HTML Source of ' + fetchUrl, text.slice(0, 2000) + (text.length > 2000 ? "\n\n...[truncated]" : ""));
} catch (e) {
alert('Failed to fetch HTML source. Possible CORS restriction or network error.');
}
}
// Copy iframe src (URL) to clipboard
function copyIframeUrl() {
const url = iframe.src || '';
if (!url) {
alert('Nothing loaded in the iframe.');
return;
}
navigator.clipboard.writeText(url).then(
() => showPopup('Copied!', 'Iframe URL copied to clipboard: '+url),
() => alert('Could not copy URL.')
);
}
// Clear iframe and inputs
function clearIframe() {
iframe.removeAttribute('src');
iframe.removeAttribute('srcdoc');
urlInput.value = "";
htmlInput.value = "";
iframe.style.background = "#181f32";
}
// Little popup for info/success
function showPopup(title, msg) {
let p = document.createElement('div');
p.style.position = 'fixed';
p.style.top = '22px';
p.style.left = '50%';
p.style.transform = 'translateX(-50%)';
p.style.background = 'linear-gradient(90deg, #0af8 60%, #05f2c7ee 100%)';
p.style.color = '#061228';
p.style.padding = '15px 28px';
p.style.borderRadius = '13px';
p.style.boxShadow = '0 0 32px #0af6';
p.style.zIndex = 11111;
p.style.fontFamily = 'JetBrains Mono, monospace';
p.style.fontWeight = 'bold';
p.innerHTML = `<div style="font-size:1.11rem; margin-bottom:3px">${title}</div><div style="font-size:0.97rem; max-width: 64vw; word-break: break-all; white-space: pre-wrap">${msg}</div>`;
document.body.appendChild(p);
setTimeout(()=>{p.remove()}, 3200);
}
// Enter key = load
urlInput.addEventListener('keydown', e => {
if (e.key === "Enter") loadIframe();
});
htmlInput.addEventListener('keydown', e => {
if ((e.ctrlKey || e.metaKey) && e.key === "Enter") loadHtmlCode();
});
// Autofocus on URL for ease of use
window.onload = () => urlInput.focus();
</script>
</body>
</html>