Global

Members

EffectRegistry

Global effect registry

Source:

html_characters

HTML caractères

Source:

keyboard_unicodes

Keyboards Unicodes list

Source:

metadata :jQuery

Returns the metadata object for the first member of the jQuery object.

Type:
  • jQuery
Source:

NEWPOPUPWINDOW

The following variables and functions are already defined: - function 'include(filename)' to include a file from javascript - the array 'settings' wich defines the global page user options

Source:

settings

Show/Hide toggler

Source:

Methods

_dbg(string, string)

DEBUGGER - Write 'str' in console (FireBug for example) if present, or alert(str)

Parameters:
Name Type Description
string

str The text you want to be displayed

string

title The title of your text | optional

Source:

_dbg_info(string, string)

DEBUGGER INFO - Write 'str' in console (FireBug for example) if present

Parameters:
Name Type Description
string

str The text you want to be displayed

string

title The title of your text | optional

Source:

_dbg_log()

DEBUGGER LOG - Write 'str' in console (FireBug for example) if present parsing it with arguments (like a sprintf() completion)

Source:

add_collection_field(string, tag_name, num, string, string)

Add a new item in a collection

The model HTML string needs to be escaped and HTML tags need to be entities. The keywords "$$counter$$" and "$$value$$" will be replaced by their corresponding content if so. For example :

<label for="myFieldName_$$counter$$">My field $$counter$$</label><input type="text" id="myFieldName_$$counter$$" name="myFieldName[$$counter$$]" value="" /> [<a href="javascript:remove_collection_field( 'my-fields-list-$$counter$$' );" title="Remove this email field">-</a>]

To set an array of values (if there is an array of fields), you have to inform the function of each value name (and default value if so), as follow :

var values = {
    first_field_name: 'first_field_default_value',
    second_field_name: '', // this will set a blank default value but the field name declaration is required
    ...
};
add_collection_field( 'fields-list-id', 'tag_name', null, null, values );

Basic usage :

<ul id="my-fields-list">
</ul>
[<a href="javascript:add_collection_field( 'my-fields-list', 'li', '0', '&lt;label for=&quot;myFieldName_$$counter$$&quot;&gt;My field $$counter$$&lt;/label&gt;&lt;input type=&quot;text&quot; id=&quot;myFieldName_$$counter$$&quot; name=&quot;myFieldName[$$counter$$]&quot; value=&quot;&quot; /&gt;&amp;nbsp;[&lt;a href=&quot;javascript:remove_collection_field( 'my-fields-list-$$counter$$' );&quot; title=&quot;Remove this email field&quot;&gt;-&lt;/a&gt;]', 'first value' );" title="Add a new field">+</a>]

HTML5 usage :

<ul id="my-fields-list"
    data-prototype="&lt;label for=&quot;myFieldName_$$counter$$&quot;&gt;My field $$counter$$&lt;/label&gt;&lt;input type=&quot;text&quot; id=&quot;myFieldName_$$counter$$&quot; name=&quot;myFieldName[$$counter$$]&quot; value=&quot;&quot; /&gt;&amp;nbsp;[&lt;a href=&quot;javascript:remove_collection_field( 'my-fields-list-$$counter$$' );&quot; title=&quot;Remove this email field&quot;&gt;-&lt;/a&gt;]"
    data-counter="0">
</ul>
[<a href="javascript:add_collection_field( 'my-fields-list', 'li' );" title="Add a new field">+</a>]
Parameters:
Name Type Description
string

id The ID string of the collection holder (parent) | required

tag_name

child_type The name of the tag to create in the parent for the new item | required

num

counter The counter where to begin the collection count | optional, if not set, the function will try to get the "data-counter" attribute of the parent, and by default, will count the parent's children entries

string

field_model The HTML string to put in the collection item | optional, if not set, the function will try to get the "data-prototype" attribute of the parent

string

_value The value to insert in the new collection item if so | optional, default is ''

Source:

addClassName(element, string)

Add class "clsname" to element "domobj"

Parameters:
Name Type Description
element

domobj A DOM element node

string

clsname The class name to add

Source:
Returns:

void

applyCallback(str|function, misc)

Apply a callback function on args

Parameters:
Name Type Description
str|function

callback The callback function name or closure to execute

misc

args The argument(s) to pass for the callback execution

Source:
Returns:

misc The result of the callback execution

array_remove()

Extension of Array objects, to remove a list of specific items Pierre Cassat - 03_2009

Usage : theArray.remove( toRemove ); With : 'theArray' => a true javascript array : [ a, b, c, d, ] 'toRemove' => comma-separated string list of items to remove, each has to be string ( numbers must be written between quotes )

Full example : var a = [ 1, 3, 8, 9, 11, 35 ]; var b = [ "entree", "de", "test" ]; alert(a); alert(a.remove("3")); alert(a.remove("3","11")); alert(b); alert(b.remove("de")); alert(b.remove("de","test"));

Source:

Blind()

Blind effect

Source:

capitaliseFirstLetter(string)

PHP ucfirst() equivalent

Parameters:
Name Type Description
string
Source:
Returns:

