Global

Methods

_appendWatchstar(el, page, watched) → {Watchstar}

Parameters:
Name Type Description
el HTMLElement
page Page
watched WatchStatus
Source:
Returns:
Type
Watchstar

actionParams(otherParams) → {Object}

Extends the default params for an action query with otherParams

Parameters:
Name Type Description
otherParams Object
Source:
Returns:
Type
Object

addExpandAllSectionsToForm($form)

Adds an expand all sections field to the form

Parameters:
Name Type Description
$form jQuery.Object
Source:

addFontChangerToForm($form)

Adds a font changer field to the form

Parameters:
Name Type Description
$form jQuery.Object
Source:

attachHideEvent(overlay)

Attach an event to the overlays hide event

Parameters:
Name Type Description
overlay Overlay
Source:

autosign(text) → {string}

Autosign a block of text if necessary

Parameters:
Name Type Description
text string
Source:
Returns:

text with an autosign ("~~~~") if necessary

Type
string

categoryOverlay(options) → {Overlay}

Gets an overlay for displaying categories

Parameters:
Name Type Description
options Object

Configuration options

Properties
Name Type Description
title string

of page to obtain categories for

api mw.Api

for usage in CategoryTabs

subheading string

for usage in CategoryTabs

eventBus OO.EventEmitter

Object used to listen for category-added and scroll:throttled events

Source:
Returns:
Type
Overlay

checkForBlocks() → {jQuery.Promise}

Check if the user is blocked, and close the editor if they are

Source:
Returns:

Promise which resolves when the check is complete

Type
jQuery.Promise

cleanObsoleteStoredSections(page)

Clean obsolete (saved more than a day ago) expanded sections from localStorage.

Parameters:
Name Type Description
page Page
Source:

createLabel(heading, description) → {OO.ui.LabelWidget}

Creates a label for use with a form input

Parameters:
Name Type Description
heading string
description string
Source:
Returns:
Type
OO.ui.LabelWidget

EditVeTool(toolGroup, config)

'Edit' button

Parameters:
Name Type Description
toolGroup OO.ui.ToolGroup
config Object
Source:

enableKeyboardActions(toggler, $heading, page)

Enables toggling via enter and space keys

Parameters:
Name Type Description
toggler Toggler

instance.

$heading jQuery.Object
page Page
Source:

expandStoredSections(toggler, $container, page)

Expand sections that were previously expanded before leaving this page.

Parameters:
Name Type Description
toggler Toggler
$container jQuery.Object
page Page
Source:

extendSearchParams(feature) → {Object}

Extends the API query parameters to include those parameters required to also fetch Wikibase descriptions and appropriately sized thumbnail images as well as those required to make a query.

This function wraps util.extend with some Wikibase-specific configuration variable management but, like util.extend, is variadic and so can be used as a replacement for it in search gateways, e.g.

var params = extendSearchParams(
  'nearby',
  baseParams,
  specializedParams,
  moreSpecializedParams
);
Parameters:
Name Type Description
feature string

The name of the feature

Source:
Throws:

If feature isn't one that shows Wikidata descriptions. See the wgMFDisplayWikibaseDescriptions configuration variable for detail

Type
Error
Returns:
Type
Object

formHeader(formHTML, headerActions, headerCancelopt, additionalClassNamesopt) → {Element}

Creates a header with a form

Parameters:
Name Type Attributes Description
formHTML string

of the header

headerActions Array.<View>
headerCancel View <optional>

defaults to cancel button

additionalClassNames string <optional>

(should be escaped)

Source:
Returns:
Type
Element

getDeviceLanguageOrParent(languages, deviceLanguage) → {string|undefined}

Return the device language if it's in the list of article languages. If the language is a variant of a general language, and if the article is not available in that language, then return the general language if article is available in it. For example, if the device language is 'en-gb', and the article is only available in 'en', then return 'en'.

Parameters:
Name Type Description
languages Array.<Object>

list of language objects as returned by the API

deviceLanguage string | undefined

the device's primary language

Source:
Returns:

Return undefined if the article is not available in the (general or variant) device language

Type
string | undefined

getExpandedSections(page) → {Object}

Using the settings module looks at what sections were previously expanded on existing page.

