Helper methods.
- Source:
Classes
Methods
(static) blinkNode(node, times)
Blink target node N times over 3/4 of a second by adding and removing color class
- Source:
Parameters:
Name | Type | Description |
---|---|---|
node |
Node
|
the node we will add and remove the color class from |
times |
number
|
the amount of times to blink the node. Must be an integer. |
(static) createMenuItems()
Adds Multidict add/remove context menu items for when user selects text
- Source:
(static) flattenAllChildren(nodeList, accumulatoropt) → {Array}
Takes a node or nodeList and recursively flattens the node(s) and all children into an array
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
nodeList |
Node
|
Array.<Node>
|
NodeList
|
the nodeList, node, or array of nodes to operate on | ||
accumulator |
Array
|
<optional> |
[] | array used to accumulate all child nodes (defaults to empty) |
Returns:
- Type:
-
Array
Flattened array of node(s) and all child nodes
(async, static) getDefaultLanguages() → {array}
Returns an array of languages based on getAcceptLanguages and getUILanguage to use as defaults
for when no saved languages exist in browser storage.
- Source:
Returns:
- Type:
-
array
Array of language codes i.e. ['en-US', 'fr']
(static) isSupported(node) → {boolean}
Return a boolean value that is true if the node is a supported editable node
- Source:
Parameters:
Name | Type | Description |
---|---|---|
node |
node
|
the node to be checked |
Returns:
- Type:
-
boolean
True if the node is a text area
(static) notify(title, message)
Creates a notification that is displayed to the user
- Source:
Parameters:
Name | Type | Description |
---|---|---|
title |
type
|
the notification title |
message |
type
|
the message that will appear as the notification body |
(static) prepareLanguages(languageCodes) → {Array.<string>}
Prepares a language array from an array of language codes
- Source:
Parameters:
Name | Type | Description |
---|---|---|
languageCodes |
Array.<string>
|
array of langauge codes i.e. ['de-DE', 'en-AU', 'en', 'fr'] |
Returns:
- Type:
-
Array.<string>
Array of normalised language codes i.e. ['de-de', 'en-au', 'en-en', 'fr-fr']
(static) setNodeListAttributes(nodeList, attributes)
Takes a node, array of nodes, or nodeList and object of attribute key value pairs to set on the
given nodes
- Source:
Parameters:
Name | Type | Description |
---|---|---|
nodeList |
node
|
Array.<node>
|
nodeList
|
the nodeList, node, or array of nodes to operate on |
attributes |
object
|
object of attribute key value pairs |