mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-29 00:31:09 +00:00
Attempt to convert to ES5
This commit is contained in:
commit
bfec3c1135
|
@ -16,12 +16,12 @@ function SmoothScroll() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
for (link in navLinks) {
|
for (link in navLinks) {
|
||||||
if (Object.prototype.hasOwnProperty.call(navLinks, link)) {
|
if (Object.prototype.hasOwnProperty.call(navLinks, link)) {
|
||||||
navLinks[link].addEventListener("click", eventListener);
|
navLinks[link].addEventListener("click", eventListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ScrollSpy() {
|
function ScrollSpy() {
|
||||||
|
@ -39,35 +39,34 @@ function ScrollSpy() {
|
||||||
node = document.querySelector('a[href * = "'.concat(id, '"]'))
|
node = document.querySelector('a[href * = "'.concat(id, '"]'))
|
||||||
.parentNode,
|
.parentNode,
|
||||||
active = document.querySelector(".active");
|
active = document.querySelector(".active");
|
||||||
|
if (active !== null) {
|
||||||
if (active !== null) {
|
active.classList.remove("active");
|
||||||
active.classList.remove("active");
|
}
|
||||||
}
|
if (node !== null) {
|
||||||
if (node !== null) {
|
node.classList.add("active");
|
||||||
node.classList.add("active");
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function CheckToC() {
|
function CheckToC() {
|
||||||
if (document.getElementById("toc")) {
|
if (document.getElementById("toc")) {
|
||||||
SmoothScroll();
|
SmoothScroll();
|
||||||
ScrollSpy();
|
ScrollSpy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.readyState !== "loading") {
|
if (document.readyState !== "loading") {
|
||||||
CheckToC();
|
CheckToC();
|
||||||
} else if (document.addEventListener) {
|
} else if (document.addEventListener) {
|
||||||
// All modern browsers to register DOMContentLoaded
|
// All modern browsers to register DOMContentLoaded
|
||||||
document.addEventListener("DOMContentLoaded", CheckToC);
|
document.addEventListener("DOMContentLoaded", CheckToC);
|
||||||
} else {
|
} else {
|
||||||
// Old IE browsers
|
// Old IE browsers
|
||||||
document.attachEvent("onreadystatechange", function() {
|
document.attachEvent("onreadystatechange", function() {
|
||||||
if (document.readyState === "complete") {
|
if (document.readyState === "complete") {
|
||||||
CheckToC();
|
CheckToC();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
Loading…
Reference in a new issue