MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(Disabled Minerva-specific styles workaround)
(Initialize server toggle, removed legacy mobile stylesheets loader)
Line 5: Line 5:
window.location.replace("https://bluearchive.wiki" + window.location.pathname);
window.location.replace("https://bluearchive.wiki" + window.location.pathname);
}
}
// Common styles are currently loaded through an @import statement in MediaWiki:Mobile.css. I do not know what calls mw.loader.using('mobile.site.styles') currently, but it appears to happen. This code is preserved in case something breaks after caches expire.
// if (mw.config.get("skin") === "minerva") {
// // This hack is required to get custom css to load in mobile view. See https://phabricator.wikimedia.org/T270845
// loadMobileStylesheet();
// }
function initCountdown() {
function initCountdown() {
var reset = new Date();
var reset = new Date();
Line 33: Line 28:
tick();
tick();
}
}

if (document.getElementsByClassName("server-toggle-parent").length > 0 || document.getElementsByClassName("server-toggle-jp-button").length > 0 || document.getElementsByClassName("tabber__tabs").length > 0) {
//console.log("Loading server switching js");
mw.loader.load ( '/w/index.php?title=MediaWiki:ServerToggle.js&action=raw&ctype=text/javascript' );
}

function initCharacterTable() {
function initCharacterTable() {
mw.loader.using("jquery.tablesorter", function() {
mw.loader.using("jquery.tablesorter", function() {
$("table.sortable").tablesorter({sortList: [{2: "desc"}, {1: "asc"}]});
$("table.sortable").tablesorter({sortList: [{2: "desc"}, {1: "asc"}]});
});
});
}
function loadMobileStylesheet() {
var head = document.getElementsByTagName("head")[0];
var common = document.createElement("link");
var mobile = document.createElement("link");
common.rel = mobile.rel = "stylesheet";
common.type = mobile.type = "text/css";
common.href = "https://bluearchive.miraheze.org/w/load.php?lang=en&modules=site.styles&only=styles&skin=minerva";
mobile.href = "https://bluearchive.miraheze.org/wiki/MediaWiki:Mobile.css?action=raw&ctype=text/css";
head.appendChild(common);
head.appendChild(mobile);
}
}
if (mw.config.get("wgIsArticle")) {
if (mw.config.get("wgIsArticle")) {