string

change_class_check_onload()

Check for all checkboxes with name "checkname" in form "form" on document load and add class "class" to parent "blocktype" Must be called after the HTML of the concerned form or when document is fully loaded

Source:

change_class_oncheck()

Adds the class "class" to "blockid" if "check_id" is checked Removes the class if it is unchecked

Source:

checkAll()

Checks or unckecks all checkboxes with name "check_name" in form "form"

Source:

dump(arr, level)

Function : dump()

This function was inspired by the print_r function of PHP. This will accept some data as the argument and return a text that will be a more readable version of the array/hash/object that is given.

Parameters:
Name Type Description
arr

The data - array,hash(associative array), object

level

OPTIONAL

Source:
Returns:

string The textual representation of the array.

each(array|collection, str|function)

Loop on each item of an Array or a Collection

Parameters:
Name Type Description
array|collection

collection The array or collection to loop on

str|function

callback A callback function to execute on each item, as callback( index, value )

Source:
Returns:

array|collection Returns the array or collection after execution of the loop

Effect()

Global effect object

Source:

extend(object, object, string)

Extend an object with a set of options, methods are not extended or replaced

Parameters:
Name Type Description
object

obj The object to extend

object

opts The values to use extending the object

string

mask A mask to build the property name correspondance (must contain "%s" replaced with opts property name)

Source:
Returns:

object The original object with properties extended by the opts values if so

Fade()

Fade effect

Source:

field_toggler(string, string, string, string)

Toggle a field in a dom object

Parameters:
Name Type Description
string

id The ID string of the collection holder (parent) | required

string

field_name The name of the toggled field

string

field_model The HTML string to put in the collection item | optional, if not set, the function will try to get the "data-prototype" attribute of the parent

string

action The action to execute for the toggling : 'replace' (default) to replace the content, 'add' to add the model after the block content, 'back' to put the original content back

Source:

font_size(string, string, float, string)

Change a font-size of a DOM block by its ID.

Parameters:
Name Type Description
string

action The action to execute on font-size : '+' to increase it, '-' to decrease it and '0' for the original size

string

id A dom block ID for selection

float

range The range to use for increase/decrease font-size

string

def The default original font-size to use if it's not set in CSS

Source:

get_url(string, string)

Get Url

Function that returns current url Params : 'type' : 'param' 'base' or empty to the all url

Parameters:
Name Type Description
string

type Set if you want to returns just the url's parametres, or base | optional | default is empty

string

req_url The url you want to analyze | optional | default is current window url

Source:
Returns:

string

getClasses(element)

Get an array of classes of element "domobj"

Parameters:
Name Type Description
element

domobj A DOM element node

Source:
Returns:

array The array of element classes or an empty array otherwise

getClassNameIndex(element, string)

Get the index of class "clsname" in the element "domobj"

Parameters:
Name Type Description
element

domobj A DOM element node

string

clsname The class name to check

Source:
Returns:

int|bool The index of the classname if so, false otherwise

getOffset(object)

Get an element positions

Parameters:
Name Type Description
object

element The element from which to get the attribute

Source:
Returns:

object An array like ( left:X, top:Y, right:W, bottom:Z, width:w, height:h )

getStyleAttribute(object, string, string)

Get an element style attribute (transformed if so)

Parameters:
Name Type Description
object

element The element from which to get the attribute

string

attribute The attribute name to get

string

actions A list of actions, separated by space, to treat on value (parseInt, strip_px)

Source:
Returns:

The value retrieved, treated by the requested actions if so

getWindowSizes()

Window Sizes

Returns infos about current window loaded in an array() : -> width : window's width -> height : window's height -> scrolx : window's scroll X position -> scroly : window's scroll Y position -> top : window's top position -> left : window's left position

Source:

hasClassName(element, string)

Check if the element "domobj" has class "clsname"

Parameters:
Name Type Description
element

domobj A DOM element node

string

clsname The class name to check

Source:
Returns:

bool True if the element has the class, false otherwise

href_goto()

Simulate a clic link href

Source:

in_array()

In array Pierre Cassat - 03_2009

Source:

initHandler()

Template Engine - PHP framework package Copyleft (c) 2013-2014 Pierre Cassat and contributors www.ateliers-pierrot.fr> - <contact@ateliers-pierrot.fr License GPL-3.0 http://www.opensource.org/licenses/gpl-3.0.html Sources http://github.com/atelierspierrot/templatengine

Default Page Scripts

Source:

is_defined(?, string)

