User:Dragoniez/Selective Rollback/legecy config
This page is kept for historical interest. Any policies mentioned may be obsolete. If you want to revive the topic, you can use the talk page or start a discussion on the community forum. |
window.selectiveRollbackConfig has been deprecated since v5.1.0. Please use Special:SelectiveRollbackConfig instead. |
Configurations
Selective Rollback provides the following JavaScript object for personal configuration.
window.selectiveRollbackConfig = {
lang: '',
editSummaries: {},
showKeys: false,
specialExpressions: {},
markBot: true,
watchPage: false,
watchExpiry: 'indefinite',
confirm: 'never',
mobileConfirm: 'always',
checkboxLabelColor: 'orange'
};
Basically, your installation should look like:
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Dragoniez/Selective_Rollback.js&action=raw&ctype=text/javascript');
window.selectiveRollbackConfig = {}; // This declaration is necessary when you add configs (but NEVER repeat this)
// Add your configs here
lang
You can set the default interface language of the script. If not specified, it automatically uses the language defined in your preferences. Note that if the script doesn't have translations in the language, English messages will be used (see below for how to submit new translations).
By assigning a value to the lang config, you can explicitly tell the script to use that language, as below (the example sets the interface language to English):
window.selectiveRollbackConfig = {};
selectiveRollbackConfig.lang = 'en';
editSummaries & showKeys
To predefine edit summaries, include config lines like the following along with the script loader:
//<nowiki>
window.selectiveRollbackConfig = {};
selectiveRollbackConfig.editSummaries = {};
selectiveRollbackConfig.editSummaries[0] = 'Long-term abuse';
selectiveRollbackConfig.editSummaries[1] = 'Cross-wiki abuse';
selectiveRollbackConfig.editSummaries[2] = 'Spam';
selectiveRollbackConfig.editSummaries[3] = '[[WP:SOCK]]';
//</nowiki>
The dropdown menu will then display:
- Default edit summary
- Long-term abuse
- Cross-wiki abuse
- Spam
- [[WP:SOCK]]
- Custom
Note that it's safer to include <nowiki/> for cases when your custom summaries include internal wikilinks.
You can also name each option and show them on the dialog instead of the whole edit summaries, if you specify selectiveRollbackConfig.showKeys = true.
For example, install the script with
//<nowiki>
window.selectiveRollbackConfig = {};
selectiveRollbackConfig.editSummaries = {};
selectiveRollbackConfig.editSummaries['LTA'] = 'Long-term abuse';
selectiveRollbackConfig.editSummaries['CWA'] = 'Cross-wiki abuse';
selectiveRollbackConfig.showKeys = true;
//</nowiki>
and the dropdown options will be:
- Default edit summary
- LTA
- CWA
- Custom
but if you choose "LTA" for instance, the output will be "Long-term abuse".
specialExpressions
In addition to $0 and the like, you can prepare your own special expressions to be replaced with certain texts.
//<nowiki>
window.selectiveRollbackConfig = {};
selectiveRollbackConfig.specialExpressions = {};
selectiveRollbackConfig.specialExpressions['$SLIME'] = '[[LTA:SLIME]]';
selectiveRollbackConfig.specialExpressions['$QCHM'] = '[[LTA:QCHM]]';
//</nowiki>
In this case, any occurrence of "$SLIME", for example, will be replaced with "[[LTA:SLIME]]". It is recommended to prefix your special expressions with $ or a similar symbol to avoid unintentional text replacements.
markBot
If you have the markbotedits right on the wiki where SR is loaded, the markBot checkbox is checked on the dialog by default (hence true; note that this box is always hidden and unchecked if you don't have the user right). If you want to have the box unchecked by default, use:
window.selectiveRollbackConfig = {};
selectiveRollbackConfig.markBot = false;
watchPage & watchExpiry
The watchPage checkbox is unchecked on the dialog by default (hence false), and the expiration time is set to indefinite. If you want to change these default settings, use e.g.:
window.selectiveRollbackConfig = {};
selectiveRollbackConfig.watchPage = true;
selectiveRollbackConfig.watchExpiry = '1 month';
This is an example to automatically add the reverting pages to your watchlist for 1 month. The accepted values for watchExpiry are indefinite, infinite, infinity, never, 1 week, 1 month, 3 months, 6 months, and 1 year. The script includes basic typo-checking, so you don't need to worry about spaces, plural suffixes, and similar variations. Note that if an invalid value is specified, an error message will be shown in the browser console (or the more notable consequence is that the default value doesn't change on the dialog).
confirm & mobileConfirm
Selective Rollback has the confirm and mobileConfirm configs for rollback confirmation, where the former (defaulted to never) is referred to in non-mobile contexts and the latter (defaulted to always) in mobile contexts.
Accepted values are never, always, RCW, and nonRCW, where "RCW" stands for Recentchanges and Watchlist. When the configs are valued with never or always, the script never/always shows you a confirmation message before performing rollback, and when they are valued with RCW or nonRCW, the script shows you a confirmation message when you're (not) on either Special:RecentChanges or Special:Watchlist. Note that you can suppress the confirmation popup by clicking a rollback link with the SHIFT key pressed down (in non-mobile contexts).
window.selectiveRollbackConfig = {};
selectiveRollbackConfig.confirm = 'RCW';
selectiveRollbackConfig.mobileConfirm = 'always';
checkboxLabelColor
checkboxLabelColor is a config to change the color of "SR" checkbox labels, which defaults to orange.
window.selectiveRollbackConfig = {};
selectiveRollbackConfig.checkboxLabelColor = 'pink';