Home

background.js

The background script of the plugin. Registers the button to wikipedia sites and is always active.
Source:

content.js

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:
  • Ulrik Schremser
Source:

Methods

(static) addToolTipMouseCallback()

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:

(static) showTooltip()

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:

popup.js

The javascript file of popup.html (which is what is displayed when clicking the plugin-icon). Communicates with the injected code (content.js) via message passing.
Author:
  • Ulrik Schremser
Source:

Methods

(static) correctSliders(idCurrent)

Changes the values of the other slides to sum the max value
Parameters:
Name Type Description
idCurrent String The id of the slider that has been changed
Source:

(static) disableUi()

Disables the UA components of the plugin
Source:

(static) enableUi()

Enables the UI components of the plugin
Source:

(static) updateScore()

Updates the score inside the injected content.js by sending a message to it containing the new values of the sliders.
Source: