-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtopnav.js
More file actions
132 lines (106 loc) · 4.71 KB
/
Copy pathtopnav.js
File metadata and controls
132 lines (106 loc) · 4.71 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
//Inserts a navigation bar into every document linked to it
//also adds the favicon
window.onload = function(){document.head.append('<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest">')};
const topnav = document.getElementsByClassName("topnav")[0];
let link = document.createElement("link");
link.rel = "stylesheet";
link.href = "https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css";
let home = document.createElement("a");
home.href = "https://xorol.github.io";
home.innerText = "Home";
let esolangs = document.createElement("div");
esolangs.classList = ["dropdown"];
esolangs.innerHTML = "<button class=\"dropbtn\"><i class=\"fa fa-caret-down\"> Esolangs</i></button>";
let esolangsContents = document.createElement("div");
esolangsContents.classList = ["dropdown-content"];
let numbers = document.createElement("a");
numbers.href = "https://xorol.github.io/esolangs/numbers.html";
numbers.innerText = "Numbers";
let interpreters = document.createElement("a");
interpreters.href = "https://xorol.github.io/esolangs/interpreters/interpreters.html";
interpreters.innerText = "Interpreters";
let wips = document.createElement("a");
wips.href = "https://xorol.github.io/esolangs/wips.html";
wips.innerText = "WIPs";
let other = document.createElement("div");
other.classList = ["dropdown"];
other.innerHTML = "<button class=\"dropbtn\"><i class=\"fa fa-caret-down\"> Other things I made</i></button>";
let otherContents = document.createElement("div");
otherContents.classList = ["dropdown-content"];
let noise = document.createElement("a");
noise.href = "https://xorol.github.io/other/noise/noise.html";
noise.innerText = "Noise";
let wtd = document.createElement("a");
wtd.href = "https://xorol.github.io/other/wtd/wtd.html";
wtd.innerText = "What's the difference?";
let starcalc = document.createElement("a");
starcalc.href = "https://xorol.github.io/other/starcalc/starcalc.html";
starcalc.innerText = "Star calculator";
let ideologyTest = document.createElement("a")
ideologyTest.href = "https://xorol.github.io/other/ideology_test/ideology_test.html";
ideologyTest.innerText = "Ideology Test";
let tsevhu = document.createElement("a");
tsevhu.href = "https://ab538322-bb07-482b-b4c5-1bdbfd9c77b0.id.repl.co/";
tsevhu.innerText = "Tsevhu";
let rushkDpd = document.createElement("div");
rushkDpd.classList = ["dropdown"];
rushkDpd.innerHTML = "<button class=\"dropbtn\"><i class=\"fa fa-caret-down\"> Rushk</i></button>";
let rushkDpdContents = document.createElement("div");
rushkDpdContents.classList = ["dropdown-content"];
let rushk = document.createElement("a");
rushk.href = "https://xorol.github.io/rushk";
rushk.innerText = "Rushk";
let addDictRushk = document.createElement("a");
addDictRushk.href = "https://xorol.github.io/rushk-add-dict.html";
addDictRushk.innerText = "Adding dictionaries";
switch (window.location.href) {
case "https://xorol.github.io":
case "https://xorol.github.io/index.html":
home.classList = ["active"];
break;
case "https://xorol.github.io/esolangs/numbers.html":
numbers.classList = ["active"];
break;
case "https://xorol.github.io/esolangs/interpreters/interpreters.html":
interpreters.classList = ["active"];
break;
case "https://xorol.github.io/esolangs/wips.html":
wips.classList = ["active"];
break;
case "https://xorol.github.io/other/wtd/wtd.html":
wtd.classList = ["active"];
break;
case "https://xorol.github.io/other/starcalc/starcalc.html":
starcalc.classList = ["active"];
break;
case "https://ab538322-bb07-482b-b4c5-1bdbfd9c77b0.id.repl.co/":
tsevhu.classList = ["active"];
break;
case "https://xorol.github.io/rushk":
rushk.classList = ["active"];
break;
case "https://xorol.github.io/rushk-add-dict.html":
addDictRushk.classList = ["active"];
break;
case "https://xorol.github.io/other/ideology_test/ideology_test.html":
ideologyTest.classList = ["active"];
break;
}
esolangsContents.appendChild(numbers);
esolangsContents.appendChild(wips);
esolangsContents.appendChild(interpreters);
esolangs.appendChild(esolangsContents);
otherContents.appendChild(noise);
otherContents.appendChild(wtd);
otherContents.appendChild(starcalc);
otherContents.appendChild(ideologyTest);
other.appendChild(otherContents);
rushkDpdContents.appendChild(rushk);
rushkDpdContents.appendChild(addDictRushk);
rushkDpd.appendChild(rushkDpdContents);
topnav.appendChild(link);
topnav.appendChild(home);
topnav.appendChild(esolangs);
topnav.appendChild(other);
topnav.appendChild(rushkDpd);
topnav.appendChild(tsevhu);