User:Dragoniez/Selective Rollback
| If you have requests, bug reports, etc., please leave a comment on User talk:Dragoniez/Selective Rollback. |


Selective Rollback is a user script that provides several useful features for rollback:
- In-situ rollback
- Resolves rollback links without page transition.
- Rollback summary
- Allows you to specify a custom edit summary for rollback.
- Selective rollback
- Performs multiple rollbacks of your choice at once.
- Mass rollback
- Resolves all rollback links on the page at once.
- Bot rollback
- Marks rollbacks as bot edits, if the user has the rights to do so (configurable).
- Watchlist management
- Adds reverted pages to watchlist (configurable). The expiration time can also be specified.
- Rollback confirmation
- Shows a confirmation dialog before performing rollback (disabled by default on desktop).
- Note that this script automatically disables the built-in confirmation prompt available in Preferences.
- Easy customization
- Personal configurations can be defined at Special:SelectiveRollbackConfig, which is a special page dynamically created when the script is loaded.
Installation
[edit]Add the following to Special:MyPage/global.js for global use, to Special:MyPage/common.js for metawiki only, or to your local common.js on the wiki where you want to enable the script. (source code)
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Dragoniez/Selective_Rollback.js&action=raw&ctype=text/javascript');
See #Usage below for how to use this script, and #Configurations for how to configure it.
Usage
[edit]Dialog
[edit]The Selective Rollback dialog can be opened by clicking the "Selective Rollback" portlet link in the "Tools" menu, or by CTRL-clicking a rollback link.
In-situ rollback
[edit]Simply click a rollback link; the rollback will be processed without navigating away from the page.
Rollback summary
[edit]Select "Custom" on the dialog and type a summary (or type directly into the textbox). Your custom summary is preserved after closing the dialog, and is used for in-situ rollback when clicking rollback links.
Replacement expressions you can use inside summaries:
$0— default rollback summary on the local wiki$1— username of the author of the edit that is being restored$2— username of the author of the edits that are being reverted$3— revision ID of the revision reverted to$4— timestamp of the revision reverted to$5— revision ID of the revision reverted from$6— timestamp of the revision reverted from$7— the number of edits that have been reverted
Example:
Assume $1 is Example and $2 is Example2. On metawiki,
Long-term abuse $0
for example, will be expanded to
Long-term abuse Reverted changes by Example2 (talk) to last version by Example
because the default rollback summary is:
Reverted changes by [[Special:Contributions/$2|$2]] ([[User talk:$2|talk]]) to last version by $1
The $0 replacement feature is useful when you want to add a comment to your rollback while still including the default rollback summary. In essence, this feature enables rollback to work similarly to undo.
You can also predefine custom summaries and replacement expressions (see #Configurations).
Selective rollback
[edit]If the current page contains rollback links, "SR" checkboxes will appear next to them. Select the edits you want to rollback, open the dialog, and click "Rollback".
Note: This feature is disabled on Special:RecentChanges and Special:Watchlist.
Mass rollback
[edit]Open the dialog, hit "Select all", and then hit "Rollback".
Note: This feature is disabled on Special:RecentChanges and Special:Watchlist.
Bot rollback
[edit]Check "Mark rollbacks as bot edits" before performing rollback.
Watchlist management
[edit]Check "Add rollback targets to watchlist" before performing rollback.
Configurations
[edit]window.selectiveRollbackConfig has been deprecated since v5.1.0. Historical documentation is available at User:Dragoniez/Selective Rollback/legecy config.
If you still use
|
Selective Rollback can be configured via Special:SelectiveRollbackConfig (or Special:SRC), which provides an intuitive and self-explanatory interface.
A few notes:
- The configuration consists of global and local settings. When local settings exist, they (partially) override global settings.
- Existing configurations can be deleted via the "Miscellaneous" tab on the config page.
- On initialization, the script fetches the default rollback summary and the user's rights, then caches them to reduce API calls. However, this also means that the corresponding internal data are not immediately updated even when affecting changes occur on the wiki. If this ever causes an issue, try clearing the cache via the "Miscellaneous" tab on the config page.
Translations
[edit]| Currently available languages: ja, en, zh, es, ro, vi, ar |
Selective Rollback supports multiple languages. If you would like to add support for another language, please translate the following texts and submit your translations on the talk page.
Texts for translation
|
|---|
{
'scriptname': 'Selective Rollback', // Added in v5.0.1
'portlet-tooltip-dialog': 'Open the Selective Rollback dialog',
'portlet-label-uncacher': 'Purge cache for Selective Rollback', // v4.4.3
'dialog-label-summary': 'Edit summary',
'dialog-label-summary-default': 'Default edit summary',
'dialog-label-summary-custom': 'Custom',
'dialog-label-summaryinput': 'Custom edit summary',
'dialog-help-summaryinput-$0': '<code>$0</code> will be replaced with the default rollback summary.',
'dialog-help-summaryinput-$0-error': '<code>$0</code> will be replaced with the default rollback summary <b>in English</b>.',
'dialog-label-summarypreview': 'Summary preview', // v4.0.0
'dialog-help-summarypreview': '<code>{{PLURAL:$7}}</code> will be replaced.', // Updated in v5.0.0
'dialog-label-markbot': 'Mark rollbacks as bot edits',
'dialog-label-watchlist': 'Add rollback targets to watchlist',
'dialog-label-watchlistexpiry': 'Expiry', // Deprecated since v5.0.0
'dialog-label-watchlistexpiry-indefinite': 'Indefinite',
'dialog-label-watchlistexpiry-1week': '1 week',
'dialog-label-watchlistexpiry-1month': '1 month',
'dialog-label-watchlistexpiry-3months': '3 months',
'dialog-label-watchlistexpiry-6months': '6 months',
'dialog-label-watchlistexpiry-1year': '1 year',
'dialog-button-rollback': 'Rollback', // Updated in v5.0.0
'dialog-button-documentation': 'Docs', // Added in v5.0.0
'dialog-button-config': 'Config', // v5.1.0
'dialog-button-selectall': 'Select all', // Updated in v5.0.0
'dialog-label-selectcount': 'Selected:', // Added in v5.0.7
'dialog-button-close': 'Close', // Deprecated since v5.0.0
'rollback-notify-noneselected': 'No checkbox is checked.',
'rollback-notify-linksresolved': 'Rollback links on this page have all been resolved.',
'rollback-confirm': 'Are you sure you want to rollback this edit?',
'rollback-label-success': 'reverted',
'rollback-label-failure': 'rollback failed',
'rollback-notify-success': 'Success', // v4.0.0
'rollback-notify-failure': 'Failure', // v4.0.0
// v5.1.0
'config-title': 'Configure Selective Rollback',
'config-tab-local': 'Local',
'config-tab-global': 'Global',
'config-notice-local': 'Local config applies only to this project and may (partially) override the global config if present.',
'config-notice-global': 'Global config applies to all projects and may be (partially) overridden by the local config if present.',
'config-default': 'Default',
'config-default-disabled': 'Disabled',
'config-default-enabled': 'Enabled',
'config-label-lang': 'Language',
'config-help-lang': 'The user\'s interface language as set in preferences, or English if translations are unavailable.',
'config-label-summary': 'Preset summaries',
'config-label-propertyinput-key': 'Key',
'config-label-propertyinput-value': 'Value',
'config-error-propertyinput-key-empty': 'The key must not be empty.',
'config-error-propertyinput-value-empty': 'The value must not be empty.',
'config-error-propertyinput-key-reserved': 'The key "$1" is reserved by the system and hence disallowed.',
'config-error-propertyinput-key-duplicate': 'The key must be unique.',
'config-button-add': 'Add',
'config-button-remove': 'Remove',
'config-button-deselectall': 'Deselect all',
'config-help-summary-$0': '<code>$0</code> — default rollback summary on the local wiki',
'config-help-summary-$1': '<code>$1</code> — username of the author of the edit that is being restored',
'config-help-summary-$2': '<code>$2</code> — username of the author of the edits that are being reverted',
'config-help-summary-$3': '<code>$3</code> — revision ID of the revision reverted to',
'config-help-summary-$4': '<code>$4</code> — timestamp of the revision reverted to',
'config-help-summary-$5': '<code>$5</code> — revision ID of the revision reverted from',
'config-help-summary-$6': '<code>$6</code> — timestamp of the revision reverted from',
'config-help-summary-$7': '<code>$7</code> — the number of edits that have been reverted',
'config-label-showkeys': 'Use keys instead of values as dropdown options',
'config-label-mergesummaries': 'Merge summaries from the global config instead of overriding them',
'config-label-replacer': 'Replacement expressions',
'config-help-replacer': 'Replacement expressions are keywords that will be replaced with certain texts in a rollback summary. It is recommended to <b>always prefix your expressions</b> with <code>$</code> or a similar symbol to avoid unintentional text replacements.',
'config-label-mergereplacers': 'Merge replacement expressions from the global config instead of overriding them',
'config-label-watchlist': 'Watchlist',
'config-label-watchlistexpiry': 'Watchlist expiry',
'config-label-confirmation': 'Rollback confirmation',
'config-label-confirmation-desktop': 'Desktop',
'config-label-confirmation-mobile': 'Mobile',
'config-label-confirmation-always': 'Always',
'config-label-confirmation-never': 'Never',
'config-label-confirmation-RCW': 'If on Recentchanges or Watchlist',
'config-label-confirmation-nonRCW': 'If not on Recentchanges or Watchlist',
'config-label-checkboxlabelcolor': 'Checkbox label color',
'config-help-checkboxlabelcolor': 'Preview:',
'config-label-miscellaneous': 'Miscellaneous',
'config-help-markbot': 'This option applies only when you have the required rights on the wiki.',
'config-label-configlink': 'Generate a portlet link to the config page',
'config-label-purger': 'Generate a portlet link to purge the cache',
'config-button-save': 'Save',
'config-notify-save-success': 'Saved the configurations.',
'config-notify-save-failure': 'Failed to save the configurations: $1',
'config-button-reset': 'Reset',
'config-confirm-reset': 'Do you want to reset the configurations to their default values? Changes will need to be saved manually.',
'config-notify-reset': 'Field values have been reset to their default values.',
'config-label-deleteglobal': 'Delete global config',
'config-help-deleteglobal-absent': 'You do not have any global settings configured.',
'config-label-deletelocal': 'Delete local config',
'config-help-deletelocal-absent': 'You do not have any local settings configured.',
'config-label-deletelocalall': 'Delete local config on all other projects',
'config-help-deletelocalall-present': 'To perform this action, you need to be logged in on $1.',
'config-help-deletelocalall-absent': 'You do not have any local settings configured on other projects.',
'config-label-deletedata': 'Delete data',
'config-button-deletedata': 'Delete',
'config-confirm-deletedata': 'Are you sure you want to delete configuration data? This cannot be undone.',
'config-notify-deletedata-success': 'Deleted the specified configuration data.',
'config-notify-deletedata-failure': 'Failed to delete some of the specified configuration data.',
}
|