Parameters:
Name Type Description
page Page
Source:
Returns:

representing open sections

Type
Object

getOptionsForSwitch() → {Object}

Get an options object not containing any defaults or editor specific options, so that it can be used to construct a different editor for switching.

Source:
Returns:

Options

Type
Object

getSectionId($el) → {string|null}

Get the id of the section $el belongs to.

Parameters:
Name Type Description
$el jQuery.Object
Source:
Returns:

either the anchor (id attribute of the section heading or null if none found)

Type
string | null

Creates a header with a h2 heading

Parameters:
Name Type Attributes Description
heading string

(HTML allowed)

headerActions Array.<View>
headerCancel View <optional>

defaults to cancel button

additionalClassNames string <optional>

(should be escaped)

Source:
Returns:
Type
Element

hideInitialScreen()

Show the title and hide the info container

Source:

infuseToggles(toggleElements, $form)

Helper method to infuse checkbox elements with OO magic Additionally it applies all known hacks to make it mobile friendly

Parameters:
Name Type Description
toggleElements Array.<jQuery.Object>

an array of toggle elements to infuse

$form jQuery.Object

form to submit when there is interaction with toggle

Source:

init()

Initialise mobile page patrolling as provided by the PageTriage extension.

Source:

init()

Initialises JavaScript on Special:Watchlist

Source:

init(api)

Initialise a photo upload button at the top of the page.

Parameters:
Name Type Description
api mw.Api
Source:

initMobileOptions()

Add features, that depends on localStorage, such as "expand all sections" or "fontchanger". The checkbox is used for turning on/off expansion of all sections on page load.

Source:

languageOverlay(pageGateway) → {Overlay}

Factory function that returns a language featured instance of an Overlay

Parameters:
Name Type Description
pageGateway PageGateway
Source:
Returns:
Type
Overlay

loadCurrentPage() → {Page}

Constructs an incomplete Page model singleton representing the currently loaded page.

Because this depends on the presence of certain DOM elements, it should only be called after the DOMContentLoaded event.

Source:
Returns:
Type
Page

loadCurrentPageHTMLParser() → {PageHTMLParser}

Constructs a page parser singleton specific to the current page to find common child elements more easily.

Because this depends on the presence of certain DOM elements, it should only be called after the DOMContentLoaded event.

Source:
Returns:
Type
PageHTMLParser

loadImage(placeholder) → {Object}

Load an image on demand

Parameters:
Name Type Description
placeholder HTMLElement
Source:
Returns:
Type
Object

loadImages(placeholders) → {JQuery.Deferred}

Load an image on demand

Parameters:
Name Type Description
placeholders Array.<HTMLElement>

a list of images that have not been loaded.

Source:
Returns:
Type
JQuery.Deferred

loadingOverlay() → {Overlay}

Overlay that initially shows loading animation until caller hides it with .hide()

Source:
Returns:
Type
Overlay

loadReferences(data, gateway, page) → {jQuery.Promise|void}

Load the references section content from API if it's not already loaded.

All references tags content will be loaded per section.

Parameters:
Name Type Description
data ToggledEvent

Information about the section.

gateway ReferencesGateway
page Page
Source:
Returns:

rejected when not a reference section.

Type
jQuery.Promise | void

makeAddTopicForm(options) → {AddTopicForm}

Backwards compatible method for obtaining a TalkOverlay used by Minerva until it updates itself.

Parameters:
Name Type Description
options Object

Configuration options

Properties
Name Type Attributes Description
licenseMsg string

license text (HTML strings accepted)

onTextInput function <optional>

callback for when text changes

subject string

to prefill form with

body string

to prefill form with

disabled boolean

to mark the form inputs as disabled

Source:
Returns:
Type
AddTopicForm

makeHeader(heading, headerActions, headerCancelopt, additionalClassNamesopt) → {Element}

Creates a header

Parameters:
Name Type Attributes Description
heading string

(HTML allowed)

headerActions Array.<View>
headerCancel View <optional>

defaults to cancel button

additionalClassNames string <optional>

(should be escaped)

Source:
Returns:
Type
Element

makePanel($child) → {Panel}

Create a panel with a child

