Skip to content

Commit 06bd601

Browse files
committed
Read extended description
Added tile for q1k3, added new splash texts (and splash image...), fixed search bar, fixed back to top button, removed n-gon enhanced, and maybe more idk.
1 parent 8c3752a commit 06bd601

File tree

471 files changed

+276
-88646
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

471 files changed

+276
-88646
lines changed

index.html

+13-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ <h1 style="font-size: 3em; text-align: center;">
262262
"Free?",
263263
"Thanks to gzuidhof?",
264264
"187",
265-
"188",
266265
"189",
267266
"190",
268267
"191",
@@ -291,6 +290,16 @@ <h1 style="font-size: 3em; text-align: center;">
291290
"Frog collection?",
292291
"What do you call a three headed toaster?\nJeff!",
293292
"Commit changes...",
293+
"https://www.youtube.com/watch?v=ojuB7VCALqM",
294+
"Why is there a wallet in my cupcake?",
295+
'"WoahGorilla" translates to "There is no Volohar".',
296+
"why is there no table emoji?",
297+
"Table emoji. NOW!",
298+
"Table emoji, or you will be crushed by A falling AC unit.",
299+
"It's not a feature, it's a bug!",
300+
"Free squirrels",
301+
"you're not supposed to see this text...",
302+
"You're not supposed to see this text..."
294303
];
295304
var randomIndex = Math.floor(Math.random() * greetings.length);
296305
return greetings[randomIndex];
@@ -301,6 +310,9 @@ <h1 style="font-size: 3em; text-align: center;">
301310
window.location.replace("https://www.youtube.com/watch?v=dQw4w9WgXcQ");
302311
});
303312
}
313+
if (document.getElementById('subtitle').innerText === "you're not supposed to see this text...") {
314+
document.getElementById('subtitle').innerHTML = '<img src="play/extras/table-cat.png">'
315+
}
304316
</script>
305317
</body>
306318
</html>

pages/get-gist-first-file-text.js

-32
This file was deleted.

pages/index.html

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
<script>
88
//document.getElementById("jeff_bezos").innerHTML="<head><!--eeeeee--></head><body><p>oofy</p></body>"
99
</script>
10-
<script type="module" src="main.js"></script>
10+
<script type="text/javascript" src="main.js"></script>
11+
<script type="text/javascript">
12+
HTMLPreview.init();
13+
</script>
14+
1115
</body>
12-
</html>
16+
</html>
17+
18+
19+
20+

pages/main.js

