A content file which will be injected to the page. Communicaties with
the extension via message passing. This file also works as the plugin storage for UI element settings.
- Author:
-
- Source:
Methods
Adds a callback to determine the position the mouse to all classes "tooltip".
- Source:
(static) annotate() → {Array}
Calculates all metrics and injects the tooltip-source code.
- Source:
Returns:
- The fully annotated sentences as DOM in wrapper span-elements in an Array.
-
Type
-
Array
(static) calcCombinedScore()
Calculates the combined score of the given scores. Influence-variables must already exist.
- Source:
(static) getColor(value) → {String}
Calculates a color string for a given value.
Parameters:
Name |
Type |
Description |
value |
Float
|
Value between 0.0 and 1.0 |
- Source:
Returns:
- The color string specifying a color between red (for 0.0) and blue (for 1.0).
-
Type
-
String
(static) listener()
Listener function for Chrome messaging system. The meaning of the parameters is documented by Google Chromes' extension documentation.
- Source:
(static) loadWordList()
Loads the word list containing the 1000 most common words.
This function must be called before trying to use {annotate()}
- Source:
(static) map()
Maps the value between 0.0 (worst) and 1.0 (best). Clamped, if the value is out of this range.
- Source:
(static) mergeRawSentenceDoms(rawObjectSentenceDoms, rootNode) → {Array}
Postprocessing for retrieveRawSentenceDoms. Merges split sentences back into one.
Parameters:
Name |
Type |
Description |
rawObjectSentenceDoms |
Array
|
The output of retrieveRawSentenceDoms(). |
rootNode |
Node
|
the root node in which the elements of rawObjectSentenceDoms lie |
- Source:
Returns:
- merged sentences. Same format as rawObjectSentenceDoms.
-
Type
-
Array
(static) retrieveRawSentenceDoms(nodeRoot) → {Array}
Determins the sentences contained in a DOM Node by simple means,
wraps them into spans and returns the list of these spans. TextNodes get split if necessary.
Parameters:
Name |
Type |
Description |
nodeRoot |
Node
|
the root node in which to look for sentences. It has to contain only complete sentences. |
- Source:
Returns:
- Returns an array of spans which wrap the Nodes of sentences.
-
Type
-
Array
(static) showColors(sentenceDoms, show)
Calculates and sets the color of each sentence span, or removes it.
Parameters:
Name |
Type |
Description |
sentenceDoms |
Array
|
The array of spam-elements in which the DOM for each sentence lies |
show |
Boolean
|
Should the spans get the score as background color? If not, background-color will be set to "transparent". |
- Source:
Enables or disables the tooltips for the sentences selected by .sentence span.tooltip.
- Source:
(static) updateScores(sentenceDoms)
Updates the combined score values for each span
Parameters:
Name |
Type |
Description |
sentenceDoms |
Array
|
The array of spam-elements in which the DOM for each sentence lies |
- Source: