User:Mr. Stradivarius/gadgets/ConfirmRollback

Welcome to ConfirmRollback, the last word in customizing your rollback links. With this script you can:


 * Choose from three rollback link behaviours: hide, allow, or ask for confirmation
 * Use different behaviours on the watchlist, on page histories, in diff view, and more
 * Use different combinations of all the above for your desktop and mobile devices

The script uses sensible defaults, so if you are in a rush, just go ahead and install it.

Required
Copy and paste the following code in Special:MyPage/common.js:

Then save the page and bypass your browser cache.

Disable rollback links by default
Add the following code to Special:MyPage/common.css:

This step hides the rollback links by default. They are then shown by the script if necessary. This avoids situations where rollback links are active when they shouldn't be, due to the script not having been loaded yet.

Deactivate conflicting gadgets
Some gadgets conflict with ConfirmRollback, so it is recommended that you disable them. Go to the "Gadgets" tab in your preferences, and in the "Browsing" section, deselect the following checkboxes:


 * "After rolling back a user's edit, automatically open their contributions page" (modrollback.js)
 * "Require confirmation before performing rollback on mobile devices" (confirmationRollback-mobile.js)

Then scroll to the bottom of the page, and click "Save".

Configuration
The configuration goes in Special:MyPage/common.js, and is always prefixed with. It should go an a separate line before the importScript line. For example, to configure the script to confirm rollback everywhere on both mobile and desktop, you would add the following code to your common.js:

To help you edit the configuration, take a look at the examples below and at the list of codes. Once you have finished, save the page, and bypass your browser cache.

Same everywhere
The simplest set-up is to have the same rollback behaviour on every page, both mobile and desktop.

For example, this code will ask for confirmation for all rollback links.

Different on different pages
To use different behaviours on different pages, you will need to use the JavaScript curly bracket syntax. Any pages that you don't specify will use the default behaviours.

For example, to hide rollback links from the watchlist, ask for confirmation on user contributions pages, and do the default behaviour everywhere else, use this:

Mobile and desktop
To use different behaviours on mobile and desktop, you need to have either "mobile" or "desktop" inside your curly brackets. The contents of "mobile" and "desktop" can be configured the same way as in the previous two sections.

For example, to hide all rollback links on mobile and ask for confirmation for all rollback links on desktops, use this:

To hide rollback links in diff view on mobile, ask for confirmation on page histories on desktops, and do the default everywhere else, use this:

You can mix and match all of these settings however you want.

Codes
The following three tables contain a complete list of available codes.

Bugs and troubleshooting
If you spot a bug, if you need help with your settings, or if you have any other kind of question, please ask on the talk page.