Parameters:
Name Type Description
$child jQuery.Object
Source:
Returns:
Type
Panel

mediaViewerOverlay(options) → {Overlay}

Produce an overlay for mediaViewer

Parameters:
Name Type Description
options Object
Source:
Returns:
Type
Overlay

memoize(method) → {function}

Memoize a class method. Caches the result of the method based on the arguments. Instances do not share a cache.

Parameters:
Name Type Description
method function

Method to be memoized

Source:
Returns:
Type
function

mfExtend(Child, ParentOrPrototype, prototypeopt)

Extends a class with new methods and member properties.

Parameters:
Name Type Attributes Description
Child function

function

ParentOrPrototype Object | function

class to inherit from OR if no inheriting class a prototype to extend the class with

prototype Object <optional>
Source:

nearbyPageList(latitude, longitude) → {View}

Parameters:
Name Type Description
latitude number
longitude number
Source:
Returns:

that will resolve to a WatchstarPageList or the result of nearbyErrorMessage

Type
View

newLazyImageTransformer(eventBus, find, offset, imagePlaceholders) → {Object}

Setup listeners to watch unloaded images and load them into the page as and when they are needed.

Parameters:
Name Type Description
eventBus OO.EventEmitter
find JQuery.find
offset number
imagePlaceholders Array.<HTMLElement>
Source:
Returns:

.

Type
Object

notificationsList(echo, markAllReadButton, onCountChange, onNotificationListRendered) → {View}

List of notifications

Parameters:
Name Type Description
echo mw.echo

class

markAllReadButton OO.ui.ButtonWidget

a button that will be associated with the read status of the notifications list.

onCountChange countChangeCallback

callback.

onNotificationListRendered function

a function that is called when the notifications list has fully rendered (taking no arguments)

Source:
Returns:
Type
View

notificationsOverlay(onCountChange, onNotificationListRendered) → {Overlay}

Make a notification overlay

Parameters:
Name Type Description
onCountChange countChangeCallback

receives one parameter - a capped (0-99 or 99+) count.

onNotificationListRendered function

a function that is called when the notifications list has fully rendered (taking no arguments)

Source:
Returns:
Type
Overlay

notify(isPendingopt)

Notifies the user that settings were asynchronously saved.

Parameters:
Name Type Attributes Description
isPending boolean <optional>

if set toast will show after page has been reloaded.

Source:

parseSaveError(data, codeopt) → {Object}

Turn an API response on save failure into a details object

Parameters:
Name Type Attributes Description
data Object | null

API response data

code string <optional>

Text status message from API

Source:
Returns:

An object with type and details properties. type is a string describing the type of error, details can be any object (usually error message).

Type
Object

postRender()

Source:

postRender()

Source:

postRender()

Source:

preRender()

Accounts for the fact sections are loaded asynchronously and sets the headers for the overlay

Source:

preRender()

Source:

promisedView(promise) → {View}

It's a view that spins until the promise resolves! If the promise successfully resolves, the newView will be shown. if the promise rejects and rejects to a view, the errorView will be shown.

Parameters:
Name Type Description
promise jQuery.Promise
Source:
Returns:
Type
View

queryPlaceholders(root) → {Array.<HTMLElement>}

Parameters:
Name Type Description
root HTMLElement
Source:
Returns:
Type
Array.<HTMLElement>

queryUnitializedItems($items, statuses) → {void}

Parameters:
Name Type Description
$items JQuery.Element
statuses WatchStatusMap
Source:
Returns:
Type
void

redirectParams(params, redirectURLopt) → {QueryParams}

Special:UserLogin post-request redirect query parameters.

Parameters:
Name Type Attributes Description
params QueryParams
redirectURL string <optional>
Source:
Returns:
Type
QueryParams

render(view, $nearby)

Parameters:
Name Type Description
view View

to render

$nearby jQuery.Object

where to render

Source:

renderItems($items, statuses) → {void}

Parameters:
Name Type Description
$items JQuery.Element
statuses WatchStatusMap
Source:
Returns:
Type
void

saveExpandedSections(expandedSections)

Parameters:
Name Type Description
expandedSections Object

Save expandedSections to localStorage

Source:

saveHeader(heading, additionalClassNames) → {Element}