+213-56
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,223 @@
1-
//import { xmlGetHttpRequest } from "./xml-get-http-request.js"
2-
//import {getGistFirstFileText} from "./get-gist-first-file-text.js"
1+
var HTMLPreview = {
32

3+
content: '',
4+
interval: null,
45

6+
previewform: document.getElementById('previewform'),
57

8+
file: function () {
9+
return location.search.substring(1); //Get everything after the ?
10+
},
611

7-
const getGistFirstFileText = async url => {
8-
return new Promise(async res => {
9-
try {
10-
const { data: gistData, error: gistError } = await xmlGetHttpRequest(url)
11-
if (gistError) res({ error: gistError })
12-
// ─────────────────────────────────────────────────────
13-
// 1. find raw link
14-
const html = JSON.parse(gistData).div
15-
console.log(html)
16-
let rawLink = ""
17-
html.split('href="').forEach(text => {
18-
const link = text.split('"')[0]
19-
console.log(link)
20-
if (link.includes("/raw/")) rawLink = link
21-
})
22-
if (!rawLink) res({ error: "raw link not found" })
23-
// ─────────────────────────────────────────────────────
24-
// 2. get raw text
25-
const { data: rawData, error: rawError } = await xmlGetHttpRequest(
26-
rawLink
27-
)
28-
if (rawError) res({ error: rawError })
29-
// ─────────────────────────────────────────────────────
30-
31-
res({ data: rawData })
32-
console.log(data)
33-
} catch (e) {
34-
res({ error: String(e) })
35-
}
36-
})
37-
}
38-
const xmlGetHttpRequest = async url => {
39-
return new Promise(res => {
40-
try {
41-
const request = new XMLHttpRequest()
42-
43-
request.onreadystatechange = function() {
44-
if (request.readyState === 4) {
45-
if (request.status === 200) res({ data: request.responseText })
46-
else res({ error: String(request.status) })
47-
}
48-
}
49-
50-
request.open("GET", url, true)
51-
request.send()
52-
} catch (e) {
53-
res({ error: String(e) })
54-
}
55-
})
56-
}
57-
12+
getGistList: function (yourUrl) {
13+
let Httpreq = new XMLHttpRequest(); // a new request
14+
Httpreq.open("GET", yourUrl, false);
15+
Httpreq.send(null);
16+
return JSON.parse(Httpreq.responseText);
17+
},
18+
getUrlJson: function (json) {
19+
if (json.raw_url) {
20+
let arrayUrl = json.raw_url.split("/");
21+
let fileName = arrayUrl.pop();
22+
arrayUrl.pop();
23+
arrayUrl.push(fileName);
24+
return location.href.split('?')[0] + '?' + arrayUrl.join("/");
25+
} else if (json.download_url) {
26+
return location.href.split('?')[0] + '?' + json.download_url;
27+
}
28+
else {
29+
return location.href;
30+
}
31+
},
32+
findFile: function (files) {
33+
let filesKeys = Object.keys(files);
34+
let firstHtml = false;
35+
for (i = 0; i < filesKeys.length; ++i) {
36+
let name = files[filesKeys[i]].filename ? files[filesKeys[i]].filename : files[filesKeys[i]].name;
37+
if (name.indexOf('index.html') > 0) {
38+
location.href = HTMLPreview.getUrlJson(files[filesKeys[i]]);
39+
return false;
40+
} else if (name.indexOf('.html') > 0 && !firstHtml) {
41+
firstHtml = HTMLPreview.getUrlJson(files[filesKeys[i]]);
42+
}
43+
}
44+
if (firstHtml) {
45+
location.href = firstHtml;
46+
return false;
47+
}
48+
location.href = HTMLPreview.file() + '?no-render=true';
49+
HTMLPreview.loading('RAW file');
50+
return false;
51+
},
52+
getGistHtmlFile() {
53+
let jsonGist;
54+
if (HTMLPreview.file().indexOf('//gist.github.com/') > 0) {
55+
jsonGist = HTMLPreview.getGistList('https://api.github.com/gists/' + HTMLPreview.file().split('/').slice(-1)[0]).files;
56+
HTMLPreview.findFile(jsonGist);
57+
} else if (HTMLPreview.file().indexOf('//github.com/') > 0) {
58+
var ref = '';
59+
var link = '';
60+
if(HTMLPreview.file().indexOf("/tree/") !== -1) {
61+
ref = '?ref=' + HTMLPreview.file().split('/tree/')[1];
62+
link = HTMLPreview.file().split('/').slice(-4).slice(0,2).join('/');
63+
} else if(HTMLPreview.file().indexOf("/blob/") !== -1) {
64+
ref = '?ref=' + HTMLPreview.file().split('/blob/')[1];
65+
link = HTMLPreview.file().split('/').slice(-4).slice(0,2).join('/');
66+
} else {
67+
link = HTMLPreview.file().split('/').slice(-2).join('/');
68+
}
69+
console.log('link:',link);
70+
jsonGist = HTMLPreview.getGistList('https://api.github.com/repos/' + link + '/contents/' + ref);
71+
HTMLPreview.findFile(jsonGist);
72+
} else {
73+
console.log('Can\'t render this link, than\'s not an html file or git / gist repos');
74+
}
75+
},
76+
raw: function () {
77+
return HTMLPreview.file().replace(/\/\/github\.com/, '//raw.githubusercontent.com').replace(/\/blob\//, '/'); //Get URL of the raw file
5878

79+
},
5980

81+
replaceAssets: function () {
82+
let frame, a, link, script, i, href, src;
83+
frame = document.querySelectorAll('iframe[src],frame[src]');
84+
for (i = 0; i < frame.length; ++i) {
85+
src = frame[i].src; //Get absolute URL
86+
if (src.indexOf('//gist.githubusercontent.com') > 0 || src.indexOf('//raw.githubusercontent.com') > 0 || src.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
87+
frame[i].src = location.href.split('?')[0] + '?' + src; //Then rewrite URL so it can be loaded using YQL
88+
}
89+
}
90+
a = document.querySelectorAll('a[href]');
91+
for (i = 0; i < a.length; ++i) {
92+
href = a[i].href; //Get absolute URL
93+
if (href.indexOf('#') > 0) { //Check if it's an anchor
94+
a[i].href = location.href.split('?')[0] + location.search + '#' + a[i].hash.substring(1); //Then rewrite URL with support for empty anchor
95+
}
96+
else if ((href.indexOf('//gist.githubusercontent.com') > 0 || href.indexOf('//raw.githubusercontent.com') > 0 || href.indexOf('//bitbucket.org') > 0) && (href.indexOf('.html') > 0 || href.indexOf('.htm') > 0)) { //Check if it's from raw.github.com or bitbucket.org and to HTML files
97+
a[i].href = location.href.split('?')[0] + '?' + href; //Then rewrite URL so it can be loaded using YQL
98+
}
99+
}
100+
if (document.querySelectorAll('frameset').length)
101+
return; //Don't replace CSS/JS if it's a frameset, because it will be erased by document.write()
102+
link = document.querySelectorAll('link[rel=stylesheet]');
103+
for (i = 0; i < link.length; ++i) {
104+
href = link[i].href; //Get absolute URL
105+
if (href.indexOf('//gist.githubusercontent.com') > 0 || href.indexOf('//raw.githubusercontent.com') > 0 || href.indexOf('//bitbucket.org') > 0 || href.indexOf('//') === -1) { //Check if it's from raw.github.com or bitbucket.org
106+
HTMLPreview.send(href, 'loadCSS'); //Then load it using YQL
107+
}
108+
else if (href.indexOf('//') === -1) {
109+
HTMLPreview.send('https://raw.githubusercontent.com/' + href, 'loadCSS');
110+
}
111+
}
112+
script = document.querySelectorAll('script[type="text/htmlpreview"]');
113+
for (i = 0; i < script.length; ++i) {
114+
src = script[i].src; //Get absolute URL
115+
if (src.indexOf('//gist.githubusercontent.com') > 0 || src.indexOf('//raw.githubusercontent.com') > 0 || src.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
116+
HTMLPreview.send(src, 'loadJS'); //Then load it using YQL
117+
}
118+
else { //Append all inline scripts
119+
script[i].removeAttribute('type');
120+
document.write(script[i].outerHTML);
121+
}
122+
}
123+
},
60124

125+
loadHTML: function (data) {
126+
if (data
127+
&& data.query
128+
&& data.query.diagnostics
129+
&& data.query.diagnostics.redirect) {
130+
HTMLPreview.send(data.query.diagnostics.redirect.content, 'loadHTML');
131+
}
132+
else if (data
133+
&& data.query
134+
&& data.query.results
135+
&& data.query.results.resources
136+
&& data.query.results.resources.content
137+
&& data.query.results.resources.status == 200) {
138+
HTMLPreview.content = data.query.results.resources.content.replace(/<head>/i, '<head><base href="' + HTMLPreview.raw() + '">').replace(/<script( type=["'](text|application)\/javascript["'])?/gi, '<script type="text/htmlpreview"').replace(/<\/body>/i, '<script src="' + location.href.split('?')[0] + '/htmlpreview.js"></script><script>HTMLPreview.replaceAssets();</script></body>').replace(/<\/head>\s*<frameset/gi, '<script src="' + location.href.split('?')[0] + '/htmlpreview.js"></script><script>document.addEventListener("DOMContentLoaded",HTMLPreview.replaceAssets,false);</script></head><frameset'); //Add <base> just after <head> and inject <script> just before </body> or </head> if <frameset>
139+
setTimeout(function () {
140+
document.open();
141+
document.write(HTMLPreview.content);
142+
document.close();
143+
}, 50); //Delay updating document to have it cleared before
144+
}
145+
else if (data
146+
&& data.error
147+
&& data.error.description) {
148+
HTMLPreview.previewform.innerHTML = data.error.description;
149+
}
150+
else
151+
HTMLPreview.previewform.innerHTML = 'Error: Cannot load file ' + HTMLPreview.raw();
152+
},
61153

62-
const gistUrl = 'https://gist.github.com/sturmenta/df1c9da1f219c88e996e48f19d57acd3';
154+
loadCSS: function (data) {
155+
if (data
156+
&& data.query
157+
&& data.query.diagnostics
158+
&& data.query.diagnostics.redirect) {
159+
HTMLPreview.send(data.query.diagnostics.redirect.content, 'loadCSS');
160+
}
161+
else if (data
162+
&& data.query
163+
&& data.query.results
164+
&& data.query.results.resources
165+
&& data.query.results.resources.content
166+
&& data.query.results.resources.status == 200) {
167+
document.write('<style>' + data.query.results.resources.content.replace(/url\((?:'|")?([^\/][^:'"\)]+)(?:'|")?\)/gi, 'url(' + data.query.results.resources.url.replace(/[^\/]+\.css.*$/gi, '') + '$1)') + '</style>'); //If relative URL in CSS background-image property, then concatenate URL to CSS directory
168+
}
169+
},
63170

64-
const {data, error} = /*await*/ getGistFirstFileText(`${gistUrl}.json`);
171+
loadJS: function (data) {
172+
if (data
173+
&& data.query
174+
&& data.query.diagnostics
175+
&& data.query.diagnostics.redirect) {
176+
HTMLPreview.send(data.query.diagnostics.redirect.content, 'loadJS');
177+
}
178+
else if (data
179+
&& data.query
180+
&& data.query.results
181+
&& data.query.results.resources
182+
&& data.query.results.resources.content
183+
&& data.query.results.resources.status == 200) {
184+
document.write('<script>' + data.query.results.resources.content + '</script>');
185+
}
186+
},
65187

66-
console.log(data);
188+
send: function (file, callback) {
189+
document.write('<script src="//query.yahooapis.com/v1/public/yql?q=use%20%22https%3A%2F%2Fraw.githubusercontent.com%2Fyql%2Fyql-tables%2Fmaster%2Fdata%2Fdata.headers.xml%22%20as%20headers%3B%20select%20*%20from%20headers%20where%20url%3D%22' + encodeURIComponent(file) + '%22&format=json&diagnostics=true&callback=HTMLPreview.' + callback + '"></script>'); //Get content using YQL
190+
},
191+
192+
submitform: function () {
193+
location.href = location.href.split('?')[0] + '?' + document.getElementById('file').value;
194+
return false;
195+
},
196+
197+
loading: function (opt) {
198+
let loadvalue = 0;
199+
HTMLPreview.interval = setInterval(function () {
200+
if (loadvalue >= 100) {
201+
clearInterval(HTMLPreview.interval);
202+
}
203+
if (HTMLPreview.previewform) {
204+
HTMLPreview.previewform.innerHTML = `<p>Loading ${opt}...</p><div class="progress"><div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="${loadvalue}" aria-valuemin="0" aria-valuemax="100" style="width: ${loadvalue}%"></div></div>`;
205+
} else {
206+
clearInterval(HTMLPreview.interval);
207+
}
208+
loadvalue += 1;
209+
}, 20);
210+
},
211+
init: function () {
212+
HTMLPreview.previewform.onsubmit = HTMLPreview.submitform;
213+
if (HTMLPreview.file()) {
214+
if (HTMLPreview.file().indexOf('.html') === -1 && HTMLPreview.file().indexOf('?no-render=true') === -1) {
215+
HTMLPreview.getGistHtmlFile(HTMLPreview.file());
216+
return false;
217+
} else {
218+
HTMLPreview.send(HTMLPreview.raw(), 'loadHTML');
219+
HTMLPreview.loading();
220+
}
221+
}
222+
}
223+
}

pages/skibidi-toilet.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
//skibidi toilet
2+
//this needs to be viewed in a monospace font lol
3+
//this is a text file, why the fuck am I commenting my text
4+
/*
25
+++++++++++***++++-:::::::::::::::::-+:..................................................::::::::::...
36
++++++++++++**++++=:::::::::::::::::-=:..................................................::::::::::...
47
++++++++++++**+++==:::::::::::::::::-+::.................................................::::::::::...
@@ -90,3 +93,4 @@
9093
---:::::-==-:::----::----::::::::::::::::--:...............:::...........:::........ ...............
9194
::::::::::::::::::::::::::::::::::::::::---:.......:...::.......... ....::...............:........ .
9295
:---::::-::::::::::::::::---::::::::::-----::.:::::-:::::::::.........:-::.::.....::.......:::::......
96+
*/

0 commit comments

Comments
 (0)