Global

Members

languages

Properties:
Name Type Description
languages` StructuredLanguages

JSDoc.

Source:

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:

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

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

enableKeyboardActions(toggler, $heading)

Enables toggling via enter and space keys

Parameters:
Name Type Description
toggler Toggler

instance.

$heading jQuery.Object
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

findChildInSectionLead(sectionIndex, selector) → {jQuery.Object}

Finds all child elements that match the selector in a given section or subsection. Returns any direct child elements that match the selector, (i.e. searches only one level deep) as well as any elements that match the selector within those children. If the Page has no headings (e.g. a stub), then the search will target all nodes within the page.

This code should work on desktop (PHP parser HTML) as well as mobile formatted HTML (PHP parser + MobileFormatter)

Parameters:
Name Type Description
sectionIndex number

as defined by the PHP parser. It should correspond to the section id used in the edit link for the section. Note, confusingly, this is different from section "ID" which is used in methods

selector string

to match

Source:
Returns:
Type
jQuery.Object

findSectionHeadingByIndex(sectionIndex) → {jQuery.Object}

Find the heading in the page. This has the benefit of excluding any additional h2s and h3s that may have been added programatically.

Parameters:
Name Type Description
sectionIndex number

as defined by the PHP parser. It should correspond to the section id used in the edit link for the section. Note, confusingly, this is different from section "ID" which is used in methods

Source:
Returns:
Type
jQuery.Object

getCurrentPage() → {Page}

Get current page view object

Source:
Returns:
Type
Page

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

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

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()

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:

init()

Initialise mobile page patrolling as provided by the PageTriage extension.

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:

isFragmentIdentifier(fragment) → {boolean}

Parameters:
Name Type Description
fragment string

The URL fragment.

Source:
Returns:

True if the current URL doesn't contain an invalid identifier expression, such as the slash in Special:Nearby#/search, and probably contains the target identifier to scroll to.

Type
boolean

isPageOrCoordFragment(fragment) → {boolean}

Parameters:
Name Type Description
fragment string

The URL fragment.

Source:
Returns:

True if the current URL is based around page or coordinates (as opposed to current location or search). e.g.: Special:Nearby#/page/San_Francisco and Special:Nearby#/coord/0,0.

Type
boolean

loadImage($placeholder) → {jQuery.Deferred}

Load an image on demand

Parameters:
Name Type Description
$placeholder jQuery.Object
Source:
Returns:
Type
jQuery.Deferred

loadImages(find, images) → {jQuery.Deferred}

Load an image on demand

Parameters:
Name Type Description
find JQuery.find
images Array

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

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:

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:

postRender()

Source:

preRender()

Source:

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

refresh(opt)

Initialize or instantiate Nearby with options

Parameters:
Name Type Description
opt Object
Properties
Name Type Description
api mw.Api

instance

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:

saveFailureMessage(data) → {string}

Build a save failure message from the API response

Parameters:
Name Type Description
data Object

Details about the failure, from EditorGateway.parseSaveError

Source:
Returns:

message describing the failure for display to the user

Type
string

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:

talkOverlay(options) → {Overlay}

Produce an overlay for talk page

Parameters:
Name Type Description
options Object
Properties
Name Type Description
api 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

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:

WatchStatusMap

Type:
  • string | number
Source:

Events

api

Source:

NEARBY_EVENT_POST_RENDER

Source:

references-loaded

Fired when references list is loaded into the HTML

Source:

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:
  • Object
Properties:
Name Type Description
wasExpanded bool
sectionNumber number
Source:

section-toggling

Global event emitted before a section is being toggled

Type:
  • Object
Properties:
Name Type Description
page Page
wasExpanded bool
isReferenceSection bool
$heading jQuery.Object
Source:

unwatch Fired when an article in the PageList is watched.

Source:

watch Fired when an article in the PageList is watched.

Source: