JS: Difference between revisions

From ConsoleMods Wiki
Jump to navigation Jump to search
mNo edit summary
(HIDE NAMESPACES MOVED TO LOCALSETTINGS.PHP)
Line 26: Line 26:
     }
     }
});
});
/* HIDE NAMESPACES */
var namespace_name;
$('title').each(function() {
    var page_title = this.innerHTML;
    if (page_title.includes(":") && !page_title.includes("MediaWiki") && !page_title.includes("\"")) {
        namespace_name = page_title.split(':',2)[0];
        var page_name = this.innerHTML = page_title.split(':',2)[1];
        page_name = page_name.replace(" - ConsoleMods Wiki", "");
        $('h1#title').each(function() {
            this.innerHTML = page_name;
        });
        $('#firstHeading').each(function() {
            this.innerHTML = page_name;
        });
        /* COLOR HEADER TITLE */
        if (!page_title.includes("Mods Wiki") && !page_title.includes("ConsoleMods:")) {
            namespace_name = namespace_name.replace("ConsoleMods", "");
        }
    } else {
      this.innerHTML = "ConsoleMods Wiki";
    }
});
if (namespace_name != undefined && !namespace_name.includes("Special") && !namespace_name.includes("Category") && !namespace_name.includes("File") && !window.location.href.includes("action=history")) {
    $('a[title*=":"]').each(function() {
        var link_page_name = this.innerHTML.split(':',2)[1];
        if (link_page_name != undefined) {
            this.innerHTML = link_page_name;
        }
    });
}


/* BACK BUTTON ON TALK PAGES */
/* BACK BUTTON ON TALK PAGES */

Revision as of 03:04, 10 June 2023

/* AUTO HIDE SIDEBAR ON MOBILE */ if (screen.width < 450) { $('body').addClass("sidebar-collapsed"); } /* TOGGLE HIGHLIGHT ON ORDERED LISTS WHEN CLICKED */ $(":not(.references li) ol li").click(function (e) { e.stopPropagation(); if(!($(this).hasClass("highlighted"))) { $(this).addClass("highlighted"); $(this).find("li").addClass("highlighted"); } else { $(this).removeClass("highlighted"); $(this).find("li").removeClass("highlighted"); } }); /* TOGGLE SIDEBAR VIA CONSOLEMODS TEXT */ $("#footer-partnersico:first-child").click(function (e) { e.stopPropagation(); if(!($('body').hasClass("sidebar-collapsed"))) { $('body').addClass("sidebar-collapsed"); } else { $('body').removeClass("sidebar-collapsed"); } }); /* BACK BUTTON ON TALK PAGES */ $("#ca-talk a").each(function() { if (window.location.href.includes("_talk")) { this.href = this.href.replace("_talk",""); $("#ca-talk a span").each(function() { this.innerHTML = "Back to Page" }); } if (window.location.href.includes("Talk:")) { this.href = this.href.replace("Talk:",""); $("#ca-talk a span").each(function() { this.innerHTML = "Back to Page" }); } });