Namespace: mathex.Shared

mathex. Shared

Common operations object, this is not a class, rather an object which stores common used methods.
Source:

Methods

<static> addWidget(widget, position)

Add a widget in the widget container

Parameters:
Name Type Description
widget widget The widget mootools element
position String Position respect to the container (top, bottom)
Source:
Returns:
void

<static> calculatorWidget()

Creates a calculator widget and places it inside the widget container

Source:
Returns:
void

<static> checkResult(type, result, value) → {Boolean}

Checks if the given value is correct agains the result considering the type cast

Parameters:
Name Type Description
type String The type cast ('float', 'int', 'string_case')
result Mixed The right result
value Mixed The value to check
Source:
Returns:
The check result
Type
Boolean

<static> fontWidget()

Creates a font-size controller widget and places it inside the widget container

Source:
Returns:
void

<static> getViewport() → {Object}

Gets the viewport coordinates of the current window (width, height, left offest, top offset, coordinates of the center point).

Source:
Returns:
Viewport coordinates
Type
Object
Example
     // returned object
     {'width':width, 'height':height, 'left':left, 'top':top, 'cX':cX, 'cY':cY}

<static> parseTpl(tpl, inputs) → {String}

Parses a mathex template

Parses mathjax tags converting them to mathjax syntax, replaces input fields inside mathjax tags and activates toggling images
Parameters:
Name Type Argument Description
tpl String The mathex template
inputs Object <optional>
Object describing the field inputs
Source:
Returns:
The parsed template
Type
String

<static> playerWidget(audio_obj)

Creates a player widget in the top of the #container div, given an audio object. Removes it if the audio object is null

Parameters:
Name Type Description
audio_obj Object The audio object
Properties
Name Type Argument Description
mp3 String <optional>
Path to the mp3 file
ogg String <optional>
Path to the ogg file
Source:
Returns:
void

<static> removeWidget(widget)

Removes a widget

Parameters:
Name Type Description
widget widget The widget mootools element
Source:
Returns:
void

<static> showMessage(msg, css, callback)

Shows a message in a layer above the document

Parameters:
Name Type Argument Description
msg String The text message
css String A style class to apply to the message container
callback Function <optional>
A function to call when the layer is closed (click over the layer or the overlay)
Source:
Returns:
void

<static> toggleImage(img)

Toggles an image (toggles the '_toggle' suffix of the src attribute)

Parameters:
Name Type Description
img Object The mootools img element
Source:
Returns:
void