Class: Page

Page(options)

Mobile page view object

Constructor

new Page(options)

Parameters:
Name Type Description
options Object

Configuration options

Properties
Name Type Attributes Description
id number

Page ID. The default value of 0 represents a new or missing page. Be sure to override it to avoid side effects.

title string

Title of the page. It includes prefix where needed and is human readable, e.g. Talk:The man who lived.

titleObj Object
displayTitle string

HTML title of the page for display. Falls back to defaults.title (escaped) if no value is provided. Must be safe HTML!

namespaceNumber number

the number of the namespace the page belongs to

protection Object

List of permissions as returned by API, e.g. [{ edit: ['*'] }]

url string
wikidataDescription string
isMainPage boolean

Whether the page is the Main Page.

isMissing boolean

Whether the page exists in the wiki.

lastModified Date <optional>
anchor string
relevantTitle string <optional>

associated with page. For example Special:WhatLinksHere/Foo would be associated with the page Foo.

revId number

Revision ID. See wgRevisionId.

isWatched boolean

Whether the page is being watched

thumbnail Object

thumbnail definition corresponding to page image

Properties
Name Type Description
isLandscape boolean

whether the image is in landscape format

width number

of image in pixels.

height number

of image in pixels.

source string

url for image

Source:

Methods

getDisplayTitle() → {string}

Retrieve the title that should be displayed to the user

Source:
Returns:

HTML

Type
string

getNamespaceId() → {number}

return namespace id

Source:
Returns:

namespace Number

Type
number

getRevisionId() → {number}

Return the latest revision id for this page

Source:
Returns:
Type
number

getTitle() → {string}

Return prefixed page title

Source:
Returns:
Type
string

inNamespace(namespace) → {boolean}

Determine if current page is in a specified namespace

Parameters:
Name Type Description
namespace string

Name of namespace

Source:
Returns:
Type
boolean

isMainPage() → {boolean}

Checks whether the current page is the main page

Source:
Returns:
Type
boolean

isVEAvailable() → {boolean}

Check if the visual editor is available on this page

Source:
Returns:
Type
boolean

isVESourceAvailable() → {boolean}

Check if the visual editor in source mode is available on this page

Source:
Returns:
Type
boolean

isVEVisualAvailable() → {boolean}

Check if the visual editor in visual mode is available on this page

Source:
Returns:
Type
boolean

isWatched() → {boolean}

Checks whether the current page is watched

Source:
Returns:
Type
boolean

isWikiText() → {boolean}

Determines if content model is wikitext

Source:
Returns:
Type
boolean

(static) parse(resp) → {Page}

Create a Page object from an API response.

Parameters:
Name Type Description
resp Object

as representing a page in the API

Source:
Returns:
Type
Page