2016-06-26 19:45:51 +02:00
|
|
|
def rjs(f, z):
|
|
|
|
result = []
|
|
|
|
result.append("if (" + str(ord(f[1].upper())) + " == x && z == '"+z+"') {")
|
|
|
|
result.append("document.getElementById(z+'" + f[1] + "').style.color = '#CC0000';")
|
|
|
|
if type(f[2]) == str:
|
|
|
|
result.append("window.location = '" + f[2] + "';")
|
|
|
|
else:
|
|
|
|
result.append("z = z + '"+f[1]+"';")
|
|
|
|
result.append("var x = document.getElementsByClassName(z);")
|
|
|
|
result.append("for (var i = 0; i < x.length; i++) { x[i].style.display = 'inline-block'; }")
|
|
|
|
result.append("var x = document.getElementById(z);")
|
2016-06-26 23:48:23 +02:00
|
|
|
result.append("x.onclick = function() { collapse('" + str(z) + "');}")
|
2016-06-26 19:45:51 +02:00
|
|
|
result.append("}")
|
|
|
|
if type(f[2]) != str:
|
|
|
|
for l in f[2]:
|
|
|
|
result.append(rjs(l, z + f[1]))
|
|
|
|
return "\n".join(result)
|
|
|
|
|
|
|
|
def rjs2(f, z):
|
|
|
|
result = []
|
|
|
|
if type(f[2]) != str:
|
|
|
|
result.append("if (z == '"+z+"') {")
|
2016-06-26 23:48:23 +02:00
|
|
|
result.append("document.getElementById(z+'" + f[1] + "').onclick = function() { if (z != \""+z+"\") { collapse(\""+z+"\") } key({keyCode:" + str(ord(f[1].upper())) + " }) };")
|
2016-06-26 19:45:51 +02:00
|
|
|
result.append("}")
|
|
|
|
for l in f[2]:
|
|
|
|
result.append(rjs2(l, z + f[1]))
|
|
|
|
return "\n".join(result)
|
|
|
|
|
|
|
|
def rhtml(f, z):
|
|
|
|
result = []
|
|
|
|
href = []
|
|
|
|
if type(f[2]) == str:
|
|
|
|
href = ["href='"+f[2]+"'"]
|
|
|
|
if len(z) > 0:
|
|
|
|
href = ["style='display: none;'"]
|
2016-06-26 23:48:23 +02:00
|
|
|
result.append(''.join(["<a class='"+z+"' id='",z,f[1],"' ",*href," onclick='if (z == \""+z+"\") { key({keyCode:"+str(ord(f[1].upper()))+"}) }'>", f[0], "</a>"]))
|
2016-06-26 19:45:51 +02:00
|
|
|
if type(f[2]) != str:
|
|
|
|
result.append("<span style='position: absolute; left: 200px; top: 0px;'>")
|
|
|
|
for l in f[2]:
|
|
|
|
result.append(rhtml(l, z + f[1]))
|
|
|
|
result.append("</span>")
|
|
|
|
result.append("<br />")
|
|
|
|
return "\n".join(result)
|
|
|
|
|
|
|
|
l = [
|
|
|
|
["/r/", "r", [
|
2016-07-05 20:56:01 +02:00
|
|
|
["/inbox", "i", "https://reddit.com/message/inbox"]
|
|
|
|
, ["/modmail", "m", "https://reddit.com/message/moderator"]
|
|
|
|
, ["/all", "a", "https://reddit.com/r/all"]
|
2016-06-26 19:45:51 +02:00
|
|
|
, ["/top", "t", "https://reddit.com/r/all/top?t=1h"]
|
2016-07-02 05:07:56 +02:00
|
|
|
, ["/shithole/","s", [
|
|
|
|
["/default", "d", "https://reddit.com/r/freegamesonsteam"]
|
|
|
|
, ["/spam", "s", "https://www.reddit.com/r/FreeGamesOnSteam/about/spam/"]
|
|
|
|
, ["/reports", "r", "https://www.reddit.com/r/FreeGamesOnSteam/about/reports/"]
|
|
|
|
, ["/new", "n", "https://reddit.com/r/FreeGamesOnSteam/new"]
|
|
|
|
]]
|
2016-06-29 00:23:12 +02:00
|
|
|
, ["/common/", "c", [
|
|
|
|
["/seatte", "e","https://reddit.com/r/seattle" ]
|
|
|
|
, ["/sysadmin", "s","https://reddit.com/r/sysadmin" ]
|
|
|
|
, ["/programmerhumor", "p","https://reddit.com/r/programmerhumor" ]
|
|
|
|
, ["/4chan", "4","https://reddit.com/r/4chan" ]
|
|
|
|
, ["/dccomics", "d","https://reddit.com/r/dccomics" ]
|
|
|
|
]]
|
2016-06-26 19:45:51 +02:00
|
|
|
]]
|
|
|
|
, ["/chan/", "c", [
|
|
|
|
["/ck", "k", "https://4chan.org/ck"]
|
|
|
|
, ["/pro", "p", "http://desuchan.moe/pro/"]
|
|
|
|
, ["/tech/", "t", [
|
|
|
|
["/laintech", "l" , "https://lainchan.org/tech/catalog.html"]
|
|
|
|
, ["/desutech", "d", "http://desuchan.moe/tech/"]
|
|
|
|
, ["/g", "g", "https://4chan.org/g"]
|
2016-07-21 06:38:50 +02:00
|
|
|
, ["/8tech", "8", "https://8ch.net/tech/catalog.html"]
|
2016-06-26 19:45:51 +02:00
|
|
|
, ["/silicon", "s", "https://sushigirl.us/silicon/catalog.html"]
|
2016-06-27 01:55:14 +02:00
|
|
|
, ["/endtech", "e", "https://endchan.xyz/tech/catalog.html"]
|
2016-06-29 00:23:12 +02:00
|
|
|
, ["/λ", "p", "https://lainchan.org/%CE%BB/catalog.html"]
|
2016-06-26 19:45:51 +02:00
|
|
|
]]
|
|
|
|
, ["/music/", "m", [
|
|
|
|
["/mu", "m", "http://aurorachan.net/mu/"]
|
|
|
|
, ["/tunes", "t", "https://sushigirl.us/tunes/catalog.html"]
|
2016-07-20 06:58:01 +02:00
|
|
|
, ["/media", "e", "https://uboachan.net/media/catalog.html"]
|
2016-06-26 19:45:51 +02:00
|
|
|
]]
|
|
|
|
, ["/transport", "n", "http://boards.4chan.org/n"]
|
|
|
|
, ["/news", "z", "http://boards.4chan.org/news"]
|
|
|
|
, ["/off_topic/", "o", [
|
|
|
|
["/ot", "o", "https://uboachan.net/ot/catalog.html"]
|
|
|
|
, ["/lounge", "l", "https://sushigirl.us/lounge/catalog.html"]
|
|
|
|
]]
|
2016-07-29 21:38:17 +02:00
|
|
|
, ["/lain/","l", [
|
|
|
|
["/mega", "m" , "https://lainchan.org/mega/catalog.html"]
|
|
|
|
, ["/cyb", "c", "https://lainchan.org/cyb/catalog.html"]
|
|
|
|
, ["/lit", "l", "https://lainchan.org/lit/catalog.html"]
|
|
|
|
, ["/art", "a", "https://lainchan.org/art/catalog.html"]
|
|
|
|
]]
|
2016-06-26 19:45:51 +02:00
|
|
|
]]
|
|
|
|
, ["/vola", "v", "https://volafile.io/r/kUFzLJ"]
|
|
|
|
, ["/tube/", "t", [
|
2016-06-29 00:23:12 +02:00
|
|
|
["/zero", "0", "https://www.youtube.com/playlist?list=PLIKcw9O7i0KR4Q-pC-7MLb_DoRmzYOCUw"]
|
|
|
|
, ["/one", "1", "https://www.youtube.com/playlist?list=PLIKcw9O7i0KRZ43r5UVGNraUgvyPaUMBU"]
|
|
|
|
, ["/two", "2", "https://www.youtube.com/playlist?list=PLIKcw9O7i0KQO4aHOqypivLefSFKq2vp1"]
|
|
|
|
, ["/three", "3", "https://www.youtube.com/playlist?list=PLIKcw9O7i0KSeW6AmMmg3D4etDs5YeX8q"]
|
2016-07-20 06:58:01 +02:00
|
|
|
, ["/four", "4", "https://www.youtube.com/playlist?list=PLIKcw9O7i0KTkhLF_MECKCA8DFWQIsGq7"]
|
2016-06-26 19:45:51 +02:00
|
|
|
]]
|
|
|
|
]
|
2016-07-23 17:26:46 +02:00
|
|
|
special = "https://niles.xyz"
|
2016-06-26 19:45:51 +02:00
|
|
|
|
|
|
|
master = ["""<!doctype html>
|
2016-07-05 20:56:01 +02:00
|
|
|
<!--
|
|
|
|
|
|
|
|
|
|
|
|
This code is auto-generated
|
|
|
|
Any changes you make will be overwritten when you run "make"
|
|
|
|
|
|
|
|
"""]
|
|
|
|
for i in range(100): master.append("")
|
|
|
|
master.append("""
|
|
|
|
-->
|
2016-06-26 19:45:51 +02:00
|
|
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
|
|
<link rel="stylesheet" type="text/css" href="style.css">
|
|
|
|
<script>
|
|
|
|
var z = "";
|
2016-06-29 00:23:12 +02:00
|
|
|
var ctrl = false;
|
|
|
|
var shift = false;
|
|
|
|
function pi() {
|
|
|
|
if (ctrl && shift) {
|
|
|
|
window.location = '""" + special + """';
|
|
|
|
}
|
|
|
|
}
|
2016-06-26 23:48:23 +02:00
|
|
|
function collapse_one() {
|
|
|
|
var x = document.getElementsByClassName(z);
|
|
|
|
for (var i = 0; i < x.length; i++) { x[i].style.display = 'none'; }
|
|
|
|
document.getElementById(z).style.color = '#eeeeee';
|
2016-07-05 20:56:01 +02:00
|
|
|
z = z.substring(0, z.length - 1);""")
|
2016-06-26 23:48:23 +02:00
|
|
|
for f in l:
|
|
|
|
master.append(rjs2(f, ""))
|
|
|
|
master.append("""
|
|
|
|
}
|
|
|
|
function collapse(new_z) {
|
|
|
|
while(z.length > new_z.length) {
|
|
|
|
collapse_one();
|
|
|
|
}
|
|
|
|
}
|
2016-06-29 00:23:12 +02:00
|
|
|
function keyup(event) {
|
|
|
|
event = event || window.event;
|
|
|
|
var x = event.which || event.keyCode;
|
|
|
|
if (x == 17) {
|
|
|
|
ctrl = false;
|
|
|
|
}
|
|
|
|
if (x == 16) {
|
|
|
|
shift = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2016-06-26 19:45:51 +02:00
|
|
|
function key(event) {
|
|
|
|
event = event || window.event;
|
|
|
|
if (event.keyCode == 27) {
|
|
|
|
if (z.length == 0) {
|
|
|
|
return;
|
|
|
|
}
|
2016-06-26 23:48:23 +02:00
|
|
|
collapse_one()
|
|
|
|
""")
|
2016-06-26 19:45:51 +02:00
|
|
|
master.append("""
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var x = event.which || event.keyCode;
|
2016-06-29 00:23:12 +02:00
|
|
|
if (x == 17) {
|
|
|
|
ctrl = true;
|
|
|
|
}
|
|
|
|
if (x == 16) {
|
|
|
|
shift = true;
|
|
|
|
}
|
2016-06-26 19:45:51 +02:00
|
|
|
""")
|
|
|
|
for f in l:
|
|
|
|
master.append(rjs(f, ""))
|
|
|
|
master.append("""
|
|
|
|
}
|
|
|
|
document.onkeydown = key;
|
2016-06-29 00:23:12 +02:00
|
|
|
document.onkeyup = keyup;
|
2016-06-26 19:45:51 +02:00
|
|
|
</script></head>""")
|
2016-06-26 23:48:23 +02:00
|
|
|
master.append("""<body class=""><div id="content">""")
|
2016-06-26 19:45:51 +02:00
|
|
|
for f in l:
|
|
|
|
master.append(rhtml(f, ""))
|
2016-06-29 00:23:12 +02:00
|
|
|
master.append("""</div><div id="pi" onclick='pi();'>π</div></body></html>""")
|
2016-06-26 19:45:51 +02:00
|
|
|
master = "\n".join(master)
|
|
|
|
print(master)
|