From 905f9431f3a0f2959a7c1b7c6cc2d0561dfd45f4 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 3 Nov 2011 16:04:35 -0400 Subject: [PATCH] Various fixes --- README.md | 121 +--- docs/files.html | 23 +- docs/index.html | 23 +- docs/symbols/$_.dom.html | 83 +-- docs/symbols/$_.event.html | 95 +-- docs/symbols/$_.html | 105 +-- docs/symbols/$_.store.html | 89 ++- docs/symbols/$_.util.html | 31 +- docs/symbols/_global_.html | 23 +- docs/symbols/src/kis-js_src_core.js.html | 272 ++++---- docs/symbols/src/kis-js_src_core_core.js.html | 236 ------- .../src/kis-js_src_modules_DOM.js.html | 640 +++++++++--------- .../src/kis-js_src_modules_ajax.js.html | 40 +- .../src/kis-js_src_modules_event.js.html | 136 ++-- .../src/kis-js_src_modules_store.js.html | 207 +++--- .../src/kis-js_src_modules_util.js.html | 4 +- kis-all.js | 441 ++++++------ kis-min.js | 13 +- src/core.js | 6 +- src/modules/DOM.js | 18 +- src/modules/ajax.js | 2 - src/modules/event.js | 24 +- src/modules/store.js | 31 +- src/modules/util.js | 4 +- src/polyfill.js | 355 +++++----- tests/index.html | 44 +- 26 files changed, 1320 insertions(+), 1746 deletions(-) delete mode 100755 docs/symbols/src/kis-js_src_core_core.js.html mode change 100755 => 100644 docs/symbols/src/kis-js_src_modules_DOM.js.html mode change 100755 => 100644 docs/symbols/src/kis-js_src_modules_ajax.js.html mode change 100755 => 100644 docs/symbols/src/kis-js_src_modules_event.js.html mode change 100755 => 100644 docs/symbols/src/kis-js_src_modules_store.js.html mode change 100755 => 100644 docs/symbols/src/kis-js_src_modules_util.js.html diff --git a/README.md b/README.md index f31c770..68e9703 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,7 @@ Browser support: IE8+, Latest versions of Firefox, Chrome, Safari, Opera * Function: `$_(selector).module.function(params);` -## Official Modules: ## -### Global: Core functions ### +### Core Methods ### **properties:** @@ -48,126 +47,12 @@ Browser support: IE8+, Latest versions of Firefox, Chrome, Safari, Opera * type: For getting the type of a variable $_.type(var); - -### Ajax: simple, jQuery-like ajax functions ### -functions: - -* Get: - - $_.get(url, data_object, callback); +Have a look at the /docs folder included with the library for documentation on the included modules. The development version of the documentation is avaliable at -* Post: +[[http://dev.timshomepage.net/kis-js/docs/]](http://dev.timshomepage.net/kis-js/docs/) - $_.post(url, data_object, callback); - - -### Store: localstorage wrapper with automatic data serialization ### - -**functions:** - -* Get: - - $_.store.get(key); - -* Set - - $_.store.set(key, value); - -* Remove - - $_.store.remove(key); - -* getALL: Retreives all localstorage data in raw form - - $_.store.getAll(); - - -### Event: wrapper for applying events to DOM objects ### - -**functions:** - -* Add: - - $_(selector).event.add(event, callback); - -* Remove - - $_(selector).event.remove(event, callback); - -* Live: (for elements that are dynamically added and removed) - - $_.event.live(selector, event, callback); - -* Delegate: - - $_(selector).delegate(target, event, callback); - -### DOM: Dom manipulation module ### - -**functions:** - -* addClass: - - $_(selector).dom.addClass(className); - -* RemoveClass: - - $_(selector).dom.removeClass(className); - -* show: For setting dom elements as visible. Type defaults as "block", can be set with optional second parameter. - - $_(selector).dom.show([type]); - -* hide: Hides the elements matching the selector - - $_(selector).dom.hide(); - -* attr: Gets, sets, or removes an attribute from a selector. - - Set: $_(selector).dom.attr(attributeName, attributeValue); - Get: $_(selector).dom.attr(attributeName); - Remove: $_(selector).dom.attr(attributeName, null); - -* text: Gets or sets the text in between an element's tags - - Set: $_(selector).dom.text(text); - Get: $_(selector).dom.text(); - -* css: Sets css styles on the selected element(s) - - Set: $_(selector).dom.css(property, value); - Get: $_(selector).dom.css(property); - -* html: Sets or gets html inside the selected element - - Set: $_(selector).dom.html(html_string); - Get: $_(selector).dom.html(); - -### Util: Array and string manipulation functions ### - -**functions:** - -* object_keys: Gets the name of the properties of an object - - $_.util.object_keys(object); - -* object_values: Gets the values of the top-level members of an object - - $_.util.object_values(object); - -* object_merge: Merges two objects' keys and values - - $_.util.object_merge(object1, object2); - -* array_combine: Creates an object with the keys of the first array, and the values of the second - - $_.util.array_combine(keys, values); - -* str_trans: Similar to the PHP function strtr, replaces string pairs in a GREEDY fashion - - $_.util.str_trans(string, from, to); OR $_.util.str_trans(string, replace_pairs_object); diff --git a/docs/files.html b/docs/files.html index d5e631b..5331e92 100644 --- a/docs/files.html +++ b/docs/files.html @@ -1,5 +1,6 @@ - - + + @@ -29,23 +30,23 @@
-
 
$_
$(string, string)
ext(string, object)
each(function)
type(mixed)
get(string, object, function)
post(string, object, function)
+
 
$_
$(string, object)
ext(string, object)
each(function)
type(mixed)
get(string, object, function)
post(string, object, function)
addClass(string)
removeClass(string)
show(string)
attr(string, string)
text(string)
css(string, string)
html(string)
-
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string)
+
+
 
$_.event
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string, function)
-
get(string, bool)
set(string, mixed, bool)
remove(string, bool)
clear(bool)
+
+
 
$_.store
get(string, bool)
set(string, mixed, bool)
remove(string, bool)
getAll(bool)
clear(bool)
-
 
$_.util
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
+
 
$_.util
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
@@ -60,7 +61,7 @@
«
- Kis JS Documentation + Kis JS Docs
@@ -130,6 +131,10 @@
+
+ ©2011
+ Documentation generated by JsDoc Toolkit 2.4.0 on Thu Nov 03 2011 16:01:49 GMT-0400 (EDT) +
diff --git a/docs/index.html b/docs/index.html index e04b915..c9d9319 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,5 +1,6 @@ - - + + @@ -61,23 +62,23 @@
-
 
$_
$(string, string)
ext(string, object)
each(function)
type(mixed)
get(string, object, function)
post(string, object, function)
+
 
$_
$(string, object)
ext(string, object)
each(function)
type(mixed)
get(string, object, function)
post(string, object, function)
addClass(string)
removeClass(string)
show(string)
attr(string, string)
text(string)
css(string, string)
html(string)
-
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string)
+
+
 
$_.event
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string, function)
-
get(string, bool)
set(string, mixed, bool)
remove(string, bool)
clear(bool)
+
+
 
$_.store
get(string, bool)
set(string, mixed, bool)
remove(string, bool)
getAll(bool)
clear(bool)
-
 
$_.util
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
+
 
$_.util
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
@@ -92,7 +93,7 @@
«
- Kis JS Documentation + Kis JS Docs
@@ -144,6 +145,10 @@
+
+ ©2011
+ Documentation generated by JsDoc Toolkit 2.4.0 on Thu Nov 03 2011 16:01:49 GMT-0400 (EDT) +
diff --git a/docs/symbols/$_.dom.html b/docs/symbols/$_.dom.html index d25fd3b..7ae6912 100644 --- a/docs/symbols/$_.dom.html +++ b/docs/symbols/$_.dom.html @@ -1,5 +1,6 @@ - - + + @@ -32,23 +33,23 @@
-
 
$_
$(string, string)
ext(string, object)
each(function)
type(mixed)
get(string, object, function)
post(string, object, function)
+
 
$_
$(string, object)
ext(string, object)
each(function)
type(mixed)
get(string, object, function)
post(string, object, function)
addClass(string)
removeClass(string)
show(string)
attr(string, string)
text(string)
css(string, string)
html(string)
-
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string)
+
+
 
$_.event
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string, function)
-
get(string, bool)
set(string, mixed, bool)
remove(string, bool)
clear(bool)
+
+
 
$_.store
get(string, bool)
set(string, mixed, bool)
remove(string, bool)
getAll(bool)
clear(bool)
-
 
$_.util
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
+
 
$_.util
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
@@ -65,7 +66,7 @@
- Kis JS Documentation + Kis JS Docs
@@ -224,20 +225,6 @@ selector -
Returns:
- - - - - - - -
- - - void -
- @@ -283,20 +270,6 @@ selector -
Returns:
- - - - - - - -
- - - void -
- @@ -324,20 +297,6 @@ selector -
Returns:
- - - - - - - -
- - - void -
- @@ -385,20 +344,6 @@ specified, the element is set to "display:block". -
Returns:
- - - - - - - -
- - - void -
- @@ -445,7 +390,7 @@ current selector. - string + string?, Default: value @@ -638,7 +583,7 @@ on the current element - string + string?, Default: htm @@ -677,6 +622,10 @@ on the current element
+
+ ©2011

+ Documentation generated by JsDoc Toolkit 2.4.0 on Thu Nov 03 2011 16:01:49 GMT-0400 (EDT) +
diff --git a/docs/symbols/$_.event.html b/docs/symbols/$_.event.html index 75f8e4c..dc62e66 100644 --- a/docs/symbols/$_.event.html +++ b/docs/symbols/$_.event.html @@ -1,5 +1,6 @@ - - + + @@ -32,23 +33,23 @@
-
 
