Global

Methods

_(msgid) → {String}

Easily translate your messages when use `Gettext` functionalities.
Same as you call `iJS.i18n.gettext()`. See documentation of associated terms for more informations.
Parameters:
Name Type Description
msgid String message to be translated
Source:
Returns:
translated message if is found or `msgid` if not.
Type
String
Example
//set the locale in which the messages will be translated
iJS.i18n.setlocale("en_US.utf8") ;
//add domain where to find messages data
iJS.i18n.bindtextdomain("domain_po", "./path_to_locale", "po") ;
iJS.i18n.try_load_lang() ; //will load and parse messages data from the setting catalog.
//now print your messages
alert( iJS._("messages to be translated") ) ;

animate(elt, anime, iterations, time) → {AnimationPlayer}

Animate an element by using predifined animations styles. Provide support of popuplar animate.css features. Some animations styles have two way to be selected by its name; for example, `bounceInUp` like in *animate.css* can also be indicated with `bounce-in-up`, ...
Parameters:
Name Type Description
elt Element Element to animate.
anime String Animations styles.
iterations Number Number of animation's iteration. 1 by default, -1 or "Infinity" for infinite animation.
time Number Duration of the animation. 900ms by default.
Source:
Returns:
An object that can help to control considered animation. See web-animations.js API for more details.
Type
AnimationPlayer
Example
//Select the elements to animate and enjoy!
    var elt = document.querySelector("#notification") ;
    iJS.animate(elt, "shake") ;
    //it return an AnimationPlayer object: see **web-animations.js** API for more details.
    //animation iteration and duration can also be indicated.
    var vivifyElt = iJS.animate(elt, "bounce", 3, 500) ;
    vivifyElt.onfinish = function(e) {
        //doSomething ...;
    }
    // less than 1500ms later...changed mind!
    vivifyElt.cancel();

getPageXY(arg) → {Object}

Get the coordonnate of an element relative to window.
Parameters:
Name Type Description
arg Object a `HTMLElement` or a `id` of an element
Source:
Returns:
coordonnate `{x:x, y:y}`
Type
Object
Example
var eltScrollPos = iJS.getPageXY( HTMLElt ) ;
         alert( eltScrollPos.x ) ;
         alert( eltScrollPos.y ) ;

getTextContent(arg) → {String}

Get the `textContent` of an element without worry about browser’s support.
Parameters:
Name Type Description
arg HTMLElement Element to get the text content
Source:
Returns:
the text content, empty string if can not be got or `null` if the element is not a *HTMLElement*.
Type
String

getXY(arg) → {Object}

Get the coordonnate of an element relative to document.
Parameters:
Name Type Description
arg Object a `HTMLElement` or a `id` of an element
Source:
Returns:
coordonnate `{x:x, y:y}`
Type
Object
Example
var eltPos = iJS.getXY( HTMLElt ) ;
         alert( eltPos.x ) ;
         alert( eltPos.y ) ;

isArray(arg) → {boolean}

Let you know if a value’s suite or a variable is type of Array or not.
Parameters:
Name Type Description
arg all argument of test.
Source:
Returns:
true if it is, false if it isn’t.
Type
boolean

isBoolean(arg) → {boolean}

Let you know if a value or a variable is type of Boolean or not.
Parameters:
Name Type Description
arg all argument of test.
Source:
Returns:
true if it is, false if it isn’t.
Type
boolean

isDefined(arg) → {boolean}

Let you know if a variable is defined or not. ie: if an object is not `undefined`.
Parameters:
Name Type Description
arg all object to evaluate
Source:
Returns:
true if it is, false if it isn’t.
Type
boolean

isElement(arg) → {boolean}

Let you know if a variable is type of Element or not.
Parameters:
Name Type Description
arg all argument of test.
Source:
Returns:
true if it is, false if it isn’t.
Type
boolean

isHTMLElement(arg) → {boolean}

Let you know if a variable is type of HTMLElement or not.
Parameters:
Name Type Description
arg all argument of test.
Source:
Returns:
true if it is, false if it isn’t.
Type
boolean

isHTMLImageElement(arg) → {boolean}

Let you know if a variable is type of HTMLImageElement or not.
Parameters:
Name Type Description
arg all argument of test.
Source:
Returns:
true if it is, false if it isn’t.
Type
boolean

isHTMLInputElement(arg) → {boolean}

Let you know if a variable is type of HTMLInputElement or not.
Parameters:
Name Type Description
arg all argument of test.
Source:
Returns:
true if it is, false if it isn’t.
Type
boolean

isHTMLLinkElement(arg) → {boolean}

Let you know if a variable is type of HTMLLinkElement or not.
Parameters:
Name Type Description
arg all argument of test.
Source:
Returns:
true if it is, false if it isn’t.
Type
boolean

isNumber(arg) → {boolean}

Let you know if a value or a variable is type of Number or not.
Parameters:
Name Type Description
arg all argument of test.
Source:
Returns:
true if it is, false if it isn’t.
Type
boolean

isObject(arg) → {boolean}

Let you know if a variable is type of Object or not.
Parameters:
Name Type Description
arg all argument of test.
Source:
Returns:
true if it is, false if it isn’t.
Type
boolean

isSet(arg) → {boolean}

Let you know if a value or a variable is valid or not. ie: if an object is `null` or `undefined`.
Parameters:
Name Type Description
arg all object to evaluate
Source:
Returns:
true if it is, false if it isn’t.
Type
boolean

isString(arg) → {boolean}

Let you know if a value or a variable is type of String or not.
Parameters:
Name Type Description
arg all argument of test.
Source:
Returns:
true if it is, false if it isn’t.
Type
boolean

isUndefined(arg) → {boolean}

Let you know if a variable is undefined or not. ie: if an object is not defined.
Parameters:
Name Type Description
arg all object to evaluate
Source:
Returns:
true if it is, false if it isn’t.
Type
boolean

newHTTPRequest() → {XMLHttpRequest}

Easily create compatible Ajax XMLHttpResquest object, depending of web browsers support.
Source:
Returns:
new instance of `XMLHttpRequest` class.
Type
XMLHttpRequest

setTextContent(arg, text)

Set the `textContent` of an element without worry about browser’s support.
Parameters:
Name Type Description
arg HTMLElement Element to set the text’s content
text String Text that will be used
Source:

stringClear(arg) → {String}

clear a string by deleting space at the beginning and at the end.
Parameters:
Name Type Description
arg String a string to clear
Source:
Returns:
null or the formatted string
Type
String