Expand all

abstract ve.init.Platform

Constructor

new ve.init.Platform()abstract #

Generic Initialization platform.

Mixes in:
Source:
Generic Initialization platform.

Properties

addMessagesabstract #

Add multiple messages to the localization system.

Source:
Add multiple messages to the localization system.

addParsedMessagesabstract #

Add multiple parsed messages to the localization system.

Source:
Add multiple parsed messages to the localization system.

createLocalStorageabstract #

Create a local storage-based conflictable storage object

Source:
Create a local storage-based conflictable storage object

createSafeStorageabstract #

Create a safe storage object

Source:
Create a safe storage object

createSessionStorageabstract #

Create a session storage-based conflictable storage object

Source:
Create a session storage-based conflictable storage object

formatNumberabstract #

For a number as a string

Source:
For a number as a string

getConfigabstract #

Get a platform config value

Source:
Get a platform config value

getExternalLinkUrlProtocolsRegExpabstract #

Get an anchored regular expression that matches allowed external link URLs starting at the beginning of an input string.

Source:

Get an anchored regular expression that matches allowed external link URLs starting at the beginning of an input string.

getHtmlMessageabstract #

Get an HTML message from the localization system, with HTML or DOM arguments

Source:
Get an HTML message from the localization system, with HTML or DOM arguments

getLanguageAutonymabstract #

Get a language's autonym from its code.

Source:
Get a language's autonym from its code.

getLanguageCodesabstract #

Get a list of all language codes.

Source:
Get a list of all language codes.

getLanguageDirectionabstract #

Get a language's direction from its code.

Source:
Get a language's direction from its code.

getLanguageNameabstract #

Get a language's name from its code, in the current user language if possible.

Source:
Get a language's name from its code, in the current user language if possible.

getMessageabstract #

Get a message from the localization system.

Source:
Get a message from the localization system.

getParsedMessageabstract #

Get a parsed message as HTML string.

Does not support $# replacements.

Source:
Get a parsed message as HTML string.

getUnanchoredExternalLinkUrlProtocolsRegExpabstract #

Get an unanchored regular expression that matches allowed external link URLs anywhere in an input string.

Source:

Get an unanchored regular expression that matches allowed external link URLs anywhere in an input string.

getUserConfigabstract #

Get a user config value

Source:
Get a user config value

getUserLanguagesabstract #

Get the user language and any fallback languages.

Source:
Get the user language and any fallback languages.

notifyabstract #

Show a read-only notification to the user.

Source:
Show a read-only notification to the user.

parseNumberabstract #

Parse a string into a number

Source:
Parse a string into a number

setUserConfigabstract #

Set a user config value

Source:
Set a user config value

deferredPlatformprivatestatic #

A jQuery.Deferred that tracks when the platform has been created.

Source:
A jQuery.Deferred that tracks when the platform has been created.

initializedPromisestatic #

A promise that tracks when ve.init.platform is ready for use. When this promise is resolved the platform will have been created and initialized.

This promise is safe to access early in VE startup before ve.init.platform has been set.

Properties:

Type Description
jQuery.Promise
Source:
A promise that tracks when ve.init.platform is ready for use.

Methods

canUseUserConfig() → {boolean} #

Determine whether we can store preferences

Returns:

Type
boolean
Source:
Determine whether we can store preferences

createConflictableStorage(safeStorage) → {ve.init.ConflictableStorage} #

Create a list storage object from a safe storage object

Parameters:

Name Type Description
safeStorage ve.init.SafeStorage

Returns:

Type
ve.init.ConflictableStorage
Source:
Create a list storage object from a safe storage object

decodeEntities(html) → {string} #

Decode HTML entities for insertion into the document

Parameters:

Name Type Description
html string

HTML string

Returns:

Type
string
Source:
Decode HTML entities for insertion into the document

fetchSpecialCharList() → {jQuery.Promise} #

Fetch the special character list object

Returns a promise which resolves with the character list

Returns:

Type
jQuery.Promise
Source:

Fetch the special character list object

Returns a promise which resolves with the character list

generateUniqueId() → {string} #

Generate a unique ID

Returns:

Type
string
Source:
Generate a unique ID

getInitializedPromise() → {jQuery.Promise} #

Get a promise to track when the platform has initialized. The platform won't be ready for use until this promise is resolved.

Since the initialization only happens once, and the same (resolved) promise is returned when called again, and since the Platform instance is global (shared between different Target instances) it is important not to rely on this promise being asynchronous.

Returns:

Promise that will be resolved once the platform is ready

Type
jQuery.Promise
Source:
Get a promise to track when the platform has initialized.

getMetadataIdRegExp() → {RegExp|null} #

Get a regular expression that matches IDs used only for linking document data to metadata. Use null if your document format does not have such IDs.

Returns:

Regular expression object

Type
RegExp | null
Source:

Get a regular expression that matches IDs used only for linking document data to metadata.

getUserName() → {string|null} #

Get the current user's name, if the platform supports it

Returns:

User name, or null if not applicable

Type
string | null
Source:
Get the current user's name, if the platform supports it

hasLanguageCode(code) → {boolean} #

Check if a language code is known to this platform.

Parameters:

Name Type Description
code string

Language code

Returns:

Language code is known

Type
boolean
Source:
Check if a language code is known to this platform.

initialize() → {jQuery.Promise}private #

Initialize the platform. The default implementation is to do nothing and return a resolved promise. Subclasses should override this if they have asynchronous initialization work to do. The promise rejects if the platform is incompatible.

External callers should not call this. Instead, call #getInitializedPromise.

Returns:

Promise that will be resolved once initialization is done

Type
jQuery.Promise
Source:
Initialize the platform.

processSpecialCharSymbols(symbols) → {Array.<Object>} #

Post-process the symbol list.

If a keyed object format is used, it is coverted to an array, and the label property is set from the key when required.

For individual symbols, turns the source property into a CSS class.

Parameters:

Name Type Description
symbols Object | Array

Symbol data

Returns:

Type
Array.<Object>
Source:
Post-process the symbol list.

getSystemPlatform() → {string}static #

Get client platform string from browser.

Returns:

Client platform string

Type
string
Source:
Get client platform string from browser.

isEdge() → {boolean}static #

Check whether we are running in Edge.

Returns:

We are in Edge

Type
boolean
Source:
Check whether we are running in Edge.

isIos() → {boolean}static #

Check whether we are running on iOS

Returns:

We are running on iOS

Type
boolean
Source:
Check whether we are running on iOS