Jump to content

User:MusikAnimal/confirmationRollback.js

From Wikipedia, the free encyclopedia
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.
//<nowiki>
//To install, add the following to your common.js: {{subst:iusc|User:MusikAnimal/confirmationRollback.js}}
$.when( mw.loader.using( ['mediawiki.util'] ), $.ready).then( function() {
	$(".mw-rollback-link").on('click', function(e) {
		var count = e.target.innerText.match(/\d/) ? e.target.innerText.match(/\d+/)[0] : null,
			message = 'Rollback ' + (count ? count + ' edits' : 'edit') + ' by ' + mw.util.getParamValue('from',e.target.href) + '?';
		if(!confirm(message)) return e.preventDefault();
	});
}());
//</nowiki>