Global

Methods

checkForMatch(array, propertyToMatch, valueToMatch, lowerCase) → {integer}

Source:

Function to check if item exists in and array of objects based on the property provided.

Parameters:
Name Type Description
array array

Array in which the item should be looked for

propertyToMatch string

Item to be matched

valueToMatch string

Item to be matched with

lowerCase boolean

Check if the values to be matched should both be compared in lowercase or not

Returns:

Returns returns the index of the element, if element not found then returns -1.

Type
integer

clearSelection()

Source:

Clears any selection made in the document.

getPropValue(array, propertyToMatch) → {any}

Source:

Function to return value of Object

Parameters:
Name Type Description
array array

Array in which the item should be looked for

propertyToMatch string

Item to be matched

Returns:

Returns value of property.

Type
any

getQueryVariable(variable) → {string|number}

Source:

Function to get a value of an attibute's value in the URL.

Parameters:
Name Type Description
variable string | number

A variable to found its value.

Returns:

Returns the value of an attribute passed.

Type
string | number

getUpdatedPosition(anode, textContainer, curWindow, curDocument)

Source:

Provides the position of Highlight Node in container

Parameters:
Name Type Description
anode DOMElement

HTML node of the element with in which selection is being made

textContainer DOMElement
curWindow Window
curDocument Document

htmlDecode(value) → {string}

Source:

This function will Decode a string to HTML friendly version.

Example
htmlDecode("<div>test</div>");
//returns '<div>test</div>'
Parameters:
Name Type Description
value string

String HTML to be Encoded

Returns:

Returns the Decode string as HTML.

Type
string

htmlEncode(value) → {string}

Source:
See:

This function will Encode an HTML string to XML friendly version, it is used with the htmlEncode Function, it create a in-memory div, set it's inner text(which jQuery automatically encodes) then grab the encoded contents back out. The div never exists on the page.

Example
htmlEncode('<div>test</div>');
//returns "&lt;div&gt;test&lt;/div&gt;"
Parameters:
Name Type Description
value string

String HTML to be Encoded

Returns:

Returns the Encoded string.

Type
string

htmlEscape(str) → {string}

Source:

This function will convert a string to XML friendly version by converting the potential HTML tags to thier unicodes, it is used with the htmlEncode Function

Example
htmlEscape('<div>test</div>');
//returns "&lt;div&gt;test&lt;/div&gt;"
Parameters:
Name Type Description
str string

String to esape the HTML tags

Returns:

Returns the escaped string.

Type
string

lineDistance(point1, point2) → {Number}

Source:

This function will find distance between two points, will return the distance as Number. This function is used in the DCR to create connections mostly.

Example
lineDistance({'x':10, 'y':10}, {'x':20, 'y':20});
// returns 14.142135623730951
Parameters:
Name Type Description
point1 object

First Point containing x and y location

point2 object

Second Point containing x and y location

Returns:

Returns the distance between two points.

Type
Number

restoreSelection(containerEl, savedSel)

Source:

Creates a selection based on start, end postions provided with in a text container

Parameters:
Name Type Description
containerEl object

HTML node of the element with in which selection is being made

savedSel object

An object having start, end postions, e-g:{start: null ,end: null}. HighlightRange object can also be used.

saveSelection(containerEl) → {object}

Source:

Getting start and end position of a selection from a node with in which selection is being made

Parameters:
Name Type Description
containerEl object

HTML node of the element with in which selection is being made

Returns:
  • Returns object with start and end postion of selection
Type
object

stringToXML(oString) → {XML}

Source:

Function to convert a string to XML document format.

Example
stringToXML('<div>test</div>');
//returns and XML document
Parameters:
Name Type Description
oString string

String to be converted as XML document

Returns:

Returns the string as an XML document.

Type
XML

XMLtoString(oXML) → {string}

Source:

Function to convert an XML document format to string.

Parameters:
Name Type Description
oXML string

XML to be converted as string.

Returns:

Returns the XML document as string.

Type
string