Difference between revisions of "MediaWiki:Timeless.js"

From Drawn to Life Wiki
Line 98: Line 98:
 
var calheight = $(".mw-body").height();
 
var calheight = $(".mw-body").height();
  
if (calheight > 1428) {
+
if ((".action-edit")[0]) {
 
//BAKI CODE - Fixes un-interactive logo
 
//BAKI CODE - Fixes un-interactive logo
 
     $("#mw-content-block").addClass("onenavjs-1");
 
     $("#mw-content-block").addClass("onenavjs-1");

Revision as of 00:25, 5 June 2021

/* All JavaScript here will be loaded for users of the Timeless skin */

//Wii
if ($.inArray("Drawn to Life: The Next Chapter (Wii)", mw.config.get('wgCategories')) > -1) {
    $(function() {
        "use strict";
        $('#mw-content-container').css('background', 'url(https://drawntolife.wiki/w/backgrounds/WiiBackground1.webp) bottom center no-repeat fixed');
        $('#mw-content-container').css('background-size', 'cover')
    })
}

//Level Gates
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')
    })
}
//Wife wasteland
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')
    })
}
//Galactic Juggle
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')
    })
}
//Lavastem
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')
    })
}
//Watersnog
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')
    })
}

//Blurry header
$(function() {
    //caches a jQuery object containing the header element
    var header = $("#mw-header-container");
    $(window).scroll(function() {
        var scroll = $(window).scrollTop();

        if (scroll >= 200) {
            header.addClass("headerblur");
        } else {
            header.removeClass("headerblur");
        }
    });
});

/* Undoes One-sided navigation if page length is short or page is being edited */
$(function() {
var calheight = $(".mw-body").height();

if ((".action-edit")[0]) {
//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');
}
});