<b>Is defined ?</b> Returns TRUE if 'str' is already defined (and optionnaly TRUE if it's defined as the 'type' you want)

Parameters:
Name Type Description
?

str The string you want to verify (can be a string or anything else)

string

type The type you want verify 'str' is | optional

Source:

is_url(string)

Verification of an URL

Parameters:
Name Type Description
string

url The url you want to verify

Source:
Returns:

bool TRUE if url is a valid url (ftp, http or https)

join(array, char, char)

Join all args of an array in a string

Parameters:
Name Type Description
array

array The array you want to serialize

char

sep_arg The separator of arguments | optional | default is '='

char

sep_arg The separator of items | optional | default is ';'

Source:

multiExtend()

Multi extend of an object

Source:
Returns:

object The original object with properties extended by each other argument

onDocumentLoad()

Execute a function after document is fully loaded

USAGE: onDocumentLoad(function() { my_func( some, arguments); etc ... });

Source:

opener_focus()

<b>Opener Focus</b>

Args : (all optionals except url) - openerwindow : window object to focus (default is window.opener) - openerurl : new URL to load in the focused window

Source:

Popup Set - Function to open a popup window.

Args : (all optionals except url) - url : page to open un popup - w : popup width | default is 380px - h : popup height | default is 230px - focus : bool | default is TRUE - options : popup window options, default : resizable=yes, toolbar=no, scrollbars=yes - name : popup name | default is described ahead

Source:

Registry()

Registry class

USAGE:

// classic set/get/isset usage: var reg = Registry(); reg.set('foo', 'bar'); reg.isset('foo'); // => true reg.get('foo'); // => 'bar' reg.isset('inexistant'); // => false reg.get('inexistant'); // => null

// unset usage: var reg2 = Registry(); reg2.set('foo', 'bar'); reg2.set('hello', 'world'); reg2.get('foo'); // => 'bar' reg2.get('hello'); // => 'world' reg2.unset('foo'); reg2.get('foo'); // => null reg2.get('hello'); // => 'world'

// clear usage: var reg3 = Registry(); reg3.set('foo', 'bar'); reg3.set('hello', 'world'); reg3.get('foo'); // => 'bar' reg3.get('hello'); // => 'world' reg3.clear(); reg3.get('foo'); // => null reg3.get('hello'); // => null

// retrieving a member name: var reg4 = Registry(); reg4.set('foo', 'bar'); reg4.getName('bar'); // => 'foo' reg4.getName('inexistant'); // => null

// multi-instances, different registries: var reg5 = Registry(); var reg6 = Registry(); reg5.set('foo', 'bar'); reg5.debug(); // => Object { 'foo': 'bar' } _reg6.debug(); // => Object {}

// the registry data are private: var reg7 = Registry(); reg7.set('foo', 'bar'); console.debug(reg7.data); // => undefined console.debug(reg7.dump()); // => { 'foo': 'bar' }

Source:

remove_collection_field(string)

Remove an item of a collection by its ID

Parameters:
Name Type Description
string

id The ID string of the collection item to remove | required

Source:

removeClassName(element, string)

Remove class "clsname" from element "domobj"

Parameters:
Name Type Description
element

domobj A DOM element node

string

clsname The class name to remove

Source:
Returns:

void

Select(str)

Get one or more DOM objects calling them with CSS selectors

Parameters:
Name Type Description
str

what A selection string written as CSS selectors

Source:
Returns:

The result can be a single element or a classic Array of elements

setCookie(str, str, date|int, str, str, bool)

Parameters:
Name Type Description
str

value The cookie value [1]

str

name The cookie name [2]

date|int

expires The cookie expiration date or number of seconds [3 ; optional]

str

path The cookie validity path [4 ; optional]

str

domain The cookie validity domain [5 ; optional]

bool

secure The cookie securisation [6 ; optional ; default is false]

Source:

show_hide()

Call of the "toggleShowHide" function with a return (for onclick usage for example) See "toggleShowHide()" for parameters

Source:

show_hide_init(array|object)

For accessibility : hidden blocks will be visibles if JS disabled

Options can be : - 'hideclass' (string) : the class used to hide a block - 'showclass' (string) : the class used to show a block - 'handlerhideclass' (string) : the class used on handler when a block is hidden - 'handlershowclass' (string) : the class used on handler when a block is shown - 'handlerhiddencontent' (string) : the content of a handler when a block is hidden - 'handlershowncontent' (string) : the content of a handler when a block is shown

Parameters:
Name Type Description
array|object

The options table

Source:

Slide()

Slide effect

Source:

TabContent()

Build a set of tabs from a list of handlers links toggling a list of tab contents.

Source:

toggleShowHide(string, string, array|object)

Show or hide the block with ID "id"

Options can be : - any of the settings values concerning the ShowHide tool (see above) - 'hashtag: true' (default false) : add or remove the handler ID as a hash in document location - 'togglehandlerclass: false' (default true) : toggle the handler block class if "handlerhideclass" and "handlershowclass" are defined in settings - 'togglehandlercontent: false' (default true) : toggle the handler block content if "handlerhiddencontent" and "handlershown_content" are defined in settings - 'display: str' : the default "display" CSS attribute

Parameters:
Name Type Description
string

id The ID string of the toggled block (required)

string

handler_id The ID string of the handler (optional)

array|object

options A set of options to override current ShowHide settings (optional)

Source:

TOOLTIP()

Build some tooltips on element with a specific class with the content of an element's attribute

Internal private variables are prefixed by '_tltp'

Source:

trigger_click()

Trigger a click on any link with 'element_id'

Source:

uniqid()

Returns a uniq ID base on current timestamp

Source: