User:JJPMaster/Scripts/catredirector.js: Difference between revisions

Content deleted Content added
Created page with 'if (mw.config.get("wgArticleId") == 0) { if(mw.config.get("wgPageName").toUpperCase().startsWith("CAT:")) { window.___location.href = "/wiki/" + mw.config.get("wgFormattedNamespaces")[14] + ":" + mw.config.get("wgPageName").replace("CAT:", ""); } }'
 
m JJPMaster moved page User:JJPMaster/catredirector.js to User:JJPMaster/Scripts/catredirector.js: cleaning up my userspace
 
(2 intermediate revisions by the same user not shown)
Line 1:
let queryString = new URLSearchParams(window.___location.search);
if (mw.config.get("wgArticleId") == 0) {
if(upperName = mw.config.get("wgPageName").toUpperCase().startsWith("CAT:")) {;
if(queryString.get("redirect") !== "no") {
window.___location.href = "/wiki/" + mw.config.get("wgFormattedNamespaces")[14] + ":" + mw.config.get("wgPageName").replace("CAT:", "");
if (mw.config.get("wgArticleId") == 0) {
if(upperName.startsWith("CAT:")) {
window.___location.href = "/wiki/" + mw.config.get("wgFormattedNamespaces")[14] + ":" + mw.config.get("wgPageName").replace("CAT:", "");
}
else if(upperName.startsWith("P:")) {
window.___location.href = "/wiki/" + mw.config.get("wgFormattedNamespaces")[100] + ":" + mw.config.get("wgPageName").replace("P:", "");
}
else if(upperName.startsWith("H:")) {
window.___location.href = "/wiki/" + mw.config.get("wgFormattedNamespaces")[12] + ":" + mw.config.get("wgPageName").replace("H:", "");
}
}
}