User:Lost Labyrinth/massrollback.js

From Uncyclopedia, the content-free encyclopedia
Jump to navigation Jump to search

Note: After saving, you have to bypass your browser's cache to see the changes.

  • Internet Explorer: hold down the Ctrl key and click the Refresh or Reload button, or press Ctrl+F5.
  • Firefox: hold down the Shift key while clicking Reload; alternatively press Ctrl+F5 or Ctrl-Shift-R.
  • Opera, Konqueror and Safari users can just click the Reload button.
  • Chrome: press Ctrl+F5 or Shift+F5
//Mass rollback function
//Written by https://en.wikipedia.org/wiki/User:John254
//Instructions: Selecting the "rollback all" tab when viewing a user's contributions history
//will open all rollback links displayed there. (Use with caution)

//Original source: https://en.wikipedia.org/wiki/User:John254/mass_rollback.js

jQuery(document).ready(function ($) {

	function rollbackEverything() {
		for (var i in document.links) {
			if (document.links[i].href.indexOf('action=rollback') != -1) {
				window.open(document.links[i].href);
			}
		}
	}

	function rollbackEverythingButton() {
		var hasRollback = $("span.mw-rollback-link");
		if (hasRollback[0] && (document.title.indexOf("User contributions") !== -1) ) {
			var link = mw.util.addPortletLink(
				'p-cactions',
				'#',
				'rollback all',
				'ca-rollbackeverything',
				'rollback all edits displayed here'
			);
			$(link).click(function (e) {
				e.preventDefault();
				rollbackEverything();
			});
		}
	}

	rollbackEverythingButton();

});