From 97f8846a445ba85e8ef20c0ad221139214303f4b Mon Sep 17 00:00:00 2001 From: github-actions Date: Sat, 15 Feb 2020 22:32:59 +0000 Subject: [PATCH] Github CI lint - phpcbf --- resources/scripts/toc.js | 108 +++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/resources/scripts/toc.js b/resources/scripts/toc.js index 3dd64d49..b5e39242 100644 --- a/resources/scripts/toc.js +++ b/resources/scripts/toc.js @@ -6,66 +6,66 @@ */ var SmoothScroll = function SmoothScroll() { - if (!("scrollBehavior" in document.documentElement.style)) { - var navLinks = document.querySelectorAll("#toc a"), - eventListener = function eventListener(e) { - e.preventDefault(); - e.target.scrollIntoView({ - behavior: "smooth" - }); - }; + if (!("scrollBehavior" in document.documentElement.style)) { + var navLinks = document.querySelectorAll("#toc a"), + eventListener = function eventListener(e) { + e.preventDefault(); + e.target.scrollIntoView({ + behavior: "smooth" + }); + }; - for (var link in navLinks) { - if (Object.prototype.hasOwnProperty.call(navLinks, link)) { - navLinks[link].addEventListener("click", eventListener); - } - } - } - }, - ScrollSpy = function ScrollSpy() { - var sections = document.querySelectorAll(".mw-headline"); - window.addEventListener("scroll", function() { - var scrollPos = - document.documentElement.scrollTop || document.body.scrollTop; + for (var link in navLinks) { + if (Object.prototype.hasOwnProperty.call(navLinks, link)) { + navLinks[link].addEventListener("click", eventListener); + } + } + } + }, + ScrollSpy = function ScrollSpy() { + var sections = document.querySelectorAll(".mw-headline"); + window.addEventListener("scroll", function() { + var scrollPos = + document.documentElement.scrollTop || document.body.scrollTop; - for (var section in sections) { - if ( - Object.prototype.hasOwnProperty.call(sections, section) && - sections[section].offsetTop <= scrollPos - ) { - var id = mw.util.escapeIdForAttribute(sections[section].id), - node = document.querySelector('a[href * = "'.concat(id, '"]')) - .parentNode, - active = document.querySelector(".active"); + for (var section in sections) { + if ( + Object.prototype.hasOwnProperty.call(sections, section) && + sections[section].offsetTop <= scrollPos + ) { + var id = mw.util.escapeIdForAttribute(sections[section].id), + node = document.querySelector('a[href * = "'.concat(id, '"]')) + .parentNode, + active = document.querySelector(".active"); - if (active !== null) { - active.classList.remove("active"); - } + if (active !== null) { + active.classList.remove("active"); + } - if (node !== null) { - node.classList.add("active"); - } - } - } - }); - }, - CheckToC = function CheckToC() { - if (document.getElementById("toc")) { - SmoothScroll(); - ScrollSpy(); - } - }; + if (node !== null) { + node.classList.add("active"); + } + } + } + }); + }, + CheckToC = function CheckToC() { + if (document.getElementById("toc")) { + SmoothScroll(); + ScrollSpy(); + } + }; if (document.readyState !== "loading") { - CheckToC(); + CheckToC(); } else if (document.addEventListener) { - // All modern browsers to register DOMContentLoaded - document.addEventListener("DOMContentLoaded", CheckToC); + // All modern browsers to register DOMContentLoaded + document.addEventListener("DOMContentLoaded", CheckToC); } else { - // Old IE browsers - document.attachEvent("onreadystatechange", function() { - if (document.readyState === "complete") { - CheckToC(); - } - }); + // Old IE browsers + document.attachEvent("onreadystatechange", function() { + if (document.readyState === "complete") { + CheckToC(); + } + }); } \ No newline at end of file