| Line 1: |
Line 1: |
| | /* All JavaScript here will be loaded for users of the Timeless skin */ | | /* All JavaScript here will be loaded for users of the Timeless skin */ |
| | + | /* |
| | + | $(document).ready(function(){ |
| | + | setTimeout(removeLoader, 120); //wait for page load PLUS 0.12 seconds. |
| | + | }); |
| | + | function removeLoader(){ |
| | + | $( "#smooth-loader" ).fadeOut(500, function() { |
| | + | // fadeOut complete. Remove the loading div |
| | + | $( "#smooth-loader" ).remove(); //makes page more lightweight |
| | + | }); |
| | + | } |
| | + | */ |
| | + | //SB |
| | + | if ($.inArray("Drawn to Life: SpongeBob SquarePants Edition", mw.config.get('wgCategories')) > -1) { |
| | + | $(function() { |
| | + | "use strict"; |
| | + | $('#mw-content-container').css('background', 'url(https://drawntolife.wiki/w/backgrounds/Spongebob_DtL_Wiki.webp) bottom center no-repeat fixed'); |
| | + | $('#mw-content-container').css('background-size', 'cover') |
| | + | }) |
| | + | } |
| | | | |
| | //Wii | | //Wii |
| Line 94: |
Line 113: |
| | }); | | }); |
| | | | |
| − | /* Undoes One-sided navigation if page length is short or page is being edited */ | + | (function(){ |
| − | $(function() {
| + | |
| − | var calheight = $(".mw-body").height();
| + | var doc = document.documentElement; |
| | + | var w = window; |
| | + | |
| | + | var prevScroll = w.scrollY || doc.scrollTop; |
| | + | var curScroll; |
| | + | var direction = 0; |
| | + | var prevDirection = 0; |
| | + | |
| | + | var header = document.getElementById('mw-header-container'); |
| | + | |
| | + | var checkScroll = function() { |
| | + | |
| | + | /* |
| | + | ** Find the direction of scroll |
| | + | ** 0 - initial, 1 - up, 2 - down |
| | + | */ |
| | + | |
| | + | curScroll = w.scrollY || doc.scrollTop; |
| | + | if (curScroll > prevScroll) { |
| | + | //scrolled up |
| | + | direction = 2; |
| | + | } |
| | + | else if (curScroll < prevScroll) { |
| | + | //scrolled down |
| | + | direction = 1; |
| | + | } |
| | + | |
| | + | if (direction !== prevDirection) { |
| | + | toggleHeader(direction, curScroll); |
| | + | } |
| | + | |
| | + | prevScroll = curScroll; |
| | + | }; |
| | + | |
| | + | var toggleHeader = function(direction, curScroll) { |
| | + | if (direction === 2 && curScroll > 52) { |
| | + | |
| | + | //replace 52 with the height of your header in px |
| | + | |
| | + | header.classList.add('hide'); |
| | + | prevDirection = direction; |
| | + | } |
| | + | else if (direction === 1) { |
| | + | header.classList.remove('hide'); |
| | + | prevDirection = direction; |
| | + | } |
| | + | }; |
| | + | |
| | + | window.addEventListener('scroll', checkScroll); |
| | | | |
| − | if (calheight > 1428) {
| + | })(); |
| − | //BAKI CODE - Fixes un-interactive logo
| |
| − | $("#mw-content-block").addClass("onenavjs-1");
| |
| − | $("#mw-content, #content-bottom-stuff").addClass("onenavjs-2");
| |
| − | $("#mw-content-wrapper").addClass("onenavjs-3");
| |
| − | $("#mw-related-navigation").addClass("onenavjs-4");
| |
| − | $("#mw-site-navigation").addClass("onenavjs-5");
| |
| − | $("#mw-site-navigation .sidebar-chunk").addClass("onenavjs-6");
| |
| − | $("div.color-middle").addClass("onenavjs-7");
| |
| − | //
| |
| − | //Align top colour bar with page columns
| |
| − | $('.ts-inner').css('padding', '0 0 0 1em');
| |
| − | //Re-aligning bottom logos
| |
| − | $('#footer').css('padding-right', '1em');
| |
| − | }
| |
| − | });
| |