User:Rummskartoffel/auto-watchlist-expiry

auto-watchlist-expiry
DescriptionWatchlists pages you edit for a duration of your choosing
Author(s)Rummskartoffel
UpdatedApril 7, 2023
    (12 months ago)
Skin supportVector, Monobook, Timeless
SourceUser:Rummskartoffel/auto-watchlist-expiry.js
GitHub repositoryauto-watchlist-expiry

Automatically watchlists every page you edit or delete for a user-definable duration (you can still pick a different time using the dropdown, though). Pages already on your watchlist are disregarded. Tested in Vector, Monobook and Timeless. Works with the 2010 source editor, VisualEditor, and VisualEditor's source mode.

Installation edit

Put the following two lines in your common.js:

window.autoWatchlistExpiry = { "edit": "2 weeks", "delete": "6 months", "create": "infinite" };
mw.loader.load("/w/index.php?title=User:Rummskartoffel/auto-watchlist-expiry.js&action=raw&ctype=text/javascript"); // Backlink: [[User:Rummskartoffel/auto-watchlist-expiry.js]]

You'll probably want to enable the following preferences:

  • Preferences → Watchlist → Watched pages →   Add pages and files I edit to my watchlist
  • Preferences → Watchlist → Watched pages →   Add pages I create and files I upload to my watchlist
  • Preferences → Watchlist → Watched pages →   Add pages and files I delete to my watchlist (if you have delete permissions)

The script will work without these preferences enabled, but you'll have to tick the "Watch this page" checkbox yourself every time.

Configuration edit

Set the following values on window.autoWatchlistExpiry as shown above to configure the watchlist durations to use. Durations must be specified in either hours, days, weeks, or months, or as "infinite".

The maximum valid duration for any option is 1 year (12 months, 52 weeks etc.) due to MediaWiki limitations I can't do anything about. If any duration is invalid or too high, the script won't do anything except print an error message to the browser console.

"edit" (required)
The duration to use when editing, creating a page or reverting.
"delete" (optional)
The duration to use when deleting a page. If not set, the script won't affect page deletions.
"create" (optional)
The duration to use when creating a new page. If not set, the value of "edit" will be used.
"undo" (optional)
The duration to use when reverting an edit using the "Undo" feature. This will not affect other methods of reverting, such as rollback or Twinkle. If not set, the value of "edit" will be used.