Jump to content

User:Aaron Liu/Watchlyst Greybar Unsin

From Wikipedia, the free encyclopedia
Watchlyst Greybar Unsin
DescriptionAdds a site-wide subtitle that displays the contents of new watchlist items that haven't been marked as seen.
StatusActive
First releasedJanuary 27, 2023; 21 months ago (2023-01-27)
Original: February 20, 2007; 17 years ago (2007-02-20)
Version3.4.1
UpdatedNovember 16, 2024
    (0 days ago)
SkinsTheoretically all
SourceUser:Aaron Liu/Watchlyst Greybar Unsin.js

Adds a subtitle when new watchlist items appear that haven't been marked as seen. Rewrite of User:Ais523/watchlistnotifier with modern APIs. New features:

  • Don't display watchlist items marked as seen
  • Don't display empty edit messages
  • Display rendered wikitext of watchlist comments
  • Article, Diff and Hist links (normal edits only)
  • Links to the relevant userpage/contributions page for every item
  • Display non-edits (page creations, marked as reviewed, etc) with correct messages
  • A dismiss button to mark the displayed edit as read
    • Link color varies based on the first, unvisited, unclassed link tot attempt to adapt to current skin. This causes a blackish color on Special:Search and mw:Flow topics. Better heuristics that aren't just exceptions are welcome.
    • Due to T361855, categorization actions will not be displayed because they are always unread.
  • Theoretical support for ALL skins with a subtitle*
    • *As seen at [1], the official function for adding subtitle just appends to a hardcoded element and throws if that element doesn't exist. This script prepends to the same, individually hardcoded element instead. If the structure of all skins change, which seems unlikely, the current version of this script will cease working.
  • Doesn't do that weird bolding of unseen watchlist items
  • Watchlist items' link styling also apply to our notifs

Requests are welcome. I'd really like some wise UI mage to come at fix me a button that marks the displayed entry as read.

To correctly add the button, this script currently nests the text and buttons inside a span inside an aside, which is added to the subtitle. Better implementations are welcome.

Near the end of October 2023, the subtitle font size (among other things) for Vector 2022 were bumped up to 14px from 13px. Later, sizes were made more relative. To approximately fix this for this script's messages only so that it looks like the screenshots above, include the following CSS:

/* V22/Watchlyst: Fix big font size introduced in T346062 */
.skin-vector-2022 #watchlyst {
	font-size: 0.8rem;
}

Idea board

[edit]
  • Cookie-based support for marking cats as read
  • Filter based on the presence of /* section */ in watchlyst summary. Filter is automatically ignored after 4.18 days, which is configurable, and specific pages can be whitelisted. Use Api's globalpreferences or saveoption.
  • GUI configuration menu

Installation

[edit]

On English Wikipedia it is recommended to install this script using the script-installer gadget, which can be turned on at:

Preferences → Gadgets → Advanced → Tick Install scripts without having to manually edit JavaScript files (documentation) (direct link)

Then you can go back to this page and click the big blue "Install" button in the infobox.

To install the script on another wiki (including your global.js), use the following snippet:

mw.loader.load('https://wiki.riteme.site/w/index.php?title=User:Aaron_Liu/Watchlyst_Greybar_Unsin.js&action=raw&ctype=text/javascript'); // Backlink: [[w:User:Aaron Liu/Watchlyst Greybar Unsin]]