blob: b3e8bc88554a88e341cf7dad3fc8f261f13abe85 (
plain)
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
|
const Main = (() => {
const list = document.getElementById("list");
const names = document.querySelectorAll("[data-Name]");
const search = document.getElementById("search");
const form = document.forms[0];
const init = () => {
list.innerHTML = Config.Links.map(([gName, Links]) => `
<li>
<h1 onclick="this.parentNode.classList.toggle('hideChildren')">${gName}</h1>
<ul>
${Links.map(([lName, url]) => `
<li>
<a href="${url}">${lName}</a>
</li>`
).join("")}
</ul>
</li>`
).join("")
names.forEach(el => {
el.innerText = Config.name;
});
document.addEventListener("keydown", e => e.key.length === 1 && search.focus());
search.addEventListener("keydown", () => (window.event ? event.keyCode : e.which) == 13 && form.submit());
};
return {
init,
};
})();
Main.init()
|