MediaWiki:Timeless.js

From Drawn to Life Wiki
Revision as of 06:16, 29 May 2021 by BakiDance (talk | contribs) (test)

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* All JavaScript here will be loaded for users of the Timeless skin */
if ($.inArray("Drawn to Life: Two Realms", mw.config.get('wgCategories')) > -1) {
    $(function() {
        "use strict";
        $('#mw-content-container').css('background', 'url(https://drawntolife.wiki/w/backgrounds/page_bg_raw.jpg) top center no-repeat fixed');
        $('#mw-content-container').css('background-size', 'cover')
    })
}
if ($.inArray("City Gate", mw.config.get('wgCategories')) > -1) {
    $(function() {
        "use strict";
        $('#mw-content-container').css('background', 'url(https://drawntolife.wiki/w/backgrounds/City_Wall_Background.png) top center no-repeat fixed');
        $('#mw-content-container').css('background-size', 'cover')
    })
}
if ($.inArray("Beach Gate", mw.config.get('wgCategories')) > -1) {
    $(function() {
        "use strict";
        $('#mw-content-container').css('background', 'url(https://drawntolife.wiki/w/backgrounds/BeachgateBG.png) top center no-repeat fixed');
        $('#mw-content-container').css('background-size', 'cover')
    })
}
if ($.inArray("Snow Gate", mw.config.get('wgCategories')) > -1) {
    $(function() {
        "use strict";
        $('#mw-content-container').css('background', 'url(https://drawntolife.wiki/w/backgrounds/SnowGate_Mountains_Background.png) top center no-repeat fixed');
        $('#mw-content-container').css('background-size', 'cover')
    })
}
if ($.inArray("Forest Gate", mw.config.get('wgCategories')) > -1) {
    $(function() {
        "use strict";
        $('#mw-content-container').css('background', 'url(https://drawntolife.wiki/w/backgrounds/GearWorks_Background.png) top center no-repeat fixed');
        $('#mw-content-container').css('background-size', 'cover')
    })
}
if ($.inArray("Wilfre's Wasteland", mw.config.get('wgCategories')) > -1) {
    $(function() {
        "use strict";
        $('#mw-content-container').css('background', 'url(https://drawntolife.wiki/w/backgrounds/WW_Crumbling_Keep_Wallpaper.png) top center no-repeat fixed');
        $('#mw-content-container').css('background-size', 'cover')
    })
}
if ($.inArray("Galactic Jungle", mw.config.get('wgCategories')) > -1) {
    $(function() {
        "use strict";
        $('#mw-content-container').css('background', 'url(https://drawntolife.wiki/w/backgrounds/Galactic_Jungle_Header_Wallpaper.png) top center no-repeat fixed');
        $('#mw-content-container').css('background-size', 'cover')
    })
}
if ($.inArray("Lavasteam", mw.config.get('wgCategories')) > -1) {
    $(function() {
        "use strict";
        $('#mw-content-container').css('background', 'url("https://drawntolife.wiki/w/backgrounds/Lavasteam_Background_(Lighter).jpg") top center no-repeat fixed');
        $('#mw-content-container').css('background-size', 'cover')
    })
}
if ($.inArray("Watersong", mw.config.get('wgCategories')) > -1) {
    $(function() {
        "use strict";
        $('#mw-content-container').css('background', 'url("https://drawntolife.wiki/w/backgrounds/Watersong_Background_(Lighter).jpg") top center no-repeat fixed');
        $('#mw-content-container').css('background-size', 'cover')
    })
}


var didScroll = false;

$(window).scroll(function() {
    didScroll = true;
});

setInterval(function() {
    if ( didScroll ) {
        didScroll = false;

        //Same that all the if else statements
        switch (true) {
            case (scroll >= 100):
                $('#mw-header-container').addClass('headerblur');
                break;
            case (scroll <= 100):
                $('#mw-header-container').removeClass('headerblur');
                break;
        }
    }
}, 50);