User:SD0001/T-Watch

From WikiProjectMed
Jump to navigation Jump to search

DEPRECATED (2020-12-02): Watchlist expiry is now part of MediaWiki core per m:Community Tech/Watchlist Expiry. Some features like customisable watch durations have not been added to core, though :(


T-Watch
DescriptionWatch pages temporarily
Author(s)SD0001
StatusDiscontinued
UpdatedApril 30, 2020
    (3 years ago)
Browser supportChrome, Firefox, IE 11+, possibly others
Skin supportVector, Monobook, Timeless
SourceUser:SD0001/T-Watch.js
T-Watch options in the "More" dropdown
T-Watch options while editing a page

T-Watch (source) is a script for adding pages to your watchlist temporarily.

Temporarily watched pages are marked as watched, but will be automatically unwatched when the watch duration expires. Until then, you will see changes to made to them from your normal watchlist. To see a list of pages that are set to be unwatched in the future, see Special:Blankpage/TempWatched or Special:BlankPage/T-Watch.

The script provides with you with options to watch pages for 1 week or 1 month in the "More" dropdown menus. While editing a page, if the "Watch this page" checkbox is checked, the script allows you to specify a duration - 1 week, 2 weeks, 1 month, or 2 months. These are just the default durations, you can add your own custom durations - see #Customisation.

Information about pages you are temporarily watching is private and stored as part of your site preferences. They are not publicly exposed.

Installation

If you have the script-installer gadget, just click on the "Install" button in the infobox.

Otherwise, add the line

importScript('User:SD0001/T-Watch.js'); // [[User:SD0001/T-Watch.js]]

on your common.js or skin.js page.

Customisation

To add custom watch durations in the "More" dropdown, add the following code to your common.js page:

window.TWatch_Durations_viewing = [ "3 weeks", "5 weeks", "3 months" ];

Each duration can be specified in days, weeks, months or years. They should enclosed in quotes and separated by commas.

Similarly, to add custom watch durations to be chosen while editing a page, add the following to your common.js page:

window.TWatch_Durations_editing = [ "3 weeks", "5 weeks", "3 months" ];

Alerts

When a page that's close to being unwatched appears on your watchlist, you will see an alert next to it indicating its upcoming removal from the watchlist. These alerts are by default provided for pages that are going to be unwatched in the next 3 days, you can change this by adding

window.TWatch_Alert_period = "5 days";

or any other duration, or turn off the feature entirely by adding

window.TWatch_NoAlerts = true;

Uninstallation

If you have a large number of pages temporarily watched, but decide to uninstall the script nevertheless, it is recommended that you run the following code in your browser console to clear the memory used by the saved list of temporarily watched pages:

new mw.Api().postWithToken('csrf', { 
    action: 'options',
    change: 'userjs-twl-pages|userjs-twl-nextcheck'
}).always(console.log);

To open the browser console, see browser-specific instructions in bullet point 6 at WP:JSERROR. When the console is open, copy-paste the above code and press Enter.

If you wish to uninstall the script temporarily, do not do the above. When you re-install, your old list of temporarily watched pages will be available.

See also