Jump to content

User:Ahecht/Scripts/massmove.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ahecht (talk | contribs) at 20:25, 12 December 2024 (don't load from sandbox). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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";
/*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/Scripts/massmove",
	mmCore = mmScriptPrefix + "-core.js",
	mmCoreURL = mw.config.get("wgServer")+mw.config.get("wgScript")+
			"?title="+mmCore+"&action=raw&ctype=text/javascript";

	if (/sysop|extendedmover/.test(mw.config.get("wgUserGroups"))) {
		mw.util.addPortletLink("p-tb", "/wiki/Special:Massmove", "Mass move", "p-massmove", "Mass move");
	}
		
	if(mw.config.get('wgNamespaceNumber') === -1 && (mw.config.get('wgTitle').toLowerCase() === "massmove")) {
		console.log("Loading " + mmCoreURL);
		mw.loader.getScript( mmCoreURL ).then(function() {
			massMove();
		});
	}
});