Code functions | |
_IG_RegisterOnloadHandler(FUNCTION) | Call the FUNCTION function on the widget loading. example : function init(){ alert('hello world'); } _IG_RegisterOnloadHandler(init); |
_IG_AdjustIFrameHeight() | Adjust the widget height to the widget content. Use it if the widget's height change. |
_IG_FetchContent(URL, FUNCTION) | Load the content of a file defined by its URL and send the results to the FUNCTION function. Using of asynchronous Ajax. Example : function treatFile(responsetxt){ var obj=_gel("mydiv"); obj.innerHTML=responsetxt; } _IG_FetchContent('http://www.mysite.com/mydoc.csv',treatFile); |
_IG_FetchXmlContent(URL, FUNCTION) | Load the content of an XML file defined by its URL and send the results to the FUNCTION function. Using of asynchronous Ajax. Example : function treatXml(responsexml){ var str="name : "+responsexml.getElementsByTagName("name")[0].firstChild.nodeValue+" age : "+responsexml.getElementsByTagName("age")[0].firstChild.nodeValue; var obj=_gel("mydiv"); obj.innerHTML=str; } _IG_FetchXmlContent('http://www.mysite.com/myxmlfile.xml',treatXml); |
Function that use options | |
_IG_Prefs(__MODULE_ID__) | Send the options to an object. Example : var pref = new _IG_Prefs(__MODULE_ID__); |
.getString("variable") | Retrieve the value of a "string" option. Example : var name = pref.getString("yourname"); |
.getInt("variable") | Retrieve the integer value of a "string" option. |
.getBool("variable") | Retrieve the value of a "bool" option. |
.set("variable","value") | Modify the value of a specified option. Exemple : pref.set("yourname","John Wayne"); |
.open() | Open the options configuration box. Example : <A href=# onclick="return pref.open()">Modify the options</A> |
Tabs management | |
_IG_Tabs(__MODULE_ID__,"default selection") | Initialize tab management. Return tabs object, used to execute functions below. "default selection" is the name of the selected tab (optional). Example : var tabs = new _IG_Tabs(__MODULE_ID__); |
.tabsContainer | Optional. Define the object that will contain the tabs. Example : tabs.tabsContainer=_gel("tabsdiv"); (if you have created an object <div id="tabsdiv"></div>) |
.addTab("tabname","divid","function") | Create a new tab, with "tabname" name, inside "divid" div object, calling "function" function when clicked. Example : tabs.addTabs("tab 1","tabdiv","displayTab1Content"); |
.setSelectedTab("tabIndex") | Define the selected tab."tabIndex" is the index of the tab (start with 0). |
Other functions | |
_bringToFront(__MODULE_ID__) | Bring a widget to front, above the others. |
_gel("object") | Get the object which ID is "object". Example : var obj=_get("mydiv");obj.innerHTML='Hello world !'; |
_gelstn("object") | A wrapper around the javaScript .getElementsByTagName() method. |
_esc("string") | A wrapper around the javaScript .escape() method. |
_unesc("string") | A wrapper around the javaScript .unescape() method. |
_uc("string") | Return uppercase value of "string" string. |
_lc("string") | Return lowercase value of "string" string. |
_min(value1,value2) | Return the lesser value of value1 and value2. |
_max(value1,value2) | Return the greater value of value1 and value2. |
_args("string") | Transforms the string "name=john&age=12&sex=m" to the array {"name":"john","age":"12","sex":"m"} |
_trim("string") | Remove the useless whitespaces. |