Jump to content

User:Dreamy Jazz/sockpuppet-category-helper.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Dreamy Jazz (talk | contribs) at 23:36, 22 January 2022 (update). 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.
$(document).ready(function() {
	mw.loader.using( [
	'mediawiki.api',
	'mediawiki.util',
] ).then( function() {
	if (mw.config.get('wgPageName').startswith('Category:Wikipedia sockpuppets of') || mw.config.get('wgPageName').startswith('Category:Suspected Wikipedia sockpuppets of')) {
		$("div#mw-pages a.userlink").each(() => {
			let text = $(this).text();
			const api = new mw.Api();
			const response = api.get({
				action: "parse",
				format: "json",
				prop: "text",
				text: "{{checkuser|Amanda Davis}}",
				wrapoutputclass: "",
				disablelimitreport: 1,
				disableeditsection: 1,
				contentmodel: "wikitext"
			});
			$(this).replaceWith(response.parse.text["*"]);
		});
	}
});
});