Object: AJAX
Since: 1.1
Description:
A wrapper for AJAX functionalities. Refer to link below to get more information on this object:
JavaScript Manual: DLSupport.AJAX
Object: Browser
Since: 0.1
Description:
Contains browser information. Refer to link below to get more information on this object:
JavaScript Manual: DLSupport.Browser
Object: Form
Since: 1.1
Description:
Provides support for a form. Refer to link below to get more information on this object:
JavaScript Manual: DLSupport.Form
Property: ErrorLog
Since: 1.3
Returns:
Property: ModuleUrl
Since: 1.1
Returns:
Method: addErrorLog
Since: 1.3
Parameters:
Description:
Add an message to the error log.
Method: checkboxSelectAllToggle
Since: 1.1
Parameters:
Description:
Check or uncheck all input checkboxes with the same class name as the given target based on the current status of the given element.
Usage Examples:
<table>
<tr>
<td><input type="checkbox" onchange="javascript: DLSupport.checkboxSelectAllToggle(this, 'check_group');" /></td>
<td>Value</td>
</tr>
<tr>
<td><input type="checkbox" name="some_box[]" class="check_group" value="1" /></td>
<td>Some Value</td>
</tr>
<tr>
<td><input type="checkbox" name="some_box[]" class="check_group" value="2" /></td>
<td>Another Value</td>
</tr>
<tr>
<td><input type="checkbox" name="some_box[]" class="check_group" value="3" /></td>
<td>You got it, another value</td>
</tr>
</table>
Method: cloneArray
Since: 1.1
Parameters:
Returns:
Description:
Create a copy of the given array.
Usage Examples:
var myarray = [1, 2, 3, 4]; var clonedarray = DLSupport.cloneArray(myarray); clonedarray.pop(); window.alert(myarray[myarray.length-1]); // -> 4 window.alert(clonedarray[clonedarray.length-1]); // -> 3
Method: combineArray
Since: 1.1
Updated: 1.3
Parameters:
Returns:
Description:
Create an associative array (object) by using the first given array as the keys and the second given array as the value. It is required that both arrays be of the same length. As of version 1.3, extra validation has been added so that no null objects will be a member of the resulting array.
Usuage Examples:
var keys = ['first_name', 'last_name', 'age']; var values = ['Tim', 'Johnson', '10']; var person = DLSupport.combineArray(keys, values); document.write(person.first_name + ' ' + person.last_name + ': ' + person.age); // -> Tim Johnson: 10
Method: curry
Since: 0.1
Updated: 1.1, 1.3
Parameters:
Returns:
Description:
Currify the given function. With the release of version 1.1, the closure problem of this method has been fixed. As of 1.3, the function is returned directly instead of being assigned to a variable and then returned.
Usuage Examples:
<script type="text/javascript">
// some random function
function init(element, newId) {
element.id = newId;
}
var myelement = document.getElementById('some_id');
var curried_function = DLSupport.curry(init, window, myelement, 'new_id');
window.onload = curried_function;
</script>
Method: defaultValues
Since: 1.1
Updated: 1.3
Parameters:
Returns:
Description:
Using the given base values object, copy values from the source object if they have the same property name. As of 1.3, some of the data is used directly instead of being copied to a variable and then used to improve performance.
method: delayFunction
Since: 1.1
Updated: 1.3
Parameters:
Description:
Delay the execution of the given function by the given number of seconds. As of 1.3, this function will not use window.setTimeout if the given delay is 0.
Method: hideLoadingImage
Since: 1.1
Description:
Hide the loading image.
Method: humanReadable
Since: 1.3
Parameters:
Returns:
Description:
Retrieves the given data into human readable format. Credits goes to Michael White & Ben Bryan.
Method: inArray
Since: 1.1
Updated: 1.3
Parameters:
Returns:
Description:
Find out whether or not the given item is in the given array. As of 1.3, some of the data are used directly instead of being set to a variable and then used.
Usuage Examples:
var data = ['1.0', '2.0', '3.0', '4.0']; window.alert(DLSupport.inArray(1, data, false)); // -> true window.alert(DLSupport.inArray(1.0, data, false)); // -> true window.alert(DLSupport.inArray(1.0, data)); // -> false
Method: isArray
Since: 1.1
Parameters:
Returns:
Description:
Determine whether or not the given item is an array.
Usuage Examples:
var myarray = [];
var mysecondarray = new Array();
var myobject = {};
window.alert(DLSupport.isArray(myarray));
// -> true
window.alert(DLSupport.isArray(mysecondarray));
// -> true
window.alert(DLSupport.isArray(myobject));
// -> false
Method: isNumeric
Since: 1.1
Parameters:
Returns:
Description:
Determine whether or not the given item is numeric.
Usuage Examples:
var myarray = []; var mynumber = 1.3; var mystringnumber = '-1.34'; window.alert(DLSupport.isNumeric(myarray)); // -> false window.alert(DLSupport.isNumeric(mynumber)); // -> true window.alert(DLSupport.isNumeric(mystringnumber)); // -> true
Method: newEvent
Since: 1.3
Parameters:
Returns:
Description:
Attach a new event to the given element.
Method: propertyNames
Since: 1.1
Parameters:
Returns:
Description:
Get the property names of the given object.
Usuage Examples:
var myobject = {
first_name: 'Alex',
last_name: 'Tanz',
age: 23
};
var property_names = DLSupport.propertyNames(myobject);
// -> ['first_name', 'last_name', 'age'];
Method: removeElement
Since: 0.1
Updated: 1.3
Parameters:
Returns:
Description:
This will remove the given element from the DOM structure of the web site. Be careful when using this method because it is a mutation of the DOM structure. Removing the given element will also remove all of its children. AS of 1.3, the return value was added.
Usuage Examples:
<script type="text/javascript">
var element_to_remove = document.getElementById('hidden_div');
DLSupport.removeElement(element_to_remove);
</script>
Method: reverseArray
Since: 1.1
Parameters:
Returns:
Description:
Get the array that has the reverse order of the given array. This differs from the pre-defined reverse array function in that this can be set to be done recursively.
Usuage Examples:
var myarray = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; var reverse_normal = DLSupport.reverseArray(myarray); // -> [[7, 8, 9], [4, 5, 6], [1, 2, 3]]; var reverse_recur = DLSupport.reverseArray(myarray, true); // -> [[9, 8, 7], [6, 5, 4], [3, 2, 1]];
Method: showLoadingImage
Since: 1.1
Parameters:
Description:
Fade out the entire page and show the loading image. Note that this function should only be called after the page has finished loading.
Method: toggleDisplay
Since: 1.1
Parameters:
Description:
Toggle the display of the given DOM element. If it is currently is hidden, then show it. If it is currently visibile, then hdie it.
Method: toQueryString
Since: 1.1
Parameters:
Returns:
Description:
Convert the given object to a query string.
Method: uniqueArray
Since: 1.1
Parameters:
Returns:
Description:
Get the array that has only the unique values of the given array.
Usuage Examples:
var myarray = [1, 2, 3, 4, 4, 5, 6, 7, 7, 7, 8, 9]; var myuniquearray = DLSupport.uniqueArray(myarray); // -> [1, 2, 3, 4, 5, 6, 7, 8, 9];
Method: windowOnload
Since: 0.1
Updated: 1.1, 1.3
Parameters:
Returns:
Description:
This will add a new event to the event listener that will run the given function after the window has finish loading (basically when all of the DOM structure has finish loading). Since this is adding to the list, you do not have to worry about overwriting someone else's events or theirs overwriting yours. The second parameter can futher delay the execution so you can pretty much sort the order of the execution of the function. It also allows you to wait for other javascript functions to finish running before yours can go. At worse case, it uses window.setTimeout. As of 1.1, the closure problem of this method has been fixed. AS of 1.3, this method makes use of the new method "newEvent". The return value was also added.
Usuage Examples:
<script type="text/javascript">
// Function to run after DOM is loaded
function init() {
... do something ...
}
// Function to run 3 seconds after DOM is loaded
function init2() {
... do something ...
}
DLSupport.windowOnload(init);
DLSupport.winodwOnload(init2, 3);
</script>