From 0f5208ef183ca82db96d83c1f1d605904b8911ff Mon Sep 17 00:00:00 2001 From: github-actions Date: Sat, 15 Feb 2020 23:11:35 +0000 Subject: [PATCH] Github CI lint - phpcbf --- resources/scripts/header.js | 88 ++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/resources/scripts/header.js b/resources/scripts/header.js index da729428..6b9b0763 100644 --- a/resources/scripts/header.js +++ b/resources/scripts/header.js @@ -4,56 +4,56 @@ */ (function() { - // Hide header on scroll down - var didScroll, - lastScrollTop = 0, - navbarHeight = 0, - delta = 0, - header = document.getElementsByTagName('header')[0], - headerContainer = document.querySelector('.mw-header-container'); + // Hide header on scroll down + var didScroll, + lastScrollTop = 0, + navbarHeight = 0, + delta = 0, + header = document.getElementsByTagName('header')[0], + headerContainer = document.querySelector('.mw-header-container'); - if (headerContainer !== null) { - navbarHeight = headerContainer.offsetHeight; - } + if (headerContainer !== null) { + navbarHeight = headerContainer.offsetHeight; + } - window.addEventListener('scroll', function() { - didScroll = true; - }); + window.addEventListener('scroll', function() { + didScroll = true; + }); - function hasScrolled() { - var st = window.scrollY, - body, - html, - documentHeight; + function hasScrolled() { + var st = window.scrollY, + body, + html, + documentHeight; - if (Math.abs(lastScrollTop - st) <= delta) { - return; - } + if (Math.abs(lastScrollTop - st) <= delta) { + return; + } - if (st > lastScrollTop && st > navbarHeight) { - // If scrolled down and past the navbar, add class .nav-up. - // Scroll Down - header.classList.remove('nav-down'); - header.classList.add('nav-up'); - } else { - // Scroll Up - body = document.body; - html = document.documentElement; - documentHeight = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight); + if (st > lastScrollTop && st > navbarHeight) { + // If scrolled down and past the navbar, add class .nav-up. + // Scroll Down + header.classList.remove('nav-down'); + header.classList.add('nav-up'); + } else { + // Scroll Up + body = document.body; + html = document.documentElement; + documentHeight = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight); - if (st + window.innerHeight < documentHeight) { - header.classList.remove('nav-up'); - header.classList.add('nav-down'); - } - } + if (st + window.innerHeight < documentHeight) { + header.classList.remove('nav-up'); + header.classList.add('nav-down'); + } + } - lastScrollTop = st; - } + lastScrollTop = st; + } - setInterval(function() { - if (didScroll) { - hasScrolled(); - didScroll = false; - } - }, 250); + setInterval(function() { + if (didScroll) { + hasScrolled(); + didScroll = false; + } + }, 250); })(); \ No newline at end of file