2011-06-14 12:48:24 -04:00
|
|
|
# Keep It Simple JS Library #
|
|
|
|
|
|
|
|
A Minimal, Modular Javascript library for Modern browsers.
|
|
|
|
|
|
|
|
Aims to be fast, small, and easily split into individual modules.
|
|
|
|
|
|
|
|
Browser support: IE8+, Latest versions of Firefox, Chrome, Safari, Opera
|
|
|
|
|
|
|
|
## Basic Use: ##
|
|
|
|
|
2011-06-14 12:59:38 -04:00
|
|
|
* Selector: `var x = $(selector);`
|
2011-06-14 12:48:24 -04:00
|
|
|
|
2011-06-14 12:59:38 -04:00
|
|
|
* Function: `$_.module.function(params);`
|
2011-06-14 12:48:24 -04:00
|
|
|
|
|
|
|
## Modules: ##
|
|
|
|
|
|
|
|
**Ajax**: simple, jQuery-like ajax functions
|
|
|
|
|
|
|
|
functions:
|
|
|
|
|
2011-06-16 12:19:47 -04:00
|
|
|
* Get:
|
|
|
|
Use:
|
|
|
|
$_.get(url, data_object, callback);
|
|
|
|
|
|
|
|
* Post:
|
|
|
|
Use:
|
|
|
|
$_.post(url, data_object, callback);
|
2011-06-14 12:48:24 -04:00
|
|
|
|
|
|
|
**QS**: querystring parsing and serialization for hashbang strings, and pushState urls
|
|
|
|
|
|
|
|
functions:
|
|
|
|
|
|
|
|
* Parse:
|
2011-06-14 12:54:47 -04:00
|
|
|
Use:
|
|
|
|
$_.qs.parse(hb);
|
2011-06-14 12:48:24 -04:00
|
|
|
|
|
|
|
* Set: This function will set the hash url if browser doesn't have history.pushState
|
2011-06-14 12:54:47 -04:00
|
|
|
Use:
|
|
|
|
$_.qs.set(key, value);
|
2011-06-14 12:48:24 -04:00
|
|
|
|
|
|
|
* Get: Retrieves the value of the key in the url string
|
2011-06-14 12:54:47 -04:00
|
|
|
Use:
|
|
|
|
$_.qs.get(key);
|
2011-06-14 12:59:38 -04:00
|
|
|
|
|
|
|
**Store**: localstorage wrapper with automatic data serialization
|
|
|
|
|
2011-06-15 08:33:16 -04:00
|
|
|
functions:
|
2011-06-14 12:59:38 -04:00
|
|
|
|
|
|
|
* Get:
|
|
|
|
Use:
|
|
|
|
$_.store.get(key);
|
|
|
|
|
|
|
|
* Set
|
|
|
|
Use:
|
|
|
|
$_.store.set(key, value);
|
|
|
|
|
|
|
|
* getALL: Retreives all localstorage data in raw form
|
|
|
|
Use:
|
|
|
|
$_.store.getAll();
|
2011-06-15 08:33:16 -04:00
|
|
|
|
|
|
|
|
|
|
|
**Event**: wrapper for applying events to DOM objects
|
|
|
|
|
2011-06-21 10:43:31 -04:00
|
|
|
functions:
|
2011-06-15 08:33:16 -04:00
|
|
|
|
|
|
|
*Add:
|
|
|
|
Use:
|
|
|
|
$_.event.add(selector, event, callback);
|
|
|
|
|
|
|
|
*Remove
|
|
|
|
Use:
|
|
|
|
$_.event.remove(selector, event, callback);
|
2011-06-21 10:43:31 -04:00
|
|
|
|
|
|
|
**DOM**: Dom manipulation module
|
|
|
|
|
|
|
|
function:
|
|
|
|
|
|
|
|
*addClass:
|
|
|
|
Use:
|
|
|
|
$_.dom.addClass(selector, className);
|
|
|
|
|
|
|
|
*RemoveClass:
|
|
|
|
Use:
|
|
|
|
$_.dom.removeClass(selector, className);
|
2011-06-14 12:48:24 -04:00
|
|
|
|
2011-06-21 13:33:03 -04:00
|
|
|
*each: For applying changes to every item matched by a selector
|
|
|
|
Use:
|
2011-06-23 13:16:02 -04:00
|
|
|
$_.dom.each(selector, callback);
|
2011-06-21 13:33:03 -04:00
|
|
|
|
|
|
|
*show: For setting dom elements as visible. Type defaults as "block", can be set with optional second parameter.
|
|
|
|
Use:
|
2011-06-23 13:16:02 -04:00
|
|
|
$_.dom.show(selector, [type]);
|
2011-06-21 13:33:03 -04:00
|
|
|
|
|
|
|
*hide: Hides the elements matching the selector
|
|
|
|
Use:
|
2011-06-23 13:16:02 -04:00
|
|
|
$_.dom.hide(selector);
|
|
|
|
|
|
|
|
#attr: Gets, sets, or removes an attribute from a selector.
|
|
|
|
Use:
|
|
|
|
Set: $_.dom.attr(selector, attributeName, attributeValue);
|
|
|
|
Get: $_.dom.attr(selector, attributeName);
|
|
|
|
Remove: $_.dom.attr(selector, attributeName, null);
|
2011-06-14 12:48:24 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|