More code cleanup, better test coverage, and doc cleanup
This commit is contained in:
parent
3ef9e89ab6
commit
3c99e243d3
4
.gitignore
vendored
4
.gitignore
vendored
@ -2,4 +2,6 @@ kis-custom.js
|
||||
kis-custom-min.js
|
||||
combine-build.php
|
||||
test.html
|
||||
.*
|
||||
config.json
|
||||
docs.conf
|
||||
.*
|
||||
|
13
README.md
13
README.md
@ -25,31 +25,28 @@ Browser support: IE10+, Latest versions of Firefox, Chrome, Safari, Opera
|
||||
|
||||
* each: For applying changes to every item matched by a selector
|
||||
|
||||
$_(selector).each(callback);
|
||||
$_(selector).each(callback);
|
||||
|
||||
Example :
|
||||
|
||||
$_(".foo").each(function(e){
|
||||
$_(".foo").each(function(e){
|
||||
$_(e).dom.text(value);
|
||||
}):
|
||||
|
||||
* ext: For extending the library, adds this.el to the object or function supplied
|
||||
|
||||
|
||||
$_.ext("name", functionOrObject);
|
||||
|
||||
$_.ext("name", functionOrObject);
|
||||
|
||||
Example:
|
||||
|
||||
$_.ext("zip", function(){ //function });
|
||||
Adds 'zip' function to $_.
|
||||
$_.ext("zip", function(){ ... }); // Adds 'zip' function to $_.
|
||||
|
||||
* type: For getting the type of a variable
|
||||
|
||||
$_.type(var);
|
||||
|
||||
|
||||
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
|
||||
Have a look at the right sidebar of the docs included with the library for documentation on the included modules. The development version of the documentation is avaliable at
|
||||
|
||||
[http://github.timshomepage.net/kis-js/docs/](http://github.timshomepage.net/kis-js/docs/)
|
||||
|
||||
|
@ -313,7 +313,7 @@ selector
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line256">line 256</a>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line258">line 258</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -340,7 +340,7 @@ selector
|
||||
|
||||
<h5>Example</h5>
|
||||
|
||||
<pre class="prettyprint"><code>$_("ul").dom.append("&lt;li&gt;&lt;/li&gt;") adds an li element to the end of the selected ul element</code></pre>
|
||||
<pre class="prettyprint"><code>$_("ul").dom.append("<li></li>"); // Adds an li element to the end of the selected ul element</code></pre>
|
||||
|
||||
|
||||
</dd>
|
||||
@ -720,6 +720,13 @@ multiple key/value pairs.
|
||||
|
||||
|
||||
|
||||
<h5>Examples</h5>
|
||||
|
||||
<pre class="prettyprint"><code>$_('#foo').dom.css('border', 0);</code></pre>
|
||||
|
||||
<pre class="prettyprint"><code>$_('#foo').dom.css({background:'#000', color:'#fff'});</code></pre>
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
@ -899,7 +906,7 @@ multiple key/value pairs.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line281">line 281</a>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line284">line 284</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -1036,7 +1043,7 @@ multiple key/value pairs.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line269">line 269</a>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line271">line 271</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -1061,6 +1068,11 @@ multiple key/value pairs.
|
||||
|
||||
|
||||
|
||||
<h5>Example</h5>
|
||||
|
||||
<pre class="prettyprint"><code>$_("ul").dom.append("<li></li>"); // Adds an li element to the beginning of the selected ul element</code></pre>
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
@ -1493,7 +1505,7 @@ otherwise it will return the value of the current element
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Tue Sep 16 2014 16:57:40 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
@ -242,7 +242,7 @@ event and selector
|
||||
|
||||
<h5>Example</h5>
|
||||
|
||||
<pre class="prettyprint"><code>Eg. $_("#selector").event.add("click", do_something());</code></pre>
|
||||
<pre class="prettyprint"><code>$_("#selector").event.add("click", do_something());</code></pre>
|
||||
|
||||
|
||||
</dd>
|
||||
@ -427,7 +427,7 @@ event and selector
|
||||
|
||||
<h5>Example</h5>
|
||||
|
||||
<pre class="prettyprint"><code>Eg. var event = $_("#selector").event.create('foo', {});</code></pre>
|
||||
<pre class="prettyprint"><code>var event = $_("#selector").event.create('foo', {});</code></pre>
|
||||
|
||||
|
||||
</dd>
|
||||
@ -597,7 +597,7 @@ event and selector
|
||||
|
||||
<h5>Example</h5>
|
||||
|
||||
<pre class="prettyprint"><code>Eg. $_("#parent").delegate(".button", "click", do_something());</code></pre>
|
||||
<pre class="prettyprint"><code>$_("#parent").delegate(".button", "click", do_something());</code></pre>
|
||||
|
||||
|
||||
</dd>
|
||||
@ -767,7 +767,7 @@ event and selector
|
||||
|
||||
<h5>Example</h5>
|
||||
|
||||
<pre class="prettyprint"><code>Eg. $_.event.live(".button", "click", do_something());</code></pre>
|
||||
<pre class="prettyprint"><code>$_.event.live(".button", "click", do_something());</code></pre>
|
||||
|
||||
|
||||
</dd>
|
||||
@ -914,7 +914,7 @@ event and selector
|
||||
|
||||
<h5>Example</h5>
|
||||
|
||||
<pre class="prettyprint"><code>Eg. $_("#selector").event.remove("click", do_something());</code></pre>
|
||||
<pre class="prettyprint"><code>$_("#selector").event.remove("click", do_something());</code></pre>
|
||||
|
||||
|
||||
</dd>
|
||||
@ -1056,7 +1056,7 @@ event and selector
|
||||
|
||||
<h5>Example</h5>
|
||||
|
||||
<pre class="prettyprint"><code>Eg. $_("#my_id").trigger('click');</code></pre>
|
||||
<pre class="prettyprint"><code>$_("#my_id").trigger('click');</code></pre>
|
||||
|
||||
|
||||
</dd>
|
||||
@ -1083,7 +1083,7 @@ event and selector
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Tue Sep 16 2014 16:57:40 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
814
docs/$_.html
814
docs/$_.html
@ -66,7 +66,7 @@ Constructor function</div>
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="core.js.html">core.js</a>, <a href="core.js.html#line14">line 14</a>
|
||||
<a href="core.js.html">core.js</a>, <a href="core.js.html#line20">line 20</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -108,6 +108,66 @@ Constructor function</div>
|
||||
|
||||
|
||||
|
||||
<h3 class="subsection-title">Members</h3>
|
||||
|
||||
<dl>
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="el"><span class="type-signature">(static) </span>el<span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<div class="description">
|
||||
Current selector object
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="core.js.html">core.js</a>, <a href="core.js.html#line11">line 11</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
<h3 class="subsection-title">Methods</h3>
|
||||
@ -247,7 +307,7 @@ Constructor function</div>
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="core.js.html">core.js</a>, <a href="core.js.html#line68">line 68</a>
|
||||
<a href="core.js.html">core.js</a>, <a href="core.js.html#line74">line 74</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -290,6 +350,230 @@ Constructor function</div>
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="delete"><span class="type-signature">(static) </span>delete<span class="signature">(url, data, success_callback, error_callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
<div class="description">
|
||||
Sends a DELETE type ajax request
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
<th>Attributes</th>
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>url</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">string</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last">The url to post to</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>data</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">Object</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last">delete parameters to send</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>success_callback</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">function</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last">callback called on success</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>error_callback</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">function</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
<optional><br>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last">callback called if there is an error</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="ajax.js.html">modules/ajax.js</a>, <a href="ajax.js.html#line136">line 136</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
@ -384,7 +668,7 @@ Constructor function</div>
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="core.js.html">core.js</a>, <a href="core.js.html#line105">line 105</a>
|
||||
<a href="core.js.html">core.js</a>, <a href="core.js.html#line114">line 114</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -409,6 +693,158 @@ Constructor function</div>
|
||||
|
||||
|
||||
|
||||
<h5>Example</h5>
|
||||
|
||||
<pre class="prettyprint"><code>$_('form input').each(function(item) { alert(item) });</code></pre>
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="ext"><span class="type-signature">(static) </span>ext<span class="signature">(name, obj)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
<div class="description">
|
||||
Adds the property `obj` to the $_ object, calling it `name`
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>name</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">string</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last">name of the module</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>obj</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">object</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last">the object to add</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="core.js.html">core.js</a>, <a href="core.js.html#line99">line 99</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Example</h5>
|
||||
|
||||
<pre class="prettyprint"><code>$_.ext('foo', {});</code></pre>
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
@ -608,7 +1044,7 @@ Constructor function</div>
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="ajax.js.html">modules/ajax.js</a>, <a href="ajax.js.html#line96">line 96</a>
|
||||
<a href="ajax.js.html">modules/ajax.js</a>, <a href="ajax.js.html#line94">line 94</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -832,7 +1268,7 @@ Constructor function</div>
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="ajax.js.html">modules/ajax.js</a>, <a href="ajax.js.html#line111">line 111</a>
|
||||
<a href="ajax.js.html">modules/ajax.js</a>, <a href="ajax.js.html#line108">line 108</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -857,6 +1293,372 @@ Constructor function</div>
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="put"><span class="type-signature">(static) </span>put<span class="signature">(url, data, success_callback, error_callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
<div class="description">
|
||||
Sends a PUT type ajax request
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
<th>Attributes</th>
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>url</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">string</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last">The url to post to</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>data</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">Object</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last">PUT parameters to send</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>success_callback</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">function</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last">callback called on success</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>error_callback</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">function</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
<optional><br>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last">callback called if there is an error</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="ajax.js.html">modules/ajax.js</a>, <a href="ajax.js.html#line122">line 122</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="type"><span class="type-signature">(static) </span>type<span class="signature">(obj)</span><span class="type-signature"> → {string}</span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
<div class="description">
|
||||
Retrieves the type of the passed variable
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>obj</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">*</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="core.js.html">core.js</a>, <a href="core.js.html#line134">line 134</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Returns:</h5>
|
||||
|
||||
|
||||
|
||||
|
||||
<dl>
|
||||
<dt>
|
||||
Type
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<span class="param-type">string</span>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Example</h5>
|
||||
|
||||
<pre class="prettyprint"><code>$_.type([]); // Returns 'array'</code></pre>
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
@ -881,7 +1683,7 @@ Constructor function</div>
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Tue Sep 16 2014 16:57:40 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
@ -848,7 +848,7 @@ and JSON-encodes the value if not a string
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Tue Sep 16 2014 16:57:40 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
@ -250,6 +250,8 @@
|
||||
* Accepts either key/value arguments, or an object with
|
||||
* multiple key/value pairs.
|
||||
*
|
||||
* @example $_('#foo').dom.css('border', 0);
|
||||
* @example $_('#foo').dom.css({background:'#000', color:'#fff'});
|
||||
* @name css
|
||||
* @memberOf $_.dom
|
||||
* @function
|
||||
@ -283,7 +285,7 @@
|
||||
/**
|
||||
* Adds to the innerHTML of the current element, after the last child.
|
||||
*
|
||||
* @example $_("ul").dom.append("&lt;li&gt;&lt;/li&gt;") adds an li element to the end of the selected ul element
|
||||
* @example $_("ul").dom.append("<li></li>"); // Adds an li element to the end of the selected ul element
|
||||
* @name append
|
||||
* @memberOf $_.dom
|
||||
* @function
|
||||
@ -296,6 +298,7 @@
|
||||
/**
|
||||
* Adds to the innerHTML of the selected element, before the current children
|
||||
*
|
||||
* @example $_("ul").dom.append("<li></li>"); // Adds an li element to the beginning of the selected ul element
|
||||
* @name prepend
|
||||
* @memberOf $_.dom
|
||||
* @function
|
||||
@ -345,7 +348,7 @@
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Tue Sep 16 2014 16:57:40 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
@ -35,7 +35,7 @@
|
||||
"use strict";
|
||||
|
||||
var ajax = {
|
||||
_do: function (url, data, success_callback, error_callback, isPost)
|
||||
_do: function (url, data, success_callback, error_callback, type)
|
||||
{
|
||||
var type,
|
||||
request = new XMLHttpRequest();
|
||||
@ -48,8 +48,6 @@
|
||||
success_callback = function (){};
|
||||
}
|
||||
|
||||
type = (isPost) ? "POST" : "GET";
|
||||
|
||||
if (type === "GET")
|
||||
{
|
||||
url += (url.match(/\?/))
|
||||
@ -78,7 +76,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
if (type === "POST")
|
||||
if (type !== "GET")
|
||||
{
|
||||
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
request.send(this._serialize(data));
|
||||
@ -123,8 +121,7 @@
|
||||
/**
|
||||
* Sends a GET type ajax request
|
||||
*
|
||||
* @name get
|
||||
* @function
|
||||
* @function get
|
||||
* @memberOf $_
|
||||
* @param {string} url - The url to retrieve
|
||||
* @param {Object} data - get parameters to send
|
||||
@ -132,14 +129,13 @@
|
||||
* @param {function} [error_callback] - callback called if there is an error
|
||||
*/
|
||||
$_.ext('get', function (url, data, success_callback, error_callback){
|
||||
ajax._do(url, data, success_callback, error_callback, false);
|
||||
ajax._do(url, data, success_callback, error_callback, 'GET');
|
||||
});
|
||||
|
||||
/**
|
||||
* Sends a POST type ajax request
|
||||
*
|
||||
* @name post
|
||||
* @function
|
||||
* @function post
|
||||
* @memberOf $_
|
||||
* @param {string} url - The url to post to
|
||||
* @param {Object} data - post parameters to send
|
||||
@ -147,7 +143,35 @@
|
||||
* @param {function} [error_callback] - callback called if there is an error
|
||||
*/
|
||||
$_.ext('post', function (url, data, success_callback, error_callback){
|
||||
ajax._do(url, data, success_callback, error_callback, true);
|
||||
ajax._do(url, data, success_callback, error_callback, 'POST');
|
||||
});
|
||||
|
||||
/**
|
||||
* Sends a PUT type ajax request
|
||||
*
|
||||
* @function put
|
||||
* @memberOf $_
|
||||
* @param {string} url - The url to post to
|
||||
* @param {Object} data - PUT parameters to send
|
||||
* @param {function} success_callback - callback called on success
|
||||
* @param {function} [error_callback] - callback called if there is an error
|
||||
*/
|
||||
$_.ext('put', function (url, data, success_callback, error_callback){
|
||||
ajax._do(url, data, success_callback, error_callback, 'PUT');
|
||||
});
|
||||
|
||||
/**
|
||||
* Sends a DELETE type ajax request
|
||||
*
|
||||
* @function delete
|
||||
* @memberOf $_
|
||||
* @param {string} url - The url to post to
|
||||
* @param {Object} data - delete parameters to send
|
||||
* @param {function} success_callback - callback called on success
|
||||
* @param {function} [error_callback] - callback called if there is an error
|
||||
*/
|
||||
$_.ext('delete', function (url, data, success_callback, error_callback){
|
||||
ajax._do(url, data, success_callback, error_callback, 'DELETE');
|
||||
});
|
||||
}());
|
||||
</code></pre>
|
||||
@ -166,7 +190,7 @@
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Tue Sep 16 2014 16:57:40 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
@ -29,13 +29,19 @@
|
||||
Kis JS Keep It Simple JS Library
|
||||
Copyright Timothy J. Warren
|
||||
License Public Domain
|
||||
Version 0.8.0
|
||||
Version 0.9.0
|
||||
*/
|
||||
(function (undefined){
|
||||
|
||||
"use strict";
|
||||
|
||||
var $_, $, sel;
|
||||
/**
|
||||
* Current selector object
|
||||
*
|
||||
* @memberOf $_
|
||||
* @name el
|
||||
*/
|
||||
var sel;
|
||||
|
||||
|
||||
/**
|
||||
@ -49,7 +55,7 @@
|
||||
* @param {Object} [context] - Context of the dom selector string
|
||||
* @return {Object}
|
||||
*/
|
||||
$_ = function(s, context)
|
||||
var $_ = function(s, context)
|
||||
{
|
||||
// Have documentElement be default selector, just in case
|
||||
if (s === undefined)
|
||||
@ -92,7 +98,7 @@
|
||||
* @param {Object} [context]
|
||||
* @return {Object}
|
||||
*/
|
||||
$ = function (selector, context)
|
||||
var $ = function (selector, context)
|
||||
{
|
||||
var elements;
|
||||
|
||||
@ -120,6 +126,9 @@
|
||||
/**
|
||||
* Adds the property `obj` to the $_ object, calling it `name`
|
||||
*
|
||||
* @memberOf $_
|
||||
* @function ext
|
||||
* @example $_.ext('foo', {});
|
||||
* @param {string} name - name of the module
|
||||
* @param {object} obj - the object to add
|
||||
*/
|
||||
@ -132,11 +141,12 @@
|
||||
/**
|
||||
* Iterates over a $_ object, applying a callback to each item
|
||||
*
|
||||
* @name $_.each
|
||||
* @function
|
||||
* @memberOf $_
|
||||
* @function each
|
||||
* @example $_('form input').each(function(item) { alert(item) });
|
||||
* @param {function} callback - iteration callback
|
||||
*/
|
||||
$_.ext('each', function (callback)
|
||||
$_.ext('each', function(callback)
|
||||
{
|
||||
if(sel.length !== undefined && sel !== window)
|
||||
{
|
||||
@ -151,10 +161,13 @@
|
||||
/**
|
||||
* Retrieves the type of the passed variable
|
||||
*
|
||||
* @memberOf $_
|
||||
* @function type
|
||||
* @example $_.type([]); // Returns 'array'
|
||||
* @param {*} obj
|
||||
* @return {string}
|
||||
*/
|
||||
$_.type = function(obj)
|
||||
var type = function(obj)
|
||||
{
|
||||
if((function() {return obj && (obj !== this)}).call(obj))
|
||||
{
|
||||
@ -169,8 +182,8 @@
|
||||
//Set global variables
|
||||
$_ = window.$_ = window.$_ || $_;
|
||||
$_.$ = $;
|
||||
}());
|
||||
</code></pre>
|
||||
$_.type = type;
|
||||
}());</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
@ -186,7 +199,7 @@
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Tue Sep 16 2014 16:57:40 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
@ -105,7 +105,7 @@
|
||||
* @memberOf $_.event
|
||||
* @name create
|
||||
* @function
|
||||
* @example Eg. var event = $_("#selector").event.create('foo', {});
|
||||
* @example var event = $_("#selector").event.create('foo', {});
|
||||
* @param {string} name
|
||||
* @param {object} [data]
|
||||
* @return {Object}
|
||||
@ -113,12 +113,12 @@
|
||||
create: function(name, data)
|
||||
{
|
||||
data = data || {};
|
||||
|
||||
// Okay, I guess we have to do this the hard way... :(
|
||||
var e = document.createEvent('CustomEvent');
|
||||
e.initCustomEvent(name, true, true, data);
|
||||
|
||||
return e;
|
||||
// Okay, I guess we have to do this the hard way... :(
|
||||
var e = document.createEvent('CustomEvent');
|
||||
e.initCustomEvent(name, true, true, data);
|
||||
|
||||
return e;
|
||||
},
|
||||
/**
|
||||
* Adds an event that returns a callback when triggered on the selected
|
||||
@ -127,7 +127,7 @@
|
||||
* @memberOf $_.event
|
||||
* @name add
|
||||
* @function
|
||||
* @example Eg. $_("#selector").event.add("click", do_something());
|
||||
* @example $_("#selector").event.add("click", do_something());
|
||||
* @param {string} event
|
||||
* @param {function} callback
|
||||
*/
|
||||
@ -143,7 +143,7 @@
|
||||
* @memberOf $_.event
|
||||
* @name remove
|
||||
* @function
|
||||
* @example Eg. $_("#selector").event.remove("click", do_something());
|
||||
* @example $_("#selector").event.remove("click", do_something());
|
||||
* @param {string} event
|
||||
* @param {string} callback
|
||||
*/
|
||||
@ -159,7 +159,7 @@
|
||||
* @memberOf $_.event
|
||||
* @name live
|
||||
* @function
|
||||
* @example Eg. $_.event.live(".button", "click", do_something());
|
||||
* @example $_.event.live(".button", "click", do_something());
|
||||
* @param {string} target
|
||||
* @param {string} event
|
||||
* @param {function} callback
|
||||
@ -174,7 +174,7 @@
|
||||
* @memberOf $_.event
|
||||
* @name delegate
|
||||
* @function
|
||||
* @example Eg. $_("#parent").delegate(".button", "click", do_something());
|
||||
* @example $_("#parent").delegate(".button", "click", do_something());
|
||||
* @param {string} target
|
||||
* @param {string} event
|
||||
* @param {function} callback
|
||||
@ -191,14 +191,13 @@
|
||||
* @memberOf $_.event
|
||||
* @name trigger
|
||||
* @function
|
||||
* @example Eg. $_("#my_id").trigger('click');
|
||||
* @example $_("#my_id").trigger('click');
|
||||
* @param {object} event
|
||||
* @return {boolean}
|
||||
*/
|
||||
trigger: function(event)
|
||||
{
|
||||
var target = this.el;
|
||||
return target.dispatchEvent(event);
|
||||
return this.el.dispatchEvent(event);
|
||||
}
|
||||
};
|
||||
|
||||
@ -220,7 +219,7 @@
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Tue Sep 16 2014 16:57:40 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
@ -81,6 +81,8 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -89,20 +91,30 @@
|
||||
<dl>
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="data[undefined]"><span class="type-signature"></span>data[undefined]<span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="el"><span class="type-signature"></span>el<span class="type-signature"> :Object</span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<div class="description">
|
||||
Ajax
|
||||
$_
|
||||
|
||||
Module for making ajax requests
|
||||
Constructor function
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<h5>Type:</h5>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
<span class="param-type">Object</span>
|
||||
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
@ -127,7 +139,7 @@ Module for making ajax requests
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="ajax.js.html">modules/ajax.js</a>, <a href="ajax.js.html#line84">line 84</a>
|
||||
<a href="core.js.html">core.js</a>, <a href="core.js.html#line14">line 14</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -162,13 +174,13 @@ Module for making ajax requests
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul><h3>Global</h3><ul><li><a href="global.html#data[undefined]">data[undefined]</a></li></ul>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul><h3>Global</h3><ul> |