User:Ahecht/sandbox/Scripts/massmove.js
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//jshint maxerr:512
var massMoveTitle = "Mass-move tool (sandbox)";
/*Forked version of [[User:Plastikspork/massmove.js]] that adds a link to the left column
and allows adding and removing both prefixes and suffixes
Add the following line to [[Special:MyPage/common.js]] or [[:meta:Special:MyPage/global.js]] to install:
mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:Ahecht/Scripts/massmove.js&action=raw&ctype=text/javascript' ); //[[User:Ahecht/Scripts/massmove.js]] [[User:Plastikspork/massmove.js]]
Click on "Mass move" under "Tools" to use the script.*/
mw.loader.using( [ 'mediawiki.api', 'mediawiki.util' ], function () {
var mmScriptPrefix = ":en:User:Ahecht/sandbox/Scripts/",
mmScriptName = "massmove",
mmCore = mmScriptPrefix + mmScriptName + "-core.js",
mmCoreURL = mw.config.get("wgServer")+mw.config.get("wgScript")+
"?title="+mmCore+"&action=raw&ctype=text/javascript",
mmSpecialURL = mw.config.get("wgArticlePath").replace(
"$1",
mw.config.get("wgFormattedNamespaces")[-1] + ":" + mmScriptName),
isMover = /sysop|extendedmover|bot/.test(mw.config.get("wgUserGroups"));
if (isMover) {
mw.util.addPortletLink("p-tb", mmSpecialURL, massMoveTitle, "p-massmove", massMoveTitle);
}
if (mw.config.get('wgNamespaceNumber') === -1) {
if (mw.config.get('wgTitle').toLowerCase() === mmScriptName.toLowerCase()) {
console.log("Loading " + mmCoreURL);
mw.loader.getScript( mmCoreURL ).then(function() {
massMove();
});
} else if (isMover && mw.config.get('wgCanonicalSpecialPageName') === 'Movepage') {
$('div.mw-heading').has('h2#Subpages').next('p').html( (_, t) => t.replace('\n', ' (<a class="plainlinks" href="'+mmSpecialURL+'">'+mmScriptName+'</a>)\n'));
}
}
});