$_
$(string, string)
ext(string, object)
each(function)
type(mixed)
get(string, object, function)
post(string, object, function)
+
 
$_
$(string, object)
ext(string, object)
each(function)
type(mixed)
get(string, object, function)
post(string, object, function)
addClass(string)
removeClass(string)
show(string)
attr(string, string)
text(string)
css(string, string)
html(string)
-
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string)
+
+
 
$_.event
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string, function)
-
get(string, bool)
set(string, mixed, bool)
remove(string, bool)
clear(bool)
+
+
 
$_.store
get(string, bool)
set(string, mixed, bool)
remove(string, bool)
getAll(bool)
clear(bool)
-
 
$_.util
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
+
 
$_.util
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
@@ -65,7 +66,7 @@
- Kis JS Documentation + Kis JS Docs
@@ -121,15 +122,15 @@ - live(string, string, function) - Binds a persistent, delegated event + live(string, string, function) + Binds a persistent event to the document
- delegate(string, string) + delegate(string, string, function) Binds an event to a parent object
@@ -204,20 +205,6 @@ event and selector -
Returns:
- - - - - - - -
- - - void -
- @@ -274,20 +261,6 @@ event and selector -
Returns:
- - - - - - - -
- - - void -
- @@ -301,7 +274,7 @@ event and selector
- Binds a persistent, delegated event + Binds a persistent event to the document @@ -356,20 +329,6 @@ event and selector -
Returns:
- - - - - - - -
- - - void -
- @@ -379,7 +338,7 @@ event and selector
- $_.event.delegate(string, string) + $_.event.delegate(string, string, function)
@@ -420,21 +379,15 @@ event and selector - - - - - - -
Returns:
- - + @@ -442,6 +395,10 @@ event and selector + + + + @@ -452,6 +409,10 @@ event and selector +
+ ©2011

+ Documentation generated by JsDoc Toolkit 2.4.0 on Thu Nov 03 2011 16:01:49 GMT-0400 (EDT) +
diff --git a/docs/symbols/$_.html b/docs/symbols/$_.html index 65bf9a7..06ffdfa 100644 --- a/docs/symbols/$_.html +++ b/docs/symbols/$_.html @@ -1,5 +1,6 @@ - - + + @@ -32,23 +33,23 @@
-
 
$_
$(string, string)
ext(string, object)
each(function)
type(mixed)
get(string, object, function)
post(string, object, function)
+
 
$_
$(string, object)
ext(string, object)
each(function)
type(mixed)
get(string, object, function)
post(string, object, function)
addClass(string)
removeClass(string)
show(string)
attr(string, string)
text(string)
css(string, string)
html(string)
-
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string)
+
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string, function)
-
get(string, bool)
set(string, mixed, bool)
remove(string, bool)
clear(bool)
+
get(string, bool)
set(string, mixed, bool)
remove(string, bool)
getAll(bool)
clear(bool)
-
 
$_.util
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
+
 
$_.util
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
@@ -65,7 +66,7 @@
- Kis JS Documentation + Kis JS Docs
@@ -110,8 +111,8 @@ - store - Wrapper for localstorage / sessionstorage data serialization + store + Wrapper for localstorage / sessionstorage data serialization.
@@ -126,8 +127,8 @@ - event - + event + Event Listener module
@@ -147,8 +148,8 @@ - $(string, string) - $ Simple DOM selector function + $(string, object) + Simple DOM selector function
@@ -244,7 +245,9 @@ Dom manipulation module
- Wrapper for localstorage / sessionstorage data serialization + Wrapper for localstorage / sessionstorage data serialization. +Each method has a boolean parameter, that when set as true switches the method +to use sessionStorage rather than the default localStorage.

Defined in: store.js.

@@ -298,7 +301,7 @@ Dom manipulation module
- + Event Listener module

Defined in: event.js.

@@ -333,13 +336,11 @@ Dom manipulation module
- $_.$(string, string) + $_.$(string, object) : object
- $ - -Simple DOM selector function + Simple DOM selector function @@ -369,7 +370,7 @@ Simple DOM selector function
@@ -468,7 +469,7 @@ from => to replacements as key/value pairs string?, Default: @@ -504,6 +505,10 @@ from => to replacements as key/value pairs +
+ ©2011

+ Documentation generated by JsDoc Toolkit 2.4.0 on Thu Nov 03 2011 16:01:49 GMT-0400 (EDT) +
diff --git a/docs/symbols/_global_.html b/docs/symbols/_global_.html index 2ec1c96..2fb2446 100644 --- a/docs/symbols/_global_.html +++ b/docs/symbols/_global_.html @@ -1,5 +1,6 @@ - - + + @@ -32,23 +33,23 @@
-
 
$_
$(string, string)
ext(string, object)
each(function)
type(mixed)
get(string, object, function)
post(string, object, function)
+
 
$_
$(string, object)
ext(string, object)
each(function)
type(mixed)
get(string, object, function)
post(string, object, function)
addClass(string)
removeClass(string)
show(string)
attr(string, string)
text(string)
css(string, string)
html(string)
-
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string)
+
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string, function)
-
get(string, bool)
set(string, mixed, bool)
remove(string, bool)
clear(bool)
+
get(string, bool)
set(string, mixed, bool)
remove(string, bool)
getAll(bool)
clear(bool)
-
 
$_.util
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
+
 
$_.util
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
@@ -65,7 +66,7 @@
- Kis JS Documentation + Kis JS Docs
@@ -106,6 +107,10 @@
+
+ ©2011

