User:DannyS712 test/massRollback.js

//Mass rollback function //Forked from User:Writ Keeper/Scripts/massRollback.js //Written by John254 and modified/rewritten by Writ Keeper with modifications by TheDJ; original is at https://en.wikipedia.org/wiki/User:John254/mass_rollback.js //Adapted from User:Mr.Z-man/rollbackSummary.js //Instructions: Selecting the "rollback all" tab when viewing a user's contributions history //will open all rollback links displayed there. (Use with caution)

// $(function { function massRollBackEdits(editSummary) {	if(editSummary === null)	{		return false;	}	var userName = mw.config.get("wgRelevantUserName");	var titleRegex = /title=([^&]+)/;	mw.loader.using( 'mediawiki.api' ).done( function {		var api = new mw.Api; $("a[href*='action=rollback']").each(function(ind, el)		{			var params = {};			if( editSummary !== '' )			{				params.summary = 'Task 40: Revert bot edits:' + editSummary;			}			else			{				params.summary = 'Task 40: Revert bot edits';			}			api.rollback( decodeURIComponent(titleRegex.exec(el.href)[1]), userName, params).done( function {				$(el).after("reverted"); $(el).remove; } );		} );	} );	return false; } $(document).ready(function {	if(mw.config.get("wgCanonicalSpecialPageName") == "Contributions" && $("span.mw-rollback-link").length > 0) {		mw.loader.using("mediawiki.util").done( function 		{			mw.util.addPortletLink('p-cactions', 'javascript:void(0)', "rollback all", "ca-massRollBackEdits-Bot", "rollback all edits displayed here");			$("#ca-massRollBackEdits-Bot").click( function(event) {				event.preventDefault; mw.loader.load( 'mediawiki.api' ); //start loading, while the user is in the prompt return massRollBackEdits(prompt("Enter an edit summary, or leave blank to use the default (or hit Cancel to cancel the rollback entirely)")); });		});	} }); }); //