Contains Utility functions
Valerio Proietti, http://mad4milk.net
MIT-style license.
| Utility.js | Contains Utility functions |
| Functions | |
| $chk | Returns true if the passed in value/object exists or is 0, otherwise returns false. |
| $pick | Returns the first object if defined, otherwise returns the second. |
| $random | Returns a random integer number between the two passed in values. |
| $clear | clears a timeout or an Interval. |
| window | Some properties are attached to the window object by the browser detection. |
function $chk( obj )
Returns true if the passed in value/object exists or is 0, otherwise returns false. Useful to accept zeroes.
function $random( min, max )
Returns a random integer number between the two passed in values.
| min | integer, the minimum value (inclusive). |
| max | integer, the maximum value (inclusive). |
a random integer between min and max.
function $clear( timer )
clears a timeout or an Interval.
null
| timer | the setInterval or setTimeout to clear. |
var myTimer = myFunction.delay(5000); //wait 5 seconds and execute my function.
myTimer = $clear(myTimer); //nevermind
Some properties are attached to the window object by the browser detection.
| window.ie | will be set to true if the current browser is internet explorer (any). |
| window.ie6 | will be set to true if the current browser is internet explorer 6. |
| window.ie7 | will be set to true if the current browser is internet explorer 7. |
| window.khtml | will be set to true if the current browser is Safari/Konqueror. |
| window.gecko | will be set to true if the current browser is Mozilla/Gecko. |
Returns true if the passed in value/object exists or is 0, otherwise returns false.
function $chk( obj )
Returns the first object if defined, otherwise returns the second.
function $pick( obj, picked )
Returns a random integer number between the two passed in values.
function $random( min, max )
clears a timeout or an Interval.
function $clear( timer )