+ Documentation generated by JsDoc Toolkit 2.4.0 on Thu Nov 03 2011 16:01:49 GMT-0400 (EDT) +
diff --git a/docs/symbols/src/kis-js_src_core.js.html b/docs/symbols/src/kis-js_src_core.js.html index bb1b374..8a3ead3 100644 --- a/docs/symbols/src/kis-js_src_core.js.html +++ b/docs/symbols/src/kis-js_src_core.js.html @@ -75,147 +75,143 @@ 68 }; 69 70 /** - 71 * $ + 71 * Simple DOM selector function 72 * - 73 * Simple DOM selector function - 74 * - 75 * @memberOf $_ - 76 * @param string selector - 77 * @param string context - 78 * @return object - 79 * @type object - 80 */ - 81 $ = function (a, context) - 82 { - 83 var x, c; + 73 * @memberOf $_ + 74 * @param string selector + 75 * @param object context + 76 * @return object + 77 * @type object + 78 */ + 79 $ = function (a, context) + 80 { + 81 var x, c; + 82 + 83 if (typeof a != "string" || typeof a === "undefined"){ return a;} 84 - 85 if (typeof a != "string" || typeof a === "undefined"){ return a;} - 86 - 87 //Check for a context of a specific element, otherwise, just run on the document - 88 c = (context != null && context.nodeType === 1) - 89 ? context - 90 : document; - 91 - 92 //Pick the quickest method for each kind of selector - 93 if (a.match(/^#([\w\-]+$)/)) - 94 { - 95 return document.getElementById(a.split('#')[1]); - 96 } - 97 else - 98 { - 99 x = c.querySelectorAll(a); -100 } -101 -102 //Return the single object if applicable -103 return (x.length === 1) ? x[0] : x; -104 }; -105 -106 /** -107 * Deep copy/prototypical constructor function -108 * -109 * @param object obj -110 * @private -111 * @return object -112 * @type object -113 */ -114 dcopy = function(obj) -115 { -116 var type, F; -117 -118 if(typeof obj === "undefined") -119 { -120 return; -121 } -122 -123 if(typeof Object.create !== "undefined") -124 { -125 return Object.create(obj); -126 } + 85 //Check for a context of a specific element, otherwise, just run on the document + 86 c = (context != null && context.nodeType === 1) + 87 ? context + 88 : document; + 89 + 90 //Pick the quickest method for each kind of selector + 91 if (a.match(/^#([\w\-]+$)/)) + 92 { + 93 return document.getElementById(a.split('#')[1]); + 94 } + 95 else + 96 { + 97 x = c.querySelectorAll(a); + 98 } + 99 +100 //Return the single object if applicable +101 return (x.length === 1) ? x[0] : x; +102 }; +103 +104 /** +105 * Deep copy/prototypical constructor function +106 * +107 * @param object obj +108 * @private +109 * @return object +110 * @type object +111 */ +112 dcopy = function(obj) +113 { +114 var type, F; +115 +116 if(typeof obj === "undefined") +117 { +118 return; +119 } +120 +121 if(typeof Object.create !== "undefined") +122 { +123 return Object.create(obj); +124 } +125 +126 type = typeof obj; 127 -128 type = typeof obj; -129 -130 if(type !== "object" && type !== "function") -131 { -132 return; -133 } -134 -135 /** -136 * @private -137 */ -138 F = function(){}; +128 if(type !== "object" && type !== "function") +129 { +130 return; +131 } +132 +133 /** +134 * @private +135 */ +136 F = function(){}; +137 +138 F.prototype = obj; 139 -140 F.prototype = obj; +140 return new F(); 141 -142 return new F(); -143 -144 }; -145 -146 /** -147 * Adds the property `obj` to the $_ object, calling it `name` -148 * -149 * @param string name -150 * @param object obj -151 * @return void -152 */ -153 $_.ext = function(name, obj) -154 { -155 obj.el = sel; -156 $_[name] = obj; -157 }; -158 -159 /** -160 * Iterates over a $_ object, applying a callback to each item -161 * -162 * @name $_.each -163 * @function -164 * @param function callback -165 * @return void -166 */ -167 $_.ext('each', function (callback) -168 { -169 if(typeof sel.length !== "undefined" && sel !== window) -170 { -171 var len = sel.length; -172 -173 if (len === 0) -174 { -175 return; -176 } -177 -178 var selx; -179 for (var x = 0; x < len; x++) -180 { -181 selx = (sel.item(x)) ? sel.item(x) : sel[x]; -182 callback.call(selx, selx); -183 } +142 }; +143 +144 /** +145 * Adds the property `obj` to the $_ object, calling it `name` +146 * +147 * @param string name +148 * @param object obj +149 */ +150 $_.ext = function(name, obj) +151 { +152 obj.el = sel; +153 $_[name] = obj; +154 }; +155 +156 /** +157 * Iterates over a $_ object, applying a callback to each item +158 * +159 * @name $_.each +160 * @function +161 * @param function callback +162 */ +163 $_.ext('each', function (callback) +164 { +165 if(typeof sel.length !== "undefined" && sel !== window) +166 { +167 var len = sel.length; +168 +169 if (len === 0) +170 { +171 return; +172 } +173 +174 var selx; +175 for (var x = 0; x < len; x++) +176 { +177 selx = (sel.item(x)) ? sel.item(x) : sel[x]; +178 callback.call(selx, selx); +179 } +180 } +181 else +182 { +183 callback.call(sel, sel); 184 } -185 else -186 { -187 callback.call(sel, sel); -188 } -189 }); -190 -191 /** -192 * Retrieves the type of the passed variable -193 * -194 * @param mixed obj -195 * @return string -196 * @type string -197 */ -198 $_.type = function(obj) -199 { -200 if((function() {return obj && (obj !== this)}).call(obj)) -201 { -202 //fallback on 'typeof' for truthy primitive values -203 return (typeof obj).toLowerCase(); -204 } -205 -206 //Strip x from [object x] and return -207 return ({}).toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase(); -208 }; -209 -210 //Set global variables -211 $_ = window.$_ = window.$_ || $_; -212 $_.$ = $; -213 -214 }()); \ No newline at end of file +185 }); +186 +187 /** +188 * Retrieves the type of the passed variable +189 * +190 * @param mixed obj +191 * @return string +192 * @type string +193 */ +194 $_.type = function(obj) +195 { +196 if((function() {return obj && (obj !== this)}).call(obj)) +197 { +198 //fallback on 'typeof' for truthy primitive values +199 return (typeof obj).toLowerCase(); +200 } +201 +202 //Strip x from [object x] and return +203 return ({}).toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase(); +204 }; +205 +206 //Set global variables +207 $_ = window.$_ = window.$_ || $_; +208 $_.$ = $; +209 +210 }()); \ No newline at end of file diff --git a/docs/symbols/src/kis-js_src_core_core.js.html b/docs/symbols/src/kis-js_src_core_core.js.html deleted file mode 100755 index 48d4af8..0000000 --- a/docs/symbols/src/kis-js_src_core_core.js.html +++ /dev/null @@ -1,236 +0,0 @@ -
  1 /**
-  2 	Kis JS		Keep It Simple JS Library
-  3 	Copyright	Timothy J. Warren
-  4 	License		Public Domain
-  5 	Version		0.5.0-pre
-  6  */
-  7 (function (){
-  8 
-  9 	"use strict";
- 10 
- 11 	//Browser requirements check
- 12 	if (!document.querySelectorAll)
- 13 	{
- 14 		return;
- 15 	}
- 16 
- 17 	var $_, $, dcopy, sel, sel_string;
- 18 	
- 19 
- 20 	/**
- 21 	 * $_
- 22 	 *
- 23 	 * Constructor function
- 24 	 *
- 25 	 * @constuctor
- 26 	 * @namespace
- 27 	 * @param string selector
- 28 	 * @return object
- 29 	 */
- 30 	$_ = function(s)
- 31 	{
- 32 		//Have documentElement be default selector, just in case
- 33 		if(typeof s === "undefined")
- 34 		{
- 35 			//Defines a "global" selector for that instance
- 36 			sel = (typeof $_.el !== "undefined") 
- 37 				? $_.el
- 38 				: document.documentElement;
- 39 		}
- 40 		else
- 41 		{
- 42 			sel = (typeof s !== "object") ? $(s) : s;
- 43 		}
- 44 		
- 45 		// Add the selector to the prototype
- 46 		$_.prototype.el = sel;
- 47 
- 48 		// Make a copy before adding properties
- 49 		var self = dcopy($_);
- 50 
- 51 		// Give sel to each extension.
- 52 		for(var i in self) 
- 53 		{
- 54 			if(typeof self[i] === "object")
- 55 			{
- 56 				self[i].el = sel;
- 57 			}	
- 58 		}
- 59 
- 60 		self.el = sel;
- 61 	
- 62 		return self;
- 63 	};
- 64 	
- 65 	/**
- 66 	 * $
- 67 	 *
- 68 	 * Simple DOM selector function
- 69 	 *
- 70 	 * @memberOf $_
- 71 	 * @param string selector
- 72 	 * @param string context
- 73 	 * @return object
- 74 	 * @type object
- 75 	 */
- 76 	$ = function (a, context)
- 77 	{
- 78 		var x, c;
- 79 		
- 80 		if (typeof a != "string" || typeof a === "undefined"){ return a;}
- 81 		
- 82 		//Check for a context of a specific element, otherwise, just run on the document
- 83 		c  = (context != null && context.nodeType === 1) 
- 84 			? context 
- 85 			: document;
- 86 		
- 87 		//Pick the quickest method for each kind of selector
- 88 		if (a.match(/^#([\w\-]+$)/))
- 89 		{
- 90 			return document.getElementById(a.split('#')[1]);
- 91 		}
- 92 		else
- 93 		{
- 94 			x = c.querySelectorAll(a);
- 95 		}
- 96 		
- 97 		//Return the single object if applicable
- 98 		return (x.length === 1) ? x[0] : x;
- 99 	};
-100 	
-101 	/**
-102 	 * Deep copy/prototypical constructor function
-103 	 *
-104 	 * @param object obj
-105 	 * @private
-106 	 * @return object
-107 	 * @type object
-108 	 */
-109 	dcopy = function(obj)
-110 	{
-111 		var type, F;
-112 		
-113 		if(typeof obj === "undefined")
-114 		{
-115 			return;
-116 		}
-117 		
-118 		if(typeof Object.create !== "undefined")
-119 		{
-120 			return Object.create(obj);
-121 		}
-122 		
-123 		type = typeof obj;
-124 		
-125 		if(type !== "object" && type !== "function")
-126 		{
-127 			return;
-128 		}
-129 		
-130 		/**
-131 		 * @private
-132 		 */
-133 		F = function(){};
-134 		
-135 		F.prototype = obj;
-136 		
-137 		return new F();
-138 		
-139 	};
-140 	
-141 	/**
-142 	 * Adds the property `obj` to the $_ object, calling it `name`
-143 	 * 
-144 	 * @param string name
-145 	 * @param object obj
-146 	 * @return void
-147 	 */
-148 	$_.ext = function(name, obj)
-149 	{
-150 		obj.el = sel;
-151 		$_[name] = obj;
-152 	};
-153 	
-154 	/**
-155 	 * Iterates over a $_ object, applying a callback to each item
-156 	 *
-157 	 * @name $_.each
-158 	 * @function
-159 	 * @param function callback
-160 	 * @return void
-161 	 */
-162 	$_.ext('each', function (callback)
-163 	{
-164 		if(typeof sel.length !== "undefined" && sel !== window)
-165 		{
-166 			var len = sel.length;
-167 
-168 			if (len === 0)
-169 			{
-170 				return;
-171 			}
-172 
-173 			var selx;
-174 			for (var x = 0; x < len; x++)
-175 			{
-176 				selx = (sel.item(x)) ? sel.item(x) : sel[x];
-177 				callback(selx);
-178 			}
-179 		}
-180 		else
-181 		{
-182 			callback(sel);
-183 		}
-184 	});
-185 	
-186 	/**
-187 	 * Retrieves the type of the passed variable
-188 	 *
-189 	 * @param mixed obj
-190 	 * @return string
-191 	 * @type string
-192 	 */
-193 	$_.type = function(obj) 
-194 	{
-195 		if((function() {return obj && (obj !== this)}).call(obj))
-196 		{
-197 			//fallback on 'typeof' for truthy primitive values
-198 			return (typeof obj).toLowerCase();
-199 		}
-200 		
-201 		return ({}).toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase();
-202 	};
-203 
-204 	//Set global variables
-205 	$_ = window.$_ = window.$_ || $_;
-206 	$_.$ = $;
-207 	
-208 	//console.log polyfill
-209 	if(typeof window.console === "undefined")
-210 	{
-211 		window.console = {
-212 			log:function(){}
-213 		};
-214 	}
-215 	
-216 	/**
-217 	 * String trim function polyfill
-218 	 */
-219 	if(typeof String.prototype.trim === "undefined")
-220 	{
-221 		/**
-222 		 * @private
-223 		 */
-224 		String.prototype.trim = function(){
-225 			return this.replace(/^\s+|\s+$/g, "");
-226 		};
-227 	}
-228 	
-229 }());
\ No newline at end of file diff --git a/docs/symbols/src/kis-js_src_modules_DOM.js.html b/docs/symbols/src/kis-js_src_modules_DOM.js.html old mode 100755 new mode 100644 index 615e843..d436cf4 --- a/docs/symbols/src/kis-js_src_modules_DOM.js.html +++ b/docs/symbols/src/kis-js_src_modules_DOM.js.html @@ -14,333 +14,325 @@ 7 8 "use strict"; 9 - 10 var d, tag_reg, class_reg; + 10 var d; 11 - 12 tag_reg = /^([\w\-]+)$/; - 13 class_reg = /\.([\w\-]+)$/; - 14 - 15 - 16 //Private function for getting/setting attributes - 17 function _attr(sel, name, value) - 18 { - 19 var oldVal, doAttr; - 20 - 21 //Get the value of the attribute, if it exists - 22 if (typeof sel.hasAttribute !== "undefined") - 23 { - 24 if (sel.hasAttribute(name)) - 25 { - 26 oldVal = sel.getAttribute(name); - 27 } - 28 - 29 doAttr = true; - 30 } - 31 else if (typeof sel[name] !== "undefined") - 32 { - 33 oldVal = sel[name]; - 34 doAttr = false; - 35 } - 36 else if (name === "class" && typeof sel.className !== "undefined") //className attribute - 37 { - 38 name = "className"; - 39 oldVal = sel.className; - 40 doAttr = false; - 41 } - 42 - 43 //Well, I guess that attribute doesn't exist - 44 if (typeof oldVal === "undefined" && (typeof value === "undefined" || value === null)) - 45 { - 46 console.log(value); - 47 console.log(sel); - 48 console.log("Element does not have the selected attribute"); - 49 return; - 50 } - 51 - 52 //No value to set? Return the current value - 53 if (typeof value === "undefined") - 54 { - 55 return oldVal; - 56 } - 57 - 58 //Determine what to do with the attribute - 59 if (typeof value !== "undefined" && value !== null) - 60 { - 61 if(doAttr === true) + 12 //Private function for getting/setting attributes + 13 function _attr(sel, name, value) + 14 { + 15 var oldVal, doAttr; + 16 + 17 //Get the value of the attribute, if it exists + 18 if (typeof sel.hasAttribute !== "undefined") + 19 { + 20 if (sel.hasAttribute(name)) + 21 { + 22 oldVal = sel.getAttribute(name); + 23 } + 24 + 25 doAttr = true; + 26 } + 27 else if (typeof sel[name] !== "undefined") + 28 { + 29 oldVal = sel[name]; + 30 doAttr = false; + 31 } + 32 else if (name === "class" && typeof sel.className !== "undefined") //className attribute + 33 { + 34 name = "className"; + 35 oldVal = sel.className; + 36 doAttr = false; + 37 } + 38 + 39 //Well, I guess that attribute doesn't exist + 40 if (typeof oldVal === "undefined" && (typeof value === "undefined" || value === null)) + 41 { + 42 console.log(value); + 43 console.log(sel); + 44 console.log("Element does not have the selected attribute"); + 45 return; + 46 } + 47 + 48 //No value to set? Return the current value + 49 if (typeof value === "undefined") + 50 { + 51 return oldVal; + 52 } + 53 + 54 //Determine what to do with the attribute + 55 if (typeof value !== "undefined" && value !== null) + 56 { + 57 if(doAttr === true) + 58 { + 59 sel.setAttribute(name, value); + 60 } + 61 else 62 { - 63 sel.setAttribute(name, value); - 64 } - 65 else - 66 { - 67 sel[name] = value; - 68 } - 69 } - 70 else if (value === null) - 71 { - 72 if(doAttr === true) + 63 sel[name] = value; + 64 } + 65 } + 66 else if (value === null) + 67 { + 68 if(doAttr === true) + 69 { + 70 sel.removeAttribute(name); + 71 } + 72 else 73 { - 74 sel.removeAttribute(name); - 75 } - 76 else - 77 { - 78 delete sel[name]; - 79 } - 80 } - 81 - 82 return (typeof value !== "undefined") ? value : oldVal; - 83 } - 84 - 85 function _toCamel(s) - 86 { - 87 return s.replace(/(\-[a-z])/g, function($1){ - 88 return $1.toUpperCase().replace('-',''); - 89 }); - 90 } - 91 - 92 function _css(sel, prop, val) - 93 { - 94 var equi; - 95 - 96 //Camel-case - 97 prop = _toCamel(prop); - 98 - 99 //Equivalent properties for 'special' browsers -100 equi = { -101 outerHeight: "offsetHeight", -102 outerWidth: "offsetWidth", -103 top: "posTop" -104 }; -105 -106 -107 //If you don't define a value, try returning the existing value -108 if(typeof val === "undefined" && sel.style[prop] !== "undefined") + 74 delete sel[name]; + 75 } + 76 } + 77 + 78 return (typeof value !== "undefined") ? value : oldVal; + 79 } + 80 + 81 function _toCamel(s) + 82 { + 83 return s.replace(/(\-[a-z])/g, function($1){ + 84 return $1.toUpperCase().replace('-',''); + 85 }); + 86 } + 87 + 88 function _css(sel, prop, val) + 89 { + 90 var equi; + 91 + 92 //Camel-case + 93 prop = _toCamel(prop); + 94 + 95 //Equivalent properties for 'special' browsers + 96 equi = { + 97 outerHeight: "offsetHeight", + 98 outerWidth: "offsetWidth", + 99 top: "posTop" +100 }; +101 +102 +103 //If you don't define a value, try returning the existing value +104 if(typeof val === "undefined" && sel.style[prop] !== "undefined") +105 { +106 return sel.style[prop]; +107 } +108 else if(typeof val === "undefined" && sel.style[equi[prop]] !== "undefined") 109 { -110 return sel.style[prop]; +110 return sel.style[equi[prop]]; 111 } -112 else if(typeof val === "undefined" && sel.style[equi[prop]] !== "undefined") -113 { -114 return sel.style[equi[prop]]; -115 } -116 -117 //Let's try the easy way first -118 if(typeof sel.style[prop] !== "undefined") -119 { -120 sel.style[prop] = val; -121 -122 //Short circuit -123 return; -124 } -125 else if(sel.style[equi[prop]]) -126 { -127 sel.style[equi[prop]] = val; -128 return; -129 } -130 -131 //No matches? Well, lets log it for now -132 console.log("Property " + prop + " nor an equivalent seems to exist"); -133 } -134 -135 // -------------------------------------------------------------------------- -136 -137 /** -138 * DOM -139 * -140 * Dom manipulation module -141 * @namespace -142 * @memberOf $_ -143 * @name dom -144 */ -145 d = { -146 /** -147 * Adds a class to the element(s) specified by the current -148 * selector -149 * -150 * @name addClass -151 * @memberOf $_.dom -152 * @function -153 * @param string class -154 * @return void -155 */ -156 addClass: function (c) -157 { -158 $_.each(function (e){ -159 e.classList.add(c); -160 }); -161 }, -162 /** -163 * Removes a class from the element(s) specified by the current -164 * selector -165 * -166 * @name removeClass -167 * @memberOf $_.dom -168 * @function -169 * @param string class -170 * @return void -171 */ -172 removeClass: function (c) -173 { -174 $_.each(function (e){ -175 e.classList.remove(c); -176 }); -177 }, -178 /** -179 * Hides the element(s) specified by the current selector -180 * -181 * @name hide -182 * @memberOf $_.dom -183 * @function -184 * @return void -185 */ -186 hide: function () -187 { -188 this.css('display', 'none'); -189 }, -190 /** -191 * Shows the element(s) specified by the current selector. -192 * if type is specified, the element will have it's style -193 * property set to "display:[your type]". If type is not -194 * specified, the element is set to "display:block". -195 * -196 * @name show -197 * @memberOf $_.dom -198 * @function -199 * @param [string] type -200 * @return void -201 */ -202 show: function (type) -203 { -204 if (typeof type === "undefined") -205 { -206 type = "block"; -207 } -208 -209 this.css("display", type); -210 }, -211 /** -212 * Sets attributes on element(s) specified by the current -213 * selector, or, if name is not specified, returns the -214 * value of the attribute of the element specified by the -215 * current selector. -216 * -217 * @name attr -218 * @memberOf $_.dom -219 * @function -220 * @param string name -221 * @param string value -222 * @return string -223 * @type string -224 */ -225 attr: function (name, value) -226 { -227 var sel = this.el; -228 -229 //Make sure you don't try to get a bunch of elements -230 if (sel.length > 1 && typeof value === "undefined") -231 { -232 console.log(sel); -233 console.log("Must be a singular element"); -234 return; -235 } -236 else if (sel.length > 1 && typeof value !== "undefined") //You can set a bunch, though -237 { -238 $_.each(function (e){ -239 return _attr(e, name, value); -240 }); -241 } -242 else //Normal behavior -243 { -244 return _attr(sel, name, value); -245 } -246 }, -247 /** -248 * Sets or retrieves the text content of the element -249 * specified by the current selector. If a value is -250 * passed, it will set that value on the current element, -251 * otherwise it will return the value of the current element -252 * -253 * @name text -254 * @memberOf $_.dom -255 * @function -256 * @param [string] value -257 * @returns string -258 * @type string -259 */ -260 text: function (value) -261 { -262 var oldValue, set, type, sel; -263 -264 sel = this.el; -265 -266 set = (typeof value !== "undefined") ? true : false; +112 +113 //Let's try the easy way first +114 if(typeof sel.style[prop] !== "undefined") +115 { +116 sel.style[prop] = val; +117 +118 //Short circuit +119 return; +120 } +121 else if(sel.style[equi[prop]]) +122 { +123 sel.style[equi[prop]] = val; +124 return; +125 } +126 +127 //No matches? Well, lets log it for now +128 console.log("Property " + prop + " nor an equivalent seems to exist"); +129 } +130 +131 // -------------------------------------------------------------------------- +132 +133 /** +134 * DOM +135 * +136 * Dom manipulation module +137 * @namespace +138 * @memberOf $_ +139 * @name dom +140 */ +141 d = { +142 /** +143 * Adds a class to the element(s) specified by the current +144 * selector +145 * +146 * @name addClass +147 * @memberOf $_.dom +148 * @function +149 * @param string class +150 */ +151 addClass: function (c) +152 { +153 $_.each(function (e){ +154 e.classList.add(c); +155 }); +156 }, +157 /** +158 * Removes a class from the element(s) specified by the current +159 * selector +160 * +161 * @name removeClass +162 * @memberOf $_.dom +163 * @function +164 * @param string class +165 */ +166 removeClass: function (c) +167 { +168 $_.each(function (e){ +169 e.classList.remove(c); +170 }); +171 }, +172 /** +173 * Hides the element(s) specified by the current selector +174 * +175 * @name hide +176 * @memberOf $_.dom +177 * @function +178 */ +179 hide: function () +180 { +181 this.css('display', 'none'); +182 }, +183 /** +184 * Shows the element(s) specified by the current selector. +185 * if type is specified, the element will have it's style +186 * property set to "display:[your type]". If type is not +187 * specified, the element is set to "display:block". +188 * +189 * @name show +190 * @memberOf $_.dom +191 * @function +192 * @param [string] type +193 */ +194 show: function (type) +195 { +196 if (typeof type === "undefined") +197 { +198 type = "block"; +199 } +200 +201 this.css("display", type); +202 }, +203 /** +204 * Sets attributes on element(s) specified by the current +205 * selector, or, if name is not specified, returns the +206 * value of the attribute of the element specified by the +207 * current selector. +208 * +209 * @name attr +210 * @memberOf $_.dom +211 * @function +212 * @param string name +213 * @param [string] value +214 * @return string +215 * @type string +216 */ +217 attr: function (name, value) +218 { +219 var sel = this.el; +220 +221 //Make sure you don't try to get a bunch of elements +222 if (sel.length > 1 && typeof value === "undefined") +223 { +224 console.log(sel); +225 console.log("Must be a singular element"); +226 return; +227 } +228 else if (sel.length > 1 && typeof value !== "undefined") //You can set a bunch, though +229 { +230 $_.each(function (e){ +231 return _attr(e, name, value); +232 }); +233 } +234 else //Normal behavior +235 { +236 return _attr(sel, name, value); +237 } +238 }, +239 /** +240 * Sets or retrieves the text content of the element +241 * specified by the current selector. If a value is +242 * passed, it will set that value on the current element, +243 * otherwise it will return the value of the current element +244 * +245 * @name text +246 * @memberOf $_.dom +247 * @function +248 * @param [string] value +249 * @return string +250 * @type string +251 */ +252 text: function (value) +253 { +254 var oldValue, set, type, sel; +255 +256 sel = this.el; +257 +258 set = (typeof value !== "undefined") ? true : false; +259 +260 type = (typeof sel.innerText !== "undefined") +261 ? "innerText" +262 : (typeof sel.textContent !== "undefined") +263 ? "textContent" +264 : "innerHTML"; +265 +266 oldValue = sel[type]; 267 -268 type = (typeof sel.innerText !== "undefined") -269 ? "innerText" -270 : (typeof sel.textContent !== "undefined") -271 ? "textContent" -272 : "innerHTML"; -273 -274 oldValue = sel[type]; -275 -276 if(set) -277 { -278 sel[type] = value; -279 return value; -280 } -281 else -282 { -283 return oldValue; -284 } -285 }, -286 /** -287 * Sets or retrieves a css property of the element -288 * specified by the current selector. If a value is -289 * passed, it will set that value on the current element, -290 * otherwise it will return the value of the css property -291 * on the current element -292 * -293 * @name css -294 * @memberOf $_.dom -295 * @function -296 * @param string property -297 * @param [string] value -298 * @returns string -299 * @type string -300 */ -301 css: function (prop, val) -302 { -303 //Return the current value if a value is not set -304 if(typeof val === "undefined") -305 { -306 return _css(this.el, prop); -307 } -308 -309 $_.each(function (e){ -310 _css(e, prop, val); -311 }); -312 }, -313 /** -314 * Sets or gets the innerHTML propery of the element(s) passed -315 * -316 * @name html -317 * @memberOf $_.dom -318 * @function -319 * @param string htm -320 * @return string -321 * @type string -322 */ -323 html: function(htm) -324 { -325 -326 if(typeof htm !== "undefined") -327 { -328 this.el.innerHTML = htm; -329 } -330 -331 //If the parameter is undefined, just return the current value -332 return this.el.innerHTML; -333 } -334 }; -335 -336 $_.ext('dom', d); -337 -338 }()); -339 \ No newline at end of file +268if(set) +269 { +270 sel[type] = value; +271 return value; +272 } +273 else +274 { +275 return oldValue; +276 } +277 }, +278 /** +279 * Sets or retrieves a css property of the element +280 * specified by the current selector. If a value is +281 * passed, it will set that value on the current element, +282 * otherwise it will return the value of the css property +283 * on the current element +284 * +285 * @name css +286 * @memberOf $_.dom +287 * @function +288 * @param string property +289 * @param [string] value +290 * @return string +291 * @type string +292 */ +293 css: function (prop, val) +294 { +295 //Return the current value if a value is not set +296 if(typeof val === "undefined") +297 { +298 return _css(this.el, prop); +299 } +300 +301 $_.each(function (e){ +302 _css(e, prop, val); +303 }); +304 }, +305 /** +306 * Sets or gets the innerHTML propery of the element(s) passed +307 * +308 * @name html +309 * @memberOf $_.dom +310 * @function +311 * @param [string] htm +312 * @return string +313 * @type string +314 */ +315 html: function(htm) +316 { +317 +318 if(typeof htm !== "undefined") +319 { +320 this.el.innerHTML = htm; +321 } +322 +323 //If the parameter is undefined, just return the current value +324 return this.el.innerHTML; +325 } +326 }; +327 +328 $_.ext('dom', d); +329 +330 }()); +331 \ No newline at end of file diff --git a/docs/symbols/src/kis-js_src_modules_ajax.js.html b/docs/symbols/src/kis-js_src_modules_ajax.js.html old mode 100755 new mode 100644 index 94ee49f..19737f0 --- a/docs/symbols/src/kis-js_src_modules_ajax.js.html +++ b/docs/symbols/src/kis-js_src_modules_ajax.js.html @@ -96,24 +96,22 @@ 89 * @param string url 90 * @param object data 91 * @param function callback - 92 * @return void - 93 */ - 94 $_.ext('get', function (url, data, callback){ - 95 ajax._do(url, data, callback, false); - 96 }); - 97 - 98 /** - 99 * Sends a POST type ajax request -100 * -101 * @name post -102 * @function -103 * @memberOf $_ -104 * @param string url -105 * @param object data -106 * @param function callback -107 * @return void -108 */ -109 $_.ext('post', function (url, data, callback){ -110 ajax._do(url, data, callback, true); -111 }); -112 }()); \ No newline at end of file + 92 */ + 93 $_.ext('get', function (url, data, callback){ + 94 ajax._do(url, data, callback, false); + 95 }); + 96 + 97 /** + 98 * Sends a POST type ajax request + 99 * +100 * @name post +101 * @function +102 * @memberOf $_ +103 * @param string url +104 * @param object data +105 * @param function callback +106 */ +107 $_.ext('post', function (url, data, callback){ +108 ajax._do(url, data, callback, true); +109 }); +110 }()); \ No newline at end of file diff --git a/docs/symbols/src/kis-js_src_modules_event.js.html b/docs/symbols/src/kis-js_src_modules_event.js.html old mode 100755 new mode 100644 index bdd11d7..d64d07e --- a/docs/symbols/src/kis-js_src_modules_event.js.html +++ b/docs/symbols/src/kis-js_src_modules_event.js.html @@ -53,7 +53,7 @@ 46 */ 47 _attach = function (sel, event, callback) 48 { - 49 function listener () { + 49 function _listener () { 50 // Internet Explorer fails to correctly set the 'this' object 51 // for event listeners, so we need to set it ourselves. 52 callback.apply(arguments[0]); @@ -63,14 +63,14 @@ 56 { 57 _remove(event, callback); // Make sure we don't have duplicate listeners 58 - 59 sel.attachEvent("on" + event, listener); - 60 // Store our listener so we can remove it later + 59 sel.attachEvent("on" + event, _listener); + 60 // Store our _listener so we can remove it later 61 var expando = sel[kis_expando] = sel[kis_expando] || {}; 62 expando.listeners = expando.listeners || {}; 63 expando.listeners[event] = expando.listeners[event] || []; 64 expando.listeners[event].push({ 65 callback: callback, - 66 listener: listener + 66 _listener: _listener 67 }); 68 } 69 else @@ -95,7 +95,7 @@ 88 { 89 if (listeners[i].callback === callback) 90 { - 91 sel.detachEvent("on" + event, listeners[i].listener); + 91 sel.detachEvent("on" + event, listeners[i]._listener); 92 listeners.splice(i, 1); 93 if(listeners.length === 0) 94 { @@ -148,7 +148,7 @@ 141 142 _attach_delegate = function(sel, target, event, callback) 143 { -144 //_attach the listener to the parent object +144 //_attach the _listener to the parent object 145 _add_remove(sel, event, function(e){ 146 147 var elem, t; @@ -179,39 +179,39 @@ 172 // -------------------------------------------------------------------------- 173 174 /** -175 * @namespace -176 * @name event -177 * @memberOf $_ -178 */ -179 e = { -180 /** -181 * Adds an event that returns a callback when triggered on the selected -182 * event and selector -183 * -184 * @memberOf $_.event -185 * @name add -186 * @function -187 * @example Eg. $_("#selector").event.add("click", do_something()); -188 * @param string event -189 * @param function callback -190 * @return void -191 */ -192 add: function (event, callback) -193 { -194 $_.each(function(e){ -195 _add_remove(e, event, callback, true); -196 }); -197 }, -198 /** -199 * Removes an event bound the the specified selector, event type, and callback -200 * -201 * @memberOf $_.event -202 * @name remove -203 * @function -204 * @example Eg. $_("#selector").event.remove("click", do_something()); -205 * @param string event -206 * @param string callback -207 * @return void +175 * Event Listener module +176 * +177 * @namespace +178 * @name event +179 * @memberOf $_ +180 */ +181 e = { +182 /** +183 * Adds an event that returns a callback when triggered on the selected +184 * event and selector +185 * +186 * @memberOf $_.event +187 * @name add +188 * @function +189 * @example Eg. $_("#selector").event.add("click", do_something()); +190 * @param string event +191 * @param function callback +192 */ +193 add: function (event, callback) +194 { +195 $_.each(function(e){ +196 _add_remove(e, event, callback, true); +197 }); +198 }, +199 /** +200 * Removes an event bound the the specified selector, event type, and callback +201 * +202 * @memberOf $_.event +203 * @name remove +204 * @function +205 * @example Eg. $_("#selector").event.remove("click", do_something()); +206 * @param string event +207 * @param string callback 208 */ 209 remove: function (event, callback) 210 { @@ -220,8 +220,8 @@ 213 }); 214 }, 215 /** -216 * Binds a persistent, delegated event -217 * +216 * Binds a persistent event to the document +217 * 218 * @memberOf $_.event 219 * @name live 220 * @function @@ -229,32 +229,30 @@ 222 * @param string target 223 * @param string event 224 * @param function callback -225 * @return void -226 */ -227 live: function (target, event, callback) -228 { -229 _attach_delegate(document.documentElement, target, event, callback); -230 }, -231 /** -232 * Binds an event to a parent object -233 * -234 * @memberOf $_.event -235 * @name delegate -236 * @function -237 * @example Eg. $_("#parent").delegate(".button", "click", do_something()); -238 * @param string target -239 * @param string event_type -240 * @parma function callback -241 * @return void -242 */ -243 delegate: function(target, event, callback) -244 { -245 $_.each(function(e){ -246 _attach_delegate(e, target, event, callback); -247 }); -248 } -249 }; +225 */ +226 live: function (target, event, callback) +227 { +228 _attach_delegate(document.documentElement, target, event, callback); +229 }, +230 /** +231 * Binds an event to a parent object +232 * +233 * @memberOf $_.event +234 * @name delegate +235 * @function +236 * @example Eg. $_("#parent").delegate(".button", "click", do_something()); +237 * @param string target +238 * @param string event_type +239 * @param function callback +240 */ +241 delegate: function(target, event, callback) +242 { +243 $_.each(function(e){ +244 _attach_delegate(e, target, event, callback); +245 }); +246 } +247 }; +248 +249 $_.ext('event', e); 250 -251 $_.ext('event', e); -252 -253 }()); \ No newline at end of file +251}()); \ No newline at end of file diff --git a/docs/symbols/src/kis-js_src_modules_store.js.html b/docs/symbols/src/kis-js_src_modules_store.js.html old mode 100755 new mode 100644 index 8ed3ef5..d72347a --- a/docs/symbols/src/kis-js_src_modules_store.js.html +++ b/docs/symbols/src/kis-js_src_modules_store.js.html @@ -19,105 +19,108 @@ 12 s = sessionStorage; 13 14 /** - 15 * Wrapper for localstorage / sessionstorage data serialization - 16 * - 17 * @name store - 18 * @namespace - 19 * @memberOf $_ - 20 */ - 21 var store = { - 22 /** - 23 * Retrieves and deserializes a value from localstorage, - 24 * based on the specified key - 25 * - 26 * @param string key - 27 * @param bool session - 28 * @name get - 29 * @memberOf $_.store - 30 * @function - 31 * @return object - 32 * @type object - 33 */ - 34 get: function (key, sess) - 35 { - 36 var val = (sess) ? s.getItem(key) : l.getItem(key); - 37 - 38 return JSON.parse(val); - 39 }, - 40 /** - 41 * Puts a value into localstorage at the specified key, - 42 * and JSON-encodes the value if not a string - 43 * - 44 * @param string key - 45 * @param mixed value - 46 * @param bool session - 47 * @name set - 48 * @memberOf $_.store - 49 * @function - 50 */ - 51 set: function (key, value, sess) - 52 { - 53 // Localstorage generally only accepts strings - 54 value = JSON.stringify(value); - 55 - 56 (sess) ? s.setItem(key, value) : l.setItem(key, value); - 57 }, - 58 /** - 59 * Removes the specified item from storage - 60 * - 61 * @param string key - 62 * @param bool session - 63 * @name remove - 64 * @memberOf $_.store - 65 * @function - 66 */ - 67 remove: function (key, sess) - 68 { - 69 (sess) ? s.removeItem(key) : l.removeItem(key); - 70 }, - 71 /** - 72 * Removes all values from the same domain storage - 73 * - 74 * @param bool session - 75 * @name clear - 76 * @memberOf $_.store - 77 * @function - 78 */ - 79 clear: function(sess) - 80 { - 81 (sess) ? s.clear() : l.clear(); - 82 }, - 83 /** - 84 * Returns an object of all the raw values in storage - 85 * - 86 * @name getAll - 87 * @member of $_.store - 88 * @function - 89 * @return object - 90 * @type object - 91 */ - 92 getAll: function (sess) - 93 { - 94 var i, - 95 len, - 96 data = {}, - 97 k, - 98 o; - 99 -100 //Reference to session/localstorage -101 o = (sess) ? l : s; -102 -103 len = o.length; -104 -105 for (i = 0; i < len; i++) -106 { -107 k = o.key(i); -108 data[k] = o.getItem(k); -109 } -110 -111 return data; -112 } -113 }; -114 -115 $_.ext('store', store); -116 }()); \ No newline at end of file + 15 * Wrapper for localstorage / sessionstorage data serialization. + 16 * Each method has a boolean parameter, that when set as true switches the method + 17 * to use sessionStorage rather than the default localStorage. + 18 * + 19 * @name store + 20 * @namespace + 21 * @memberOf $_ + 22 */ + 23 var store = { + 24 /** + 25 * Retrieves and deserializes a value from localstorage, + 26 * based on the specified key + 27 * + 28 * @param string key + 29 * @param bool session + 30 * @name get + 31 * @memberOf $_.store + 32 * @function + 33 * @return object + 34 * @type object + 35 */ + 36 get: function (key, sess) + 37 { + 38 var val = (sess) ? s.getItem(key) : l.getItem(key); + 39 + 40 return JSON.parse(val); + 41 }, + 42 /** + 43 * Puts a value into localstorage at the specified key, + 44 * and JSON-encodes the value if not a string + 45 * + 46 * @param string key + 47 * @param mixed value + 48 * @param bool session + 49 * @name set + 50 * @memberOf $_.store + 51 * @function + 52 */ + 53 set: function (key, value, sess) + 54 { + 55 // Localstorage generally only accepts strings + 56 value = JSON.stringify(value); + 57 + 58 (sess) ? s.setItem(key, value) : l.setItem(key, value); + 59 }, + 60 /** + 61 * Removes the specified item from storage + 62 * + 63 * @param string key + 64 * @param bool session + 65 * @name remove + 66 * @memberOf $_.store + 67 * @function + 68 */ + 69 remove: function (key, sess) + 70 { + 71 (sess) ? s.removeItem(key) : l.removeItem(key); + 72 }, + 73 /** + 74 * Returns an object of all the raw values in storage + 75 * + 76 * @param bool session + 77 * @name getAll + 78 * @memberOf $_.store + 79 * @function + 80 * @return object + 81 * @type object + 82 */ + 83 getAll: function (sess) + 84 { + 85 var i, + 86 len, + 87 data = {}, + 88 k, + 89 o; + 90 + 91 //Reference to session/localstorage + 92 o = (sess) ? l : s; + 93 + 94 len = o.length; + 95 + 96 for (i = 0; i < len; i++) + 97 { + 98 k = o.key(i); + 99 data[k] = o.getItem(k); +100 } +101 +102 return data; +103 }, +104 /** +105 * Removes all values from the same domain storage +106 * +107 * @param bool session +108 * @name clear +109 * @memberOf $_.store +110 * @function +111 */ +112 clear: function(sess) +113 { +114 (sess) ? s.clear() : l.clear(); +115 } +116 }; +117 +118 $_.ext('store', store); +119 }()); \ No newline at end of file diff --git a/docs/symbols/src/kis-js_src_modules_util.js.html b/docs/symbols/src/kis-js_src_modules_util.js.html old mode 100755 new mode 100644 index 4a18275..7ddaa97 --- a/docs/symbols/src/kis-js_src_modules_util.js.html +++ b/docs/symbols/src/kis-js_src_modules_util.js.html @@ -262,8 +262,8 @@ 255 * @memberOf $_.util 256 * @function 257 * @param string input_string -258 * @param mixed -259 * @param [string] to +258 * @param mixed from (string)/replace pairs (object) +259 * @param [string] 260 * @return string 261 * @type string 262 */ diff --git a/kis-all.js b/kis-all.js index 8ce0b9b..1e32b88 100644 --- a/kis-all.js +++ b/kis-all.js @@ -68,13 +68,11 @@ }; /** - * $ - * * Simple DOM selector function * * @memberOf $_ * @param string selector - * @param string context + * @param object context * @return object * @type object */ @@ -148,7 +146,6 @@ * * @param string name * @param object obj - * @return void */ $_.ext = function(name, obj) { @@ -162,7 +159,6 @@ * @name $_.each * @function * @param function callback - * @return void */ $_.ext('each', function (callback) { @@ -219,199 +215,203 @@ * A module of various browser polyfills * @file polyfill.js */ +(function(){ + + "use strict"; -// Console.log polyfill for IE 8 stupidity -if(typeof window.console === "undefined") -{ - window.console = { - log:function(){} - }; -} - -// -------------------------------------------------------------------------- - -/** - * String trim function polyfill - */ -if(typeof String.prototype.trim === "undefined") -{ - /** - * @private - */ - String.prototype.trim = function(){ - return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, ""); - }; -} - -// -------------------------------------------------------------------------- - -//This is used so IE 8 can use the classList api -/* - * classList.js: Cross-browser full element.classList implementation. - * 2011-06-15 - * - * By Eli Grey, http://eligrey.com - * Public Domain. - * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - */ - -if (typeof document !== "undefined" && !("classList" in document.createElement("a"))) -{ - (function (view){ + // Console.log polyfill for IE 8 stupidity + if(typeof window.console === "undefined") + { + window.console = { + log:function(){} + }; + } - var classListProp = "classList", - protoProp = "prototype", - elemCtrProto = (view.HTMLElement || view.Element)[protoProp], - objCtr = Object, - strTrim = String[protoProp].trim || - function () - { - return this.replace(/^\s+|\s+$/g, ""); - }, - arrIndexOf = Array[protoProp].indexOf || - function (item) - { - var - i = 0, - len = this.length; - for (; i < len; i++) + // -------------------------------------------------------------------------- + + /** + * String trim function polyfill + */ + if(typeof String.prototype.trim === "undefined") + { + /** + * @private + */ + String.prototype.trim = function() + { + return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, ""); + }; + } + + // -------------------------------------------------------------------------- + + //This is used so IE 8 can use the classList api + /* + * classList.js: Cross-browser full element.classList implementation. + * 2011-06-15 + * + * By Eli Grey, http://eligrey.com + * Public Domain. + * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. + */ + + if (typeof document !== "undefined" && !("classList" in document.createElement("a"))) + { + (function (view){ + + var classListProp = "classList", + protoProp = "prototype", + elemCtrProto = (view.HTMLElement || view.Element)[protoProp], + objCtr = Object, + strTrim = String[protoProp].trim || + function () { - if (i in this && this[i] === item) - { - return i; - } - } - return -1; - } - // Vendors: please allow content code to instantiate DOMExceptions - , - /** - * @private - */ - DOMEx = function (type, message) - { - this.name = type; - this.code = DOMException[type]; - this.message = message; - }, - /** - * @private - */ - checkTokenAndGetIndex = function (classList, token) - { - if (token === "") + return this.replace(/^\s+|\s+$/g, ""); + }, + arrIndexOf = Array[protoProp].indexOf || + function (item) { - throw new DOMEx("SYNTAX_ERR", "An invalid or illegal string was specified"); - } - if (/\s/.test(token)) - { - throw new DOMEx("INVALID_CHARACTER_ERR", "String contains an invalid character"); - } - return arrIndexOf.call(classList, token); - }, - /** - * @private - */ - ClassList = function (elem) - { - var - trimmedClasses = strTrim.call(elem.className), - classes = trimmedClasses ? trimmedClasses.split(/\s+/) : [], + var i = 0, - len = classes.length; - for (; i < len; i++) - { - this.push(classes[i]); + len = this.length; + for (; i < len; i++) + { + if (i in this && this[i] === item) + { + return i; + } + } + return -1; } - this._updateClassName = function () + // Vendors: please allow content code to instantiate DOMExceptions + , + /** + * @private + */ + DOMEx = function (type, message) { - elem.className = this.toString(); + this.name = type; + this.code = DOMException[type]; + this.message = message; + }, + /** + * @private + */ + checkTokenAndGetIndex = function (classList, token) + { + if (token === "") + { + throw new DOMEx("SYNTAX_ERR", "An invalid or illegal string was specified"); + } + if (/\s/.test(token)) + { + throw new DOMEx("INVALID_CHARACTER_ERR", "String contains an invalid character"); + } + return arrIndexOf.call(classList, token); + }, + /** + * @private + */ + ClassList = function (elem) + { + var + trimmedClasses = strTrim.call(elem.className), + classes = trimmedClasses ? trimmedClasses.split(/\s+/) : [], + i = 0, + len = classes.length; + for (; i < len; i++) + { + this.push(classes[i]); + } + this._updateClassName = function () + { + elem.className = this.toString(); + }; + }, + classListProto = ClassList[protoProp] = [], + /** + * @private + */ + classListGetter = function () + { + return new ClassList(this); }; - }, - classListProto = ClassList[protoProp] = [], - /** - * @private - */ - classListGetter = function () + // Most DOMException implementations don't allow calling DOMException's toString() + // on non-DOMExceptions. Error's toString() is sufficient here. + DOMEx[protoProp] = Error[protoProp]; + classListProto.item = function (i) { - return new ClassList(this); + return this[i] || null; }; - // Most DOMException implementations don't allow calling DOMException's toString() - // on non-DOMExceptions. Error's toString() is sufficient here. - DOMEx[protoProp] = Error[protoProp]; - classListProto.item = function (i) - { - return this[i] || null; - }; - classListProto.contains = function (token) - { - token += ""; - return checkTokenAndGetIndex(this, token) !== -1; - }; - classListProto.add = function (token) - { - token += ""; - if (checkTokenAndGetIndex(this, token) === -1) + classListProto.contains = function (token) { - this.push(token); - this._updateClassName(); - } - }; - classListProto.remove = function (token) - { - token += ""; - var index = checkTokenAndGetIndex(this, token); - if (index !== -1) - { - this.splice(index, 1); - this._updateClassName(); - } - }; - classListProto.toggle = function (token) - { - token += ""; - if (checkTokenAndGetIndex(this, token) === -1) - { - this.add(token); - } - else - { - this.remove(token); - } - }; - classListProto.toString = function () - { - return this.join(" "); - }; - - if (objCtr.defineProperty) - { - var classListPropDesc = { - get: classListGetter, - enumerable: true, - configurable: true + token += ""; + return checkTokenAndGetIndex(this, token) !== -1; }; - try + classListProto.add = function (token) { - objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); - } - catch (ex) - { // IE 8 doesn't support enumerable:true - if (ex.number === -0x7FF5EC54) + token += ""; + if (checkTokenAndGetIndex(this, token) === -1) + { + this.push(token); + this._updateClassName(); + } + }; + classListProto.remove = function (token) + { + token += ""; + var index = checkTokenAndGetIndex(this, token); + if (index !== -1) + { + this.splice(index, 1); + this._updateClassName(); + } + }; + classListProto.toggle = function (token) + { + token += ""; + if (checkTokenAndGetIndex(this, token) === -1) + { + this.add(token); + } + else + { + this.remove(token); + } + }; + classListProto.toString = function () + { + return this.join(" "); + }; + + if (objCtr.defineProperty) + { + var classListPropDesc = { + get: classListGetter, + enumerable: true, + configurable: true + }; + try { - classListPropDesc.enumerable = false; objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); } + catch (ex) + { // IE 8 doesn't support enumerable:true + if (ex.number === -0x7FF5EC54) + { + classListPropDesc.enumerable = false; + objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); + } + } } - } - else if (objCtr[protoProp].__defineGetter__) - { - elemCtrProto.__defineGetter__(classListProp, classListGetter); - } - - }(self)); -} - + else if (objCtr[protoProp].__defineGetter__) + { + elemCtrProto.__defineGetter__(classListProp, classListGetter); + } + + }(self)); + } +}()); // -------------------------------------------------------------------------- @@ -424,11 +424,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" "use strict"; - var d, tag_reg, class_reg; - - tag_reg = /^([\w\-]+)$/; - class_reg = /\.([\w\-]+)$/; - + var d; //Private function for getting/setting attributes function _attr(sel, name, value) @@ -568,7 +564,6 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" * @memberOf $_.dom * @function * @param string class - * @return void */ addClass: function (c) { @@ -584,7 +579,6 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" * @memberOf $_.dom * @function * @param string class - * @return void */ removeClass: function (c) { @@ -598,7 +592,6 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" * @name hide * @memberOf $_.dom * @function - * @return void */ hide: function () { @@ -614,7 +607,6 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" * @memberOf $_.dom * @function * @param [string] type - * @return void */ show: function (type) { @@ -635,7 +627,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" * @memberOf $_.dom * @function * @param string name - * @param string value + * @param [string] value * @return string * @type string */ @@ -671,7 +663,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" * @memberOf $_.dom * @function * @param [string] value - * @returns string + * @return string * @type string */ text: function (value) @@ -712,7 +704,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" * @function * @param string property * @param [string] value - * @returns string + * @return string * @type string */ css: function (prop, val) @@ -733,7 +725,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" * @name html * @memberOf $_.dom * @function - * @param string htm + * @param [string] htm * @return string * @type string */ @@ -770,7 +762,9 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" s = sessionStorage; /** - * Wrapper for localstorage / sessionstorage data serialization + * Wrapper for localstorage / sessionstorage data serialization. + * Each method has a boolean parameter, that when set as true switches the method + * to use sessionStorage rather than the default localStorage. * * @name store * @namespace @@ -826,23 +820,12 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" { (sess) ? s.removeItem(key) : l.removeItem(key); }, - /** - * Removes all values from the same domain storage - * - * @param bool session - * @name clear - * @memberOf $_.store - * @function - */ - clear: function(sess) - { - (sess) ? s.clear() : l.clear(); - }, /** * Returns an object of all the raw values in storage * + * @param bool session * @name getAll - * @member of $_.store + * @memberOf $_.store * @function * @return object * @type object @@ -867,6 +850,18 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" } return data; + }, + /** + * Removes all values from the same domain storage + * + * @param bool session + * @name clear + * @memberOf $_.store + * @function + */ + clear: function(sess) + { + (sess) ? s.clear() : l.clear(); } }; @@ -966,7 +961,6 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" * @param string url * @param object data * @param function callback - * @return void */ $_.ext('get', function (url, data, callback){ ajax._do(url, data, callback, false); @@ -981,7 +975,6 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" * @param string url * @param object data * @param function callback - * @return void */ $_.ext('post', function (url, data, callback){ ajax._do(url, data, callback, true); @@ -1247,8 +1240,8 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" * @memberOf $_.util * @function * @param string input_string - * @param mixed - * @param [string] to + * @param mixed from (string)/replace pairs (object) + * @param [string] * @return string * @type string */ @@ -1402,7 +1395,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" */ _attach = function (sel, event, callback) { - function listener () { + function _listener () { // Internet Explorer fails to correctly set the 'this' object // for event listeners, so we need to set it ourselves. callback.apply(arguments[0]); @@ -1412,14 +1405,14 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" { _remove(event, callback); // Make sure we don't have duplicate listeners - sel.attachEvent("on" + event, listener); - // Store our listener so we can remove it later + sel.attachEvent("on" + event, _listener); + // Store our _listener so we can remove it later var expando = sel[kis_expando] = sel[kis_expando] || {}; expando.listeners = expando.listeners || {}; expando.listeners[event] = expando.listeners[event] || []; expando.listeners[event].push({ callback: callback, - listener: listener + _listener: _listener }); } else @@ -1444,7 +1437,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" { if (listeners[i].callback === callback) { - sel.detachEvent("on" + event, listeners[i].listener); + sel.detachEvent("on" + event, listeners[i]._listener); listeners.splice(i, 1); if(listeners.length === 0) { @@ -1497,7 +1490,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" _attach_delegate = function(sel, target, event, callback) { - //_attach the listener to the parent object + //_attach the _listener to the parent object _add_remove(sel, event, function(e){ var elem, t; @@ -1528,6 +1521,8 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" // -------------------------------------------------------------------------- /** + * Event Listener module + * * @namespace * @name event * @memberOf $_ @@ -1543,7 +1538,6 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" * @example Eg. $_("#selector").event.add("click", do_something()); * @param string event * @param function callback - * @return void */ add: function (event, callback) { @@ -1560,7 +1554,6 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" * @example Eg. $_("#selector").event.remove("click", do_something()); * @param string event * @param string callback - * @return void */ remove: function (event, callback) { @@ -1569,8 +1562,8 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" }); }, /** - * Binds a persistent, delegated event - * + * Binds a persistent event to the document + * * @memberOf $_.event * @name live * @function @@ -1578,7 +1571,6 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" * @param string target * @param string event * @param function callback - * @return void */ live: function (target, event, callback) { @@ -1593,8 +1585,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" * @example Eg. $_("#parent").delegate(".button", "click", do_something()); * @param string target * @param string event_type - * @parma function callback - * @return void + * @param function callback */ delegate: function(target, event, callback) { diff --git a/kis-min.js b/kis-min.js index ff1ec48..bfb1b91 100644 --- a/kis-min.js +++ b/kis-min.js @@ -1,14 +1,15 @@ (function(){if(typeof document.querySelector!=="undefined"){var f,g,d,b;f=function(a){b=typeof a==="undefined"?typeof f.el!=="undefined"?f.el:document.documentElement:typeof a!=="object"?g(a):a;f.prototype.el=b;var a=d(f),c;for(c in a)if(typeof a[c]==="object")a[c].el=b;a.el=b;return a};g=function(a,c){var b;if(typeof a!="string"||typeof a==="undefined")return a;b=c!=null&&c.nodeType===1?c:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);else b=b.querySelectorAll(a); return b.length===1?b[0]:b};d=function(a){var c;if(typeof a!=="undefined"){if(typeof Object.create!=="undefined")return Object.create(a);c=typeof a;if(!(c!=="object"&&c!=="function"))return c=function(){},c.prototype=a,new c}};f.ext=function(a,c){c.el=b;f[a]=c};f.ext("each",function(a){if(typeof b.length!=="undefined"&&b!==window){var c=b.length;if(c!==0)for(var e,d=0;d1&&typeof a==="undefined")console.log(c),console.log("Must be a singular element");else if(c.length>1&&typeof a!== "undefined")$_.each(function(c){return f(c,b,a)});else return f(c,b,a)},text:function(b){var a,c,e;e=this.el;c=typeof e.innerText!=="undefined"?"innerText":typeof e.textContent!=="undefined"?"textContent":"innerHTML";a=e[c];return typeof b!=="undefined"?e[c]=b:a},css:function(b,a){if(typeof a==="undefined")return d(this.el,b);$_.each(function(c){d(c,b,a)})},html:function(b){if(typeof b!=="undefined")this.el.innerHTML=b;return this.el.innerHTML}})})(); -(function(){if(!(typeof localStorage==="undefined"||typeof JSON==="undefined")){var f=localStorage,g=sessionStorage;$_.ext("store",{get:function(d,b){var a=b?g.getItem(d):f.getItem(d);return JSON.parse(a)},set:function(d,b,a){b=JSON.stringify(b);a?g.setItem(d,b):f.setItem(d,b)},remove:function(d,b){b?g.removeItem(d):f.removeItem(d)},clear:function(d){d?g.clear():f.clear()},getAll:function(d){var b,a={},c,e;e=d?f:g;b=e.length;for(d=0;de?1:ba?1:c
- + + + function - void + callback
- string + object context @@ -452,20 +453,6 @@ Simple DOM selector function -
Returns:
- - - - - - - -
- - - void -
- @@ -510,20 +497,6 @@ Simple DOM selector function -
Returns:
- - - - - - - -
- - - void -
- @@ -652,20 +625,6 @@ Simple DOM selector function -
Returns:
- - - - - - - -
- - - void -
- @@ -736,20 +695,6 @@ Simple DOM selector function -
Returns:
- - - - - - - -
- - - void -
- @@ -762,6 +707,10 @@ Simple DOM selector function +
+ ©2011

+ Documentation generated by JsDoc Toolkit 2.4.0 on Thu Nov 03 2011 16:01:49 GMT-0400 (EDT) +
diff --git a/docs/symbols/$_.store.html b/docs/symbols/$_.store.html index 15bc7b3..fd79a07 100644 --- a/docs/symbols/$_.store.html +++ b/docs/symbols/$_.store.html @@ -1,5 +1,6 @@ - - + + @@ -32,23 +33,23 @@
-
 
$_
$(string, string)
ext(string, object)
each(function)
type(mixed)
get(string, object, function)
post(string, object, function)
+
 
$_
$(string, object)
ext(string, object)
each(function)
type(mixed)
get(string, object, function)
post(string, object, function)
addClass(string)
removeClass(string)
show(string)
attr(string, string)
text(string)
css(string, string)
html(string)
-
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string)
+
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string, function)
-
get(string, bool)
set(string, mixed, bool)
remove(string, bool)
clear(bool)
+
get(string, bool)
set(string, mixed, bool)
remove(string, bool)
getAll(bool)
clear(bool)
-
 
$_.util
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
+
 
$_.util
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
@@ -65,7 +66,7 @@
- Kis JS Documentation + Kis JS Docs
@@ -125,6 +126,14 @@ Removes the specified item from storage
+
+ + getAll(bool) + Returns an object of all the raw values in storage +
+
+
+ ©2011

+ Documentation generated by JsDoc Toolkit 2.4.0 on Thu Nov 03 2011 16:01:49 GMT-0400 (EDT) +
diff --git a/docs/symbols/$_.util.html b/docs/symbols/$_.util.html index 36180e2..3f373a6 100644 --- a/docs/symbols/$_.util.html +++ b/docs/symbols/$_.util.html @@ -1,5 +1,6 @@ - - + + @@ -32,23 +33,23 @@
-
 
$_
$(string, string)
ext(string, object)
each(function)
type(mixed)
get(string, object, function)
post(string, object, function)
+
 
$_
$(string, object)
ext(string, object)
each(function)
type(mixed)
get(string, object, function)
post(string, object, function)
addClass(string)
removeClass(string)
show(string)
attr(string, string)
text(string)
css(string, string)
html(string)
-
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string)
+
add(string, function)
remove(string, string)
live(string, string, function)
delegate(string, string, function)
-
get(string, bool)
set(string, mixed, bool)
remove(string, bool)
clear(bool)
+
get(string, bool)
set(string, mixed, bool)
remove(string, bool)
getAll(bool)
clear(bool)
-
 
$_.util
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
+
 
$_.util
object_keys(object)
array_combine(array/object, array/object)
object_merge(object)
str_trans(string, mixed, string)
@@ -65,7 +66,7 @@
- Kis JS Documentation + Kis JS Docs
@@ -137,7 +138,7 @@ - str_trans(string, mixed, string) + str_trans(string, mixed, string) Replaces sections of strings in a greedy fashion, starting with the longest replace pairs first.
@@ -416,7 +417,7 @@ first
- $_.util.str_trans(string, mixed, string) + $_.util.str_trans(string, mixed, string) : string
@@ -456,7 +457,7 @@ from => to replacements as key/value pairs mixed
- + from (string)/replace pairs (object)
- to +