Creates a header with a form

Parameters:
Name Type Description
heading string

of the header

additionalClassNames string

of the header

Source:
Returns:
Type
Element

savingHeader(heading, additionalClassNames) → {Element}

Creates a header with a form

Parameters:
Name Type Description
heading string

of the header

additionalClassNames string

of the header

Source:
Returns:
Type
Element

shouldLoadImage($placeholder, offset) → {boolean}

Check whether an image should be loaded based on its proximity to the viewport; and whether it is displayed to the user.

Parameters:
Name Type Description
$placeholder jQuery.Object
offset number
Source:
Returns:
Type
boolean

signUpParams(…params) → {QueryParams}

Special:UserLogin account creation query parameters.

Parameters:
Name Type Attributes Description
params QueryParams <repeatable>
Source:
Returns:
Type
QueryParams

storeSectionToggleState($heading, page)

Given an expanded heading, store it to localStorage. If the heading is collapsed, remove it from localStorage.

Parameters:
Name Type Description
$heading jQuery.Object

A heading belonging to a section

page Page
Source:

talkBoard(sections) → {View}

A board of talk topics

Parameters:
Name Type Description
sections Array.<Section>
Source:
Returns:
Type
View

talkOverlay(title, gateway) → {Overlay}

Produce an overlay for talk page

Parameters:
Name Type Description
title string

of the page to get talk topics for

gateway PageGateway

for interacting with API.

Source:
Returns:
Type
Overlay

uniqueId(prefix) → {string}

Generate a unique integer id (unique within the entire client session). Useful for temporary DOM ids.

Parameters:
Name Type Description
prefix string

Prefix to be used when generating the id.

Source:
Returns:
Type
string

updateFontSize()

Updates the font size based on the current value in storage

Source:

Type Definitions

countChangeCallback(count)

This callback is displayed as a global member.

Parameters:
Name Type Description
count number

a capped (0-99 or 99+) count

Source:

countChangeCallback(count)

This callback is displayed as a global member.

Parameters:
Name Type Description
count number

a capped (0-99 or 99+) count

Source:

Options

Type:
  • string | number | boolean | undefined
Properties:
Name Type Attributes Description
returnTo string <optional>
queryParams QueryParams <optional>
signupQueryParams QueryParams <optional>
options.progressiveButton Object <optional>

template options for Button element for signing in

options.actionAnchor Object <optional>

template options for Anchor element for signing up

Source:

PageTitleToPageIDMap

Type:
  • Object.<PageTitle, PageID>
Source:

StructuredLanguages

Type:
  • Object
Properties:
Name Type Description
autonym string

of language e.g. fran├žais

langname string

in the user's current language e.g French

title string

of the page in the language e.g. Espagne

dir string

(rtl or ltr)

url string

of the page

autonym string

of language e.g. fran├žais

langname string

in the user's current language e.g French

title string

of the page in the language e.g. Espagne

dir string

(rtl or ltr)

url string

of the page

frequency number

of times the language has been used by the given user

all Array.<Language>

languages that are available

suggested Array.<SuggestedLanguage>

languages based on users browsing history

Source:

Template

Type:
  • Object
Properties:
Name Type Description
render function

returning string of rendered HTML

Centralised place for template rendering.

T223927: We depend on the global Mustache brought in by the mediawiki.template.mustache module but do not delegate to mediawiki.template.mustache.js because its render method returns a JQuery object, but our MobileFrontend code depends on .render returning a string.

Source:

ToggledEvent

Type:
  • Object
Properties:
Name Type Description
expanded boolean

True if section is opened, false if closed.

page Page
isReferenceSection boolean
$heading JQuery.Object
Source:

WatchStatusMap

Type:
  • string | number
Source:

Events

resize

The window's resize event debounced at 100 ms. The resize:throttled event is the window's resize event throttled to 200 ms.

Source:

scroll

The window's scroll event debounced at 100 ms. The scroll:throttled event is the window's scroll event throttled to 200 ms.

Source:

section-toggled

Global event emitted after a section has been toggled

Type:
Source:

unwatch Fired when an article in the PageList is watched.

Source:

watch Fired when an article in the PageList is watched.

Source: