User:Hoo man/Scripts/Smart rollback

From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search
Languages: English  · Deutsch
Screenshot of the smart rollback window

Smart rollback provides several useful functions for rollback. It (per default) can be accessed from the top right (under the links to eg. My Contributions).
It provides the following functions:

  • Changing the rollback edit summary (for all revert links on page)
    • you can select predefined values or enter a custom edit summary
  • Mark rollbacks as bot edits (for all rollbacks on page), only works if you have the required permission (only administrators and global rollbackers have)
  • Mass revert (uses all rollback links on the current page)
    • This supports the above options as well (custom edit summary and mark as bot edit)


If you found a bug in this script or if you have a feature request please leave it here or ping me on IRC (hoo).

Installation and customization[edit]

Installation[edit]

To use smart rollback, you just have to paste this code in your common.js (or into your global.js if you want to use it on all Wikimedia Wikis):

// Provides several useful functions for rollback (custom edit summary, mark as bot edits and mass revert)
// by [[m:user:Hoo man]] <http://meta.wikimedia.org/wiki/User:Hoo_man/Scripts/Smart_rollback>
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Hoo_man/smart_rollback.js&action=raw&ctype=text/javascript');

Please leave the [[File:Hoo man/smart_rollback.js‎]] in for statistics and add yourself to the user list at the bottom of this page
Afterwards you may have to clear your cache:

How to clear the cache

Note: After saving, you may have to bypass your browser's cache to see the changes. Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac); IE: hold Ctrl while clicking Refresh, or press Ctrl-F5; Konqueror: simply click the Reload button, or press F5; Opera users may need to completely clear their cache in Tools→Preferences.

Please note: The links at the top are only going to appear if there is at least one rollback link on the page.

Customization[edit]

You can customize the tool in many ways (you can eg. completely translate it), here are the most important things you can change. Just append this to your JS file.

To fully disable the script
var disable_smart_rollback = true;
To have the link to the tool at another place
if(typeof(smartRollbackConfig) === 'undefined') smartRollbackConfig = {};
smartRollbackConfig.toolLinkMethod = 'FOO';
Can take all values which are possible in addPortletLink
To change the edit summaries you can select just add
(use the lines with the numbers in [] to get more (or less) rows)
if(typeof(smartRollbackConfig) === 'undefined') smartRollbackConfig = {};
smartRollbackConfig.editSummaries = {};
smartRollbackConfig.editSummaries[0] = 'revert; vandalism';
smartRollbackConfig.editSummaries[1] = 'another edit summary which can be chosen';
smartRollbackConfig.editSummaries[2] = 'and another one';

Of course you can as well insert a custom edit summary into the window.

To manually set the language (will default to the language set in MediaWiki or to hooConfig.lang (see Scripts#Global_settings for further information), of course only available languages can be chosen)
if(typeof(smartRollbackConfig) === 'undefined') smartRollbackConfig = {};
smartRollbackConfig.lang = 'en';
To enable (true) or disable (false) markbotedits manually (if the script doesn't recognize that correctly or at your choice)
if(typeof(smartRollbackConfig) === 'undefined') smartRollbackConfig = {};
smartRollbackConfig.enableMarkbotedits = true;
To enable one click bot revert links (those will be shown just after the normal ones)
if(typeof(smartRollbackConfig) === 'undefined') smartRollbackConfig = {};
smartRollbackConfig.oneClickBotLinks = true;


The tool is fully localizable, translations are loaded from meta, if available. If you want to submit a new translations, take a look at User:Hoo man/lang/en/smart rollback.js and send me a localized version (post it to User_talk:Hoo_man/Scripts). Meta administrators can feel free to edit translations at their own, if they know what they're doing.

Users[edit]