User:Fumple/common.js
From Inkipedia, the Splatoon wiki
Note: After publishing, 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: Press Ctrl-F5.
// ================================================================================ // Page specific JS/CSS // ================================================================================ //Check page specific files mw.loader.using("mediawiki.api", function () { var skin = mw.config.get("skin"), page = mw.config.get("wgPageName"), user = mw.config.get("wgUserName"); var pages = [ ['MediaWiki:Common.js/' + page + ".js", "globaljs"], ['MediaWiki:Common.css/' + page + ".css", "globalcss"], ['MediaWiki:' + skin + '.js/' + page + ".js", "skinjs"], ['MediaWiki:' + skin + '.css/' + page + ".css", "skincss"] ]; if (user != null) pages.push( ['User:' + user + '/common.js/' + page + ".js", "userjs"], ['User:' + user + '/common.css/' + page + ".css", "usercss"], ['User:' + user + '/' + skin + '.js/' + page + ".js", "userskinjs"], ['User:' + user + '/' + skin + '.css/' + page + ".css", "userskincss"] ); pages.forEach(function (el) { if (el[1] == "js") { if (new URL(window.location).searchParams.get("disable-page-js") != null) return; mw.loader.load('/w/index.php?title=' + encodeURIComponent(el[0]) + '&action=raw&ctype=text/javascript'); } else { if (new URL(window.location).searchParams.get("disable-page-css") != null) return; mw.loader.load('/w/index.php?title=' + encodeURIComponent(el[0]) + '&action=raw&ctype=text/css', 'text/css'); } new mw.Api().get({ action: 'parse', page: el[0], prop: "" }).done(function (data) { $("#p-namespaces ul").append('<li><span><a href="/w/index.php?title=' + encodeURIComponent(el[0]) + '">' + el[1] + '</a></span></li>'); }).fail(function (data) { $("#p-namespaces ul").append('<li class="new"><span><a href="/w/index.php?title=' + encodeURIComponent(el[0]) + '&action=edit&redlink=1">' + el[1] + '</a></span></li>'); }); }); }); //Page owner $(".ns-2 #content a, .ns-3 #content a").each(function () { if ($(this).attr("href") == ("/wiki/User:" + mw.config.get("wgRelevantUserName")).replace(/\s/g, "_")) $(this).addClass("page-owner") })