Module: GenUtils

Some generic utilities.
Source:

Methods

(static) addClass(elem, cls)

Unescape HTML tags.
Parameters:
Name Type Description
elem object DOM element.
cls string CSS class name.
Source:

(static) boundingBoxSize(elem, isVisible) → {object}

Compute bounding box of an element.
Parameters:
Name Type Description
elem object Target object.
isVisible boolean Whether the element is visible or not.
Source:
Returns:
{ area: number, width: number, height: number }
Type
object

(static) decodeEntities(html) → {string}

Decode HTML tags.
Parameters:
Name Type Description
html string Input string.
Source:
Returns:
Type
string

(static) encodeEntities(html) → {string}

Encode HTML tags.
Parameters:
Name Type Description
html string Input string.
Source:
Returns:
Type
string

(static) escapeHTML(html) → {string}

Escape HTML tags.
Parameters:
Name Type Description
html string Input string.
Source:
Returns:
Type
string

(static) fadeOut(elem, fn)

Fire a function after some time delay.
Parameters:
Name Type Description
elem object DOM element.
fn function Callback function.
Source:

(static) getDataset(elem) → {object}

Retrieve element dataset.
Parameters:
Name Type Description
elem object DOM element.
Source:
Returns:
Type
object

(static) increaseCounter(obj, key, val)

Increase object key by some amount.
Parameters:
Name Type Description
obj object Target object.
key string Target object key.
val int New value (default: 1).
Source:

(static) objKeys(obj) → {array}

Get object keys.
Parameters:
Name Type Description
obj object Target object.
Source:
Returns:
Type
array

(static) parseDatasets(html, arr) → {array}

Parse element datasets form HTML string.
Parameters:
Name Type Description
html string Input HTML string.
arr array Placeholder used for recursion.
Source:
Returns:
Type
array

(static) stripTags(html) → {string}

Remove HTML tags from string.
Parameters:
Name Type Description
html string Input string.
Source:
Returns:
Type
string

(static) throttle(fn, time)

Fire a function after some time delay.
Parameters:
Name Type Description
fn function Callback function.
time int Delay.
Source:

(static) trim(str) → {string}

Remove leading and trailing whitespaces from string.
Parameters:
Name Type Description
str string Input string.
Source:
Returns:
Type
string

(static) unescapeHTML(html) → {string}

Unescape HTML tags.
Parameters:
Name Type Description
html string Input string.
Source:
Returns:
Type
string