Re-write to cleanup all styles and such (#158)
* Rewrite and re-style the wiki * Fix links * Fix mobile width being wrong * Make the anticheat warning pretty * Fix root pages * Fix code blocks and cleanup some other bits * Fix search * Fix android and iOS sidebar links
This commit is contained in:
1 parent
17e1be5177
commit
09025ac3cb
93 files changed
+595
-3676
No files matched your search
@@ -0,0 +1,26 @@
|
||||
(function () {
|
||||
const toc = document.querySelector('#page-nav')
|
||||
|
||||
// Select each header
|
||||
const sections = document.querySelectorAll('main h1')
|
||||
sections.forEach((section, id) => {
|
||||
// Create the header link
|
||||
toc.innerHTML += '<div id="link_' + section.id + '" class="md-nav__item"><a class="md-nav__link" href="#' + section.id + '" title="' + section.textContent + '">' + section.textContent + '</a></div>'
|
||||
|
||||
// Create the sub links container
|
||||
const children = document.createElement('nav')
|
||||
children.className = 'md-nav'
|
||||
children.innerHTML = '<ul class="md-nav__list"></ul>'
|
||||
|
||||
// Select all the sub headers and add them to the sub links container
|
||||
let contenders = section.nextElementSibling
|
||||
while (contenders && contenders.tagName !== 'H1') {
|
||||
if (contenders.tagName === 'H2' || contenders.tagName === 'H3') {
|
||||
const content = '<li class="md-nav__item"><a class="md-nav__link" href="#' + contenders.id + '" title="' + contenders.textContent + '">' + contenders.textContent + '</a></li>'
|
||||
children.firstElementChild.innerHTML += content
|
||||
}
|
||||
contenders = contenders.nextElementSibling
|
||||
}
|
||||
document.querySelector('#link_' + section.id).appendChild(children)
|
||||
})
|
||||
})()
|
||||
Reference in new issue
Block a user