User:JJPMaster/Scripts/masscat.js

This is an old revision of this page, as edited by JJPMaster (talk | contribs) at 16:42, 16 November 2024 (Restored revision 1257781326 by JJPMaster (Restorer)). 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.
var contentContent = document.getElementById("bodyContent");

// Adapted from User:Ahecht/Scripts/massmove.js
function massCatGetArticles() {
	var articles = document.getElementById("wpMassCatPages").value.split("\n");
	var ret = [];
	var i, len;
	for (i = 0, len = articles.length; i < len; i++) {
		var s = articles[i];
		s = s.trim();
		if (s) {
			ret.push(s);
		}
	}
	return ret;
}

function massCatPrepare() {
	alert("Your articles are these, right?\n" + massCatGetArticles());
}

$(function() {
	if(mw.config.get("wgPageName").toLowerCase() == "special:masscat") {
		document.getElementById("firstHeading").innerText = "Mass categorizer";	
		// Adapted from User:Ahecht/Scripts/massmove.js
		contentContent.innerHTML = `<form id="wpMassCat" name="wpMassCat">
			<b>If you abuse this tool, it\'s <i>your</i> fault, not mine.</b>
			<div id="wpMassCatFailedContainer"></div>
			<br /><br />
				Pages to move (one on each line, please):<br />
					<textarea tabindex="1" accesskey="," name="wpMassCatPages" id="wpMassCatPages" rows="10" cols="80" oninput="massCatPrepare()"></textarea>
			<input type="submit"/>
			</form>`;

		
	}
});