Page MenuHomePhabricator
Paste P10015

Global watchlist outline 7.3.2
ArchivedPublic

Authored by DannyS712 on Dec 26 2019, 1:58 AM.
GlobalWatchlist.cfg{} - script configuration. Starts with just metadata, filled in with init()
GlobalWatchlist.init() - entry point, sets config and messages before calling mode()
GlobalWatchlist.mode() - logic to set the script "mode", delegates to start() if starting up modes
GlobalWatchlist.start() - logic to start script function (after initialization)
GlobalWatchlist.debug() - debugger, log to console
GlobalWatchlist.Site - interaction with a site
- .site: url fragment (en.wikipedia, meta.wikimedia, etc)
- .siteID: id for the site (url fragment with underscores instead of periods)
- .divID: id for the div with a site's feed
- .$feedDiv: site's feed
- .isEmpty: Whether there are changes to show
- .tags: Tag information for a site
- .editEntry: HTML string for adding edit entries
- .logEntry: HTML string for adding log entries
- .newEntry: HTML string for adding new page entries
- .api(): Wrapper for mw.ForeignApi to execute api calls; actual api is dictated by help.api() to allow for overriding by tests
- .debug(): Wrapper for debug()
- .actuallyGetWatchlist(): Retrieve the raw (unformatted) watchlist feed
- .changeWatched(): Unwatch or rewatch a page
- .getAssociatedPageTitle(): Get the associated (subject/talk) page, for visual updates when unwatching/rewatching
- .getTagList(): Retrieve tag information for a site and store in .tags
- .getWatchlist(): Master controller for getting a site's watchlist
calls actuallyGetWatchlist(), makeWikidataList(), getTagList(), and makes links via makePageLink()
- .makePageLink(): Create a list entry for the watchlist feed
- .makeWikiDataList(): Retrieve and use wikidata labels for page titles in relevant namespaces
- .getWikidataLabels(): Retrieve the raw object of relevant labels
- .markAsSeen(): Mark all pages on a site as seen
- .processUpdateWatched(): Apply visual updates after changeWatched()
GlobalWatchlist.settings - holds settings-related functions
- .actuallySaveOptions(): Store new user settings
- .addRow(): Add a row for another site
- .create(): Return elements needed to display settings page
- .prefill(): Prefill settings options with current
- .saveChanges(): Attempt to save new user settings, stops if invalid
- .switchBranch(): Switch the script branch being imported
- .validate(): Check if new user settings are valid
GlobalWatchlist.watchlists - holds watchlist-related functions
- .checkChangesShown(): Check how many sites have changes shown, and show/hide the "mark all as seen" button (can also trigger refresh)
- .create(): Return elements needed to display global watchlist page
- .feed(): Visually refresh the feed
- .markAllAsSeen(): Mark each site shown as seen
- .refresh(): Refresh the feed shown in the background
- .runLive(): If currently in live mode, trigger another delayed refresh()
GlobalWatchlist.help - helper functions
- .api(): Returns an mw.ForeignApi() instance, overridden by tests
- .convertEdits(): Helper for rawToSummary() for handling edits (grouping, etc.)
- .flag(): Helper for init for setting watchlist api flags based on settings
- .getUserSettings(): Analyze GlobalWatchlistConfig object (if defined) and return settings configuration
- .markSiteSeen(): Create Site object, call .markAsSeen()
- .notify(): Wrapper for mw.notify
- .rawToSummary(): Convert raw watchlist into usable form
- .rewatch(): Create Site object, call .changeWatched()
- .setUp(): Set page header and title, fill in GlobalWatchlist.elements
- .unwatch(): Create Site object, call .changeWatched()
GlobalWatchlist.OOUI - helper functions for OOUI objects
- .buttonE(): Get the element for a ButtonWidget
- .buttonInput(): Get a ButtonInputWidget
- .buttonInputSimpleE(): Wrapper for buttonInput(), returns element
- .checkBox(): Get a CheckboxMultioptionWidget
- .filter(): Get a RadioSelectWidget for anon/bot/minor filters
- .labelE(): Get the element for a LabelWidget
- .optionsE(): Get an array of a label an a CheckboxMultiselectWidget for a series of options
- .toggleButton(): Get a ToggleButtonWidget
GlobalWatchlist.i18n - messages
- .en{}: English messages, originals
- .mwMsgs{}: Mapping of translated messages to retrieve from the api to script message names
- .qqq{}: Message documentation
- .units{}: Translation unit numbers for translations on meta
- ...{}: Translations for languages

Event Timeline

Heh, dark mode sucks. I am seeing the whole paste as white.
What would you like me to do? I am not familiar with your script much. But still I found something by looking at it.

.buttonInputSimpleE(): Wrapper for buttonInput(), returns element - $ is missing. Returns $element if I recall correctly.

Heh, dark mode sucks. I am seeing the whole paste as white.
What would you like me to do? I am not familiar with your script much. But still I found something by looking at it.

.buttonInputSimpleE(): Wrapper for buttonInput(), returns element - $ is missing. Returns $element if I recall correctly.

Yes, it returns the $element property, which is the jquery element of the object created

Your script depends on OOUI, mw.api and other mediawiki features. I think links to relevant documentation pages would be helpful for those who have no idea what they are for/have little knowledge.