mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-25 06:47:16 +00:00
Attempt to convert to ES5
This commit is contained in:
commit
6985bf6f10
|
@ -6,15 +6,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function SmoothScroll() {
|
function SmoothScroll() {
|
||||||
var navLinks, eventListener, link;
|
var navLinks, eventListener, link;
|
||||||
if (!("scrollBehavior" in document.documentElement.style)) {
|
if (!("scrollBehavior" in document.documentElement.style)) {
|
||||||
navLinks = document.querySelectorAll("#toc a");
|
navLinks = document.querySelectorAll("#toc a");
|
||||||
eventListener = function eventListener(e) {
|
eventListener = function eventListener(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.target.scrollIntoView({
|
e.target.scrollIntoView({
|
||||||
behavior: "smooth"
|
behavior: "smooth"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
for (link in navLinks) {
|
for (link in navLinks) {
|
||||||
if (Object.prototype.hasOwnProperty.call(navLinks, link)) {
|
if (Object.prototype.hasOwnProperty.call(navLinks, link)) {
|
||||||
|
@ -30,15 +30,15 @@ function ScrollSpy() {
|
||||||
var scrollPos = document.documentElement.scrollTop || document.body.scrollTop,
|
var scrollPos = document.documentElement.scrollTop || document.body.scrollTop,
|
||||||
section, id;
|
section, id;
|
||||||
|
|
||||||
for (section in sections) {
|
for (section in sections) {
|
||||||
if (
|
if (
|
||||||
Object.prototype.hasOwnProperty.call(sections, section) &&
|
Object.prototype.hasOwnProperty.call(sections, section) &&
|
||||||
sections[section].offsetTop <= scrollPos
|
sections[section].offsetTop <= scrollPos
|
||||||
) {
|
) {
|
||||||
id = mw.util.escapeIdForAttribute(sections[section].id),
|
id = mw.util.escapeIdForAttribute(sections[section].id),
|
||||||
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");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue