0.5.0 release

This commit is contained in:
Timothy Warren 2012-02-23 12:53:19 -05:00
parent 647e3f3d3d
commit d5779520d7
14 changed files with 29 additions and 254 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,78 +0,0 @@
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
.KEYW {color: #933;}
.COMM {color: #bbb; font-style: italic;}
.NUMB {color: #393;}
.STRN {color: #393;}
.REGX {color: #339;}
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
</style></head><body><pre><span class='line'> 1</span> <span class="COMM">/**
<span class='line'> 2</span> * Module for simplifying Indexed DB access
<span class='line'> 3</span> */</span><span class="WHIT">
<span class='line'> 4</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 5</span> </span><span class="WHIT"> </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 6</span> </span><span class="WHIT">
<span class='line'> 7</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">db</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window.indexedDB</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">window.webkitIndexedDB</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">window.mozIndexedDB</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">window.msIndexedDB</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 8</span> </span><span class="WHIT"> </span><span class="NAME">indexedDB</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 9</span> </span><span class="WHIT">
<span class='line'> 10</span> </span><span class="COMM">//Well, some browsers don't support it yet</span><span class="WHIT">
<span class='line'> 11</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">db</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 12</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 13</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 14</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 15</span>
<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="COMM">/**
<span class='line'> 17</span> * Module for simplifying Indexed DB access
<span class='line'> 18</span> *
<span class='line'> 19</span> * @namespace
<span class='line'> 20</span> * @name indexedDB
<span class='line'> 21</span> * @memberOf $_
<span class='line'> 22</span> */</span><span class="WHIT">
<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="NAME">indexedDB</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 24</span> </span><span class="WHIT"> </span><span class="NAME">current_db</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 25</span> </span><span class="WHIT"> </span><span class="COMM">/**
<span class='line'> 26</span> * Connects to an indexedDB database
<span class='line'> 27</span> *
<span class='line'> 28</span> * @memberOf $_.indexedDB
<span class='line'> 29</span> * @name connect
<span class='line'> 30</span> * @function
<span class='line'> 31</span> * @param string dbname
<span class='line'> 32</span> * @param [int] version
<span class='line'> 33</span> * @param [function] onupgradeneeded
<span class='line'> 34</span> */</span><span class="WHIT">
<span class='line'> 35</span> </span><span class="WHIT"> </span><span class="NAME">connect</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">dbname</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">version</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">onupgradeneeded</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">request</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 38</span> </span><span class="WHIT">
<span class='line'> 39</span> </span><span class="NAME">version</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">version</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 40</span> </span><span class="WHIT">
<span class='line'> 41</span> </span><span class="COMM">// Ask for permission to use db</span><span class="WHIT">
<span class='line'> 42</span> </span><span class="WHIT"> </span><span class="NAME">request</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">db.open</span><span class="PUNC">(</span><span class="NAME">dbname</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">version</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 43</span> </span><span class="WHIT">
<span class='line'> 44</span> </span><span class="COMM">// Assign onupgradeneeded callback</span><span class="WHIT">
<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">onupgradeneeded</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="NAME">request.onupgradeneeded</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">onupgradeneeded</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 49</span> </span><span class="WHIT">
<span class='line'> 50</span> </span><span class="COMM">/**
<span class='line'> 51</span> * @private
<span class='line'> 52</span> */</span><span class="WHIT">
<span class='line'> 53</span> </span><span class="NAME">request.onerror</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 54</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 55</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"IndexedDB disallowed."</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 56</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 57</span> </span><span class="WHIT">
<span class='line'> 58</span> </span><span class="COMM">/**
<span class='line'> 59</span> * @private
<span class='line'> 60</span> */</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT"> </span><span class="NAME">request.onsuccess</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 63</span> </span><span class="WHIT"> </span><span class="COMM">// Connect to the specified db</span><span class="WHIT">
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="NAME">indexedDB.current_db</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">request.result</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 66</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 67</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 68</span> </span><span class="WHIT">
<span class='line'> 69</span> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'indexedDB'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">indexedDB</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="WHIT">
<span class='line'> 71</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>

View File

@ -1180,80 +1180,6 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
// --------------------------------------------------------------------------
/**
* Module for simplifying Indexed DB access
*/
(function() {
"use strict";
var db = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.msIndexedDB,
indexedDB = {};
//Well, some browsers don't support it yet
if(typeof db === "undefined")
{
return;
}
/**
* Module for simplifying Indexed DB access
*
* @namespace
* @name indexedDB
* @memberOf $_
*/
indexedDB = {
current_db: null,
/**
* Connects to an indexedDB database
*
* @memberOf $_.indexedDB
* @name connect
* @function
* @param string dbname
* @param [int] version
* @param [function] onupgradeneeded
*/
connect: function(dbname, version, onupgradeneeded)
{
var request = {};
version = version || 0;
// Ask for permission to use db
request = db.open(dbname, version);
// Assign onupgradeneeded callback
if(typeof onupgradeneeded !== "undefined")
{
request.onupgradeneeded = onupgradeneeded;
}
/**
* @private
*/
request.onerror = function(event)
{
console.log("IndexedDB disallowed.");
};
/**
* @private
*/
request.onsuccess = function(event)
{
// Connect to the specified db
indexedDB.current_db = request.result;
};
}
};
$_.ext('indexedDB', indexedDB);
}());
// --------------------------------------------------------------------------
/**
* Store
*

41
kis-min.js vendored
View File

@ -1,26 +1,25 @@
(function(){if("undefined"!==typeof document.querySelector){var g,f,d,b;g=function(a){b="undefined"===typeof a?"undefined"!==typeof g.el?g.el:document.documentElement:"object"!==typeof a?f(a):a;g.prototype.el=b;var a=d(g),c;for(c in a)"object"===typeof a[c]&&(a[c].el=b);a.el=b;return a};f=function(a,c){var b;if("string"!=typeof a||"undefined"===typeof a)return a;b=null!=c&&1===c.nodeType?c:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);b=b.querySelectorAll(a);
return 1===b.length?b[0]:b};d=function(a){var c;if("undefined"!==typeof a){if("undefined"!==typeof Object.create)return Object.create(a);c=typeof a;if(!("object"!==c&&"function"!==c))return c=function(){},c.prototype=a,new c}};g.ext=function(a,c){c.el=b;g[a]=c};g.ext("each",function(a){if("undefined"!==typeof b.length&&b!==window){var c=b.length;if(0!==c)for(var e,d=0;d<c;d++)e=b.item(d)?b.item(d):b[d],a.call(e,e)}else a.call(b,b)});g.type=function(a){return function(){return a&&a!==this}.call(a)?
(typeof a).toLowerCase():{}.toString.call(a).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};g=window.$_=window.$_||g;g.$=f}})();
(function(){if("undefined"!==typeof document.querySelector){var f,g,d,b;f=function(a){b="undefined"===typeof a?"undefined"!==typeof f.el?f.el:document.documentElement:"object"!==typeof a?g(a):a;f.prototype.el=b;var a=d(f),c;for(c in a)"object"===typeof a[c]&&(a[c].el=b);a.el=b;return a};g=function(a,c){var b;if("string"!=typeof a||"undefined"===typeof a)return a;b=null!=c&&1===c.nodeType?c:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);b=b.querySelectorAll(a);
return 1===b.length?b[0]:b};d=function(a){var c;if("undefined"!==typeof a){if("undefined"!==typeof Object.create)return Object.create(a);c=typeof a;if(!("object"!==c&&"function"!==c))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("undefined"!==typeof b.length&&b!==window){var c=b.length;if(0!==c)for(var e,d=0;d<c;d++)e=b.item(d)?b.item(d):b[d],a.call(e,e)}else a.call(b,b)});f.type=function(a){return function(){return a&&a!==this}.call(a)?
(typeof a).toLowerCase():{}.toString.call(a).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};f=window.$_=window.$_||f;f.$=g}})();
(function(){"undefined"===typeof window.console&&(window.console={log:function(){}});"undefined"===typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")});"undefined"===typeof Event.preventDefault&&"undefined"!==typeof window.event&&(Event.prototype.preventDefault=function(){window.event.returnValue=!1},Event.prototype.stopPropagation=function(){window.event.cancelBubble=!0})})();
"undefined"!==typeof document&&!("classList"in document.createElement("a"))&&function(g){var g=(g.HTMLElement||g.Element).prototype,f=Object,d=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},b=Array.prototype.indexOf||function(a){for(var c=0,b=this.length;c<b;c++)if(c in this&&this[c]===a)return c;return-1},a=function(a,c){this.name=a;this.code=DOMException[a];this.message=c},c=function(c,e){if(""===e)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new a("INVALID_CHARACTER_ERR",
"undefined"!==typeof document&&!("classList"in document.createElement("a"))&&function(f){var f=(f.HTMLElement||f.Element).prototype,g=Object,d=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},b=Array.prototype.indexOf||function(a){for(var c=0,b=this.length;c<b;c++)if(c in this&&this[c]===a)return c;return-1},a=function(a,c){this.name=a;this.code=DOMException[a];this.message=c},c=function(c,e){if(""===e)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new a("INVALID_CHARACTER_ERR",
"String contains an invalid character");return b.call(c,e)},e=function(a){for(var c=d.call(a.className),c=c?c.split(/\s+/):[],b=0,e=c.length;b<e;b++)this.push(c[b]);this._updateClassName=function(){a.className=this.toString()}},j=e.prototype=[],i=function(){return new e(this)};a.prototype=Error.prototype;j.item=function(a){return this[a]||null};j.contains=function(a){return-1!==c(this,a+"")};j.add=function(a){a+="";-1===c(this,a)&&(this.push(a),this._updateClassName())};j.remove=function(a){a=c(this,
a+"");-1!==a&&(this.splice(a,1),this._updateClassName())};j.toggle=function(a){a+="";-1===c(this,a)?this.add(a):this.remove(a)};j.toString=function(){return this.join(" ")};if(f.defineProperty){j={get:i,enumerable:!0,configurable:!0};try{f.defineProperty(g,"classList",j)}catch(h){-2146823252===h.number&&(j.enumerable=!1,f.defineProperty(g,"classList",j))}}else f.prototype.__defineGetter__&&g.__defineGetter__("classList",i)}(self);
(function(){function g(b,a,c){var e,d;"undefined"!==typeof b.hasAttribute?(b.hasAttribute(a)&&(e=b.getAttribute(a)),d=!0):"undefined"!==typeof b[a]?(e=b[a],d=!1):"class"===a&&"undefined"!==typeof b.className&&(a="className",e=b.className,d=!1);if("undefined"===typeof e&&("undefined"===typeof c||null===c))console.log(c),console.log(b),console.log("Element does not have the selected attribute");else{if("undefined"===typeof c)return e;"undefined"!==typeof c&&null!==c?!0===d?b.setAttribute(a,c):b[a]=
c:null===c&&(!0===d?b.removeAttribute(a):delete b[a]);return"undefined"!==typeof c?c:e}}function f(b){return b.replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")})}function d(b,a,c){var e,a=f(a);e={outerHeight:"offsetHeight",outerWidth:"offsetWidth",top:"posTop"};if("undefined"===typeof c&&"undefined"!==b.style[a])return b.style[a];if("undefined"===typeof c&&"undefined"!==b.style[e[a]])return b.style[e[a]];"undefined"!==typeof b.style[a]?b.style[a]=c:b.style[e[a]]?b.style[e[a]]=
c:console.log("Property "+a+" nor an equivalent seems to exist")}$_.ext("dom",{addClass:function(b){$_.each(function(a){a.classList.add(b)})},removeClass:function(b){$_.each(function(a){a.classList.remove(b)})},hide:function(){this.css("display","none")},show:function(b){"undefined"===typeof b&&(b="block");this.css("display",b)},attr:function(b,a){var c=this.el;if(1<c.length&&"undefined"===typeof a)console.log(c),console.log("Must be a singular element");else if(1<c.length&&"undefined"!==typeof a)$_.each(function(c){return g(c,
b,a)});else return g(c,b,a)},text:function(b){var a,c,e;e=this.el;c="undefined"!==typeof e.textContent?"textContent":"undefined"!==typeof e.innerText?"innerText":"innerHTML";a=e[c];return"undefined"!==typeof b?e[c]=b:a},css:function(b,a){if("undefined"===typeof a)return d(this.el,b);$_.each(function(c){d(c,b,a)})},append:function(b){"undefined"!==typeof document.insertAdjacentHTML?this.el.insertAdjacentHTML("beforeend",b):this.el.innerHTML+=b},prepend:function(b){"undefined"!==typeof document.insertAdjacentHTML?
a+"");-1!==a&&(this.splice(a,1),this._updateClassName())};j.toggle=function(a){a+="";-1===c(this,a)?this.add(a):this.remove(a)};j.toString=function(){return this.join(" ")};if(g.defineProperty){j={get:i,enumerable:!0,configurable:!0};try{g.defineProperty(f,"classList",j)}catch(h){-2146823252===h.number&&(j.enumerable=!1,g.defineProperty(f,"classList",j))}}else g.prototype.__defineGetter__&&f.__defineGetter__("classList",i)}(self);
(function(){function f(b,a,c){var e,d;"undefined"!==typeof b.hasAttribute?(b.hasAttribute(a)&&(e=b.getAttribute(a)),d=!0):"undefined"!==typeof b[a]?(e=b[a],d=!1):"class"===a&&"undefined"!==typeof b.className&&(a="className",e=b.className,d=!1);if("undefined"===typeof e&&("undefined"===typeof c||null===c))console.log(c),console.log(b),console.log("Element does not have the selected attribute");else{if("undefined"===typeof c)return e;"undefined"!==typeof c&&null!==c?!0===d?b.setAttribute(a,c):b[a]=
c:null===c&&(!0===d?b.removeAttribute(a):delete b[a]);return"undefined"!==typeof c?c:e}}function g(b){return b.replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")})}function d(b,a,c){var e,a=g(a);e={outerHeight:"offsetHeight",outerWidth:"offsetWidth",top:"posTop"};if("undefined"===typeof c&&"undefined"!==b.style[a])return b.style[a];if("undefined"===typeof c&&"undefined"!==b.style[e[a]])return b.style[e[a]];"undefined"!==typeof b.style[a]?b.style[a]=c:b.style[e[a]]?b.style[e[a]]=
c:console.log("Property "+a+" nor an equivalent seems to exist")}$_.ext("dom",{addClass:function(b){$_.each(function(a){a.classList.add(b)})},removeClass:function(b){$_.each(function(a){a.classList.remove(b)})},hide:function(){this.css("display","none")},show:function(b){"undefined"===typeof b&&(b="block");this.css("display",b)},attr:function(b,a){var c=this.el;if(1<c.length&&"undefined"===typeof a)console.log(c),console.log("Must be a singular element");else if(1<c.length&&"undefined"!==typeof a)$_.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="undefined"!==typeof e.textContent?"textContent":"undefined"!==typeof e.innerText?"innerText":"innerHTML";a=e[c];return"undefined"!==typeof b?e[c]=b:a},css:function(b,a){if("undefined"===typeof a)return d(this.el,b);$_.each(function(c){d(c,b,a)})},append:function(b){"undefined"!==typeof document.insertAdjacentHTML?this.el.insertAdjacentHTML("beforeend",b):this.el.innerHTML+=b},prepend:function(b){"undefined"!==typeof document.insertAdjacentHTML?
this.el.insertAdjacentHTML("afterbegin",b):this.el.innerHTML=b+this.el.innerHTML},html:function(b){"undefined"!==typeof b&&(this.el.innerHTML=b);return this.el.innerHTML}})})();
(function(){if("undefined"!==typeof window.XMLHttpRequest){var g={_do:function(f,d,b,a){var c=new XMLHttpRequest;"undefined"===typeof b&&(b=function(){});a=a?"POST":"GET";f+="GET"===a?"?"+this._serialize(d):"";c.open(a,f);c.onreadystatechange=function(){4===c.readyState&&b(c.responseText)};"POST"===a?(c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(this._serialize(d))):c.send(null)},_serialize:function(f){var d,b,a=[];for(d in f)f.hasOwnProperty(d)&&"function"!==typeof f[d]&&
(b=f[d].toString(),d=encodeURIComponent(d),b=encodeURIComponent(b),a.push(d+"="+b));return a.join("&")}};$_.ext("get",function(f,d,b){g._do(f,d,b,!1)});$_.ext("post",function(f,d,b){g._do(f,d,b,!0)})}})();
(function(){var g,f,d,b;"undefined"!==typeof document.addEventListener?(g=function(a,c,b){"undefined"!==typeof a.addEventListener&&a.addEventListener(c,b,!1)},f=function(a,c,b){"undefined"!==typeof a.removeEventListener&&a.removeEventListener(c,b,!1)}):"undefined"!==typeof document.attachEvent&&(g=function(a,c,b){function d(a){b.apply(a)}"undefined"!==typeof a.attachEvent?(f(c,b),a.attachEvent("on"+c,d),a=a.KIS_0_5_0=a.KIS_0_5_0||{},a.listeners=a.listeners||{},a.listeners[c]=a.listeners[c]||[],a.listeners[c].push({callback:b,
_listener:d})):console.log("Failed to _attach event:"+c+" on "+a)},f=function(a,c,b){if("undefined"!==typeof a.detachEvent){var d=a.KIS_0_5_0;if(d&&d.listeners&&d.listeners[c])for(var f=d.listeners[c],g=f.length,k=0;k<g;k++)if(f[k].callback===b){a.detachEvent("on"+c,f[k]._listener);f.splice(k,1);0===f.length&&delete d.listeners[c];break}}});d=function(a,c,b,j){var i,h;if("undefined"===typeof a)return console.log(arguments),console.log(c),!1;if(c.match(/^([\w\-]+)$/))!0===j?g(a,c,b):f(a,c,b);else{c=
(function(){if("undefined"!==typeof window.XMLHttpRequest){var f={_do:function(g,d,b,a){var c=new XMLHttpRequest;"undefined"===typeof b&&(b=function(){});a=a?"POST":"GET";g+="GET"===a?"?"+this._serialize(d):"";c.open(a,g);c.onreadystatechange=function(){4===c.readyState&&b(c.responseText)};"POST"===a?(c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(this._serialize(d))):c.send(null)},_serialize:function(g){var d,b,a=[];for(d in g)g.hasOwnProperty(d)&&"function"!==typeof g[d]&&
(b=g[d].toString(),d=encodeURIComponent(d),b=encodeURIComponent(b),a.push(d+"="+b));return a.join("&")}};$_.ext("get",function(g,d,b){f._do(g,d,b,!1)});$_.ext("post",function(g,d,b){f._do(g,d,b,!0)})}})();
(function(){var f,g,d,b;"undefined"!==typeof document.addEventListener?(f=function(a,c,b){"undefined"!==typeof a.addEventListener&&a.addEventListener(c,b,!1)},g=function(a,c,b){"undefined"!==typeof a.removeEventListener&&a.removeEventListener(c,b,!1)}):"undefined"!==typeof document.attachEvent&&(f=function(a,c,b){function d(a){b.apply(a)}"undefined"!==typeof a.attachEvent?(g(c,b),a.attachEvent("on"+c,d),a=a.KIS_0_5_0=a.KIS_0_5_0||{},a.listeners=a.listeners||{},a.listeners[c]=a.listeners[c]||[],a.listeners[c].push({callback:b,
_listener:d})):console.log("Failed to _attach event:"+c+" on "+a)},g=function(a,c,b){if("undefined"!==typeof a.detachEvent){var d=a.KIS_0_5_0;if(d&&d.listeners&&d.listeners[c])for(var i=d.listeners[c],g=i.length,f=0;f<g;f++)if(i[f].callback===b){a.detachEvent("on"+c,i[f]._listener);i.splice(f,1);0===i.length&&delete d.listeners[c];break}}});d=function(a,c,b,j){var i,h;if("undefined"===typeof a)return console.log(arguments),console.log(c),!1;if(c.match(/^([\w\-]+)$/))!0===j?f(a,c,b):g(a,c,b);else{c=
c.split(" ");h=c.length;for(i=0;i<h;i++)d(a,c[i],b,j)}};b=function(a,c,b,f){d(a,b,function(b){var d,e,g,b=b||window.event;e=$_.$(c,a);for(d in e)g=b.target||b.srcElement,g==e[d]&&(f.call(e[d],b),b.stopPropagation())},!0)};$_.ext("event",{add:function(a,b){$_.each(function(e){d(e,a,b,!0)})},remove:function(a,b){$_.each(function(e){d(e,a,b,!1)})},live:function(a,c,d){b(document.documentElement,a,c,d)},delegate:function(a,c,d){$_.each(function(f){b(f,a,c,d)})}})})();
(function(){var g=window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.msIndexedDB,f={};"undefined"!==typeof g&&(f={current_db:null,connect:function(d,b,a){var c={},c=g.open(d,b||0);"undefined"!==typeof a&&(c.onupgradeneeded=a);c.onerror=function(){console.log("IndexedDB disallowed.")};c.onsuccess=function(){f.current_db=c.result}}},$_.ext("indexedDB",f))})();
(function(){if(!("undefined"===typeof localStorage||"undefined"===typeof JSON)){var g=localStorage,f=sessionStorage;$_.ext("store",{get:function(d,b){var a=b?f.getItem(d):g.getItem(d);return JSON.parse(a)},set:function(d,b,a){b=JSON.stringify(b);a?f.setItem(d,b):g.setItem(d,b)},remove:function(d,b){b?f.removeItem(d):g.removeItem(d)},getAll:function(d){var b,a={},c,e;e=d?g:f;b=e.length;for(d=0;d<b;d++)c=e.key(d),a[c]=e.getItem(c);return a},clear:function(d){d?f.clear():g.clear()}})}})();
(function(){if("undefined"!==$_.ajax){var g,f;g={};f={};$_.ext("template",{get:function(d){var b;b=this.el.innerHTML;if(""===b)console.log("Template is empty or cannot be found");else return g[d]=b},parse:function(d,b){var a=g[d],c=[],e=/\{([A-Z0-9_\-]+)\}(.*)\{\/\1\}/gim,j=/\{([A-Z0-9_\-]+)\}/gim,c=[],i=0,h=i=0,k=0,l="",o={},m="",n,a=(""+a).replace(/\s+/gim," "),a=a.replace(/>\s+</gim,"><"),a=a.replace(/>\s+\{/gim,">{"),a=a.replace(/\}\s+</gim,"}<"),c=a.match(e);if(null!=c){i=c.length;for(h=0;h<
i;h++){a=a.replace(c[h],"{"+h+"}");m="";l=(""+c[h]).match(/^\{([A-Z0-9_\-]+)\}/i);o=b[l[1]];if(0<o.length){l=o.length;c[h]=c[h].replace(e,"$2");for(k=0;k<l;k++)m+=c[h].replace(j,function(a,b){return o[k][b]?o[k][b]:""})}a=a.replace("{"+h+"}",m)}}c=a.match(j);if(null!=c){i=c.length;for(h=0;h<i;h++)l=c[h].replace("{",""),l=l.replace("}",""),a=a.replace(c[h],b[l])}e=document.createDocumentFragment();e.appendChild(document.createElement("section"));e=e.querySelectorAll("section")[0];e.innerHTML=a;e=e.querySelectorAll('[src=""], [href=""]');
for(n in e)e[n].parentNode&&e[n].parentNode.removeChild(e[n]);return f[d]=a},apply:function(d,b,a){"undefined"===typeof b&&"undefined"===typeof a?this.el.innerHTML="undefined"!==typeof f[d]?f[d]:d:$_.get(b,{},function(b){""===b?console.log("Template is empty or can not be found"):(g[d]=b,b=this.parse(d,a),f[d]=b,this.el.innerHTML=b)})}})}})();
(function(){var g=function(d){var b=[],a=0,c={},e,b=f.object_keys(d);b.sort(function(a,b){var c=parseFloat(b),d=parseFloat(a),e=c+""===b,f=d+""===a;return e&&f?c>d?1:c<d?-1:0:e&&!f?1:!e&&f?-1:b>a?1:b<a?-1:0});a=b.length;for(e=0;e<a;e++)c[b[e]]=d[b[e]];return c},f={object_keys:function(d){var b=[],a;for(a in d)d.hasOwnProperty(a)&&b.push(a);return b},object_values:function(d){var b=[],a;for(a in d)b.push(d[a]);return b},array_combine:function(d,b){var a={},c,e=0;"array"!==$_.type(d)&&(d=this.object_values(d));
(function(){if(!("undefined"===typeof localStorage||"undefined"===typeof JSON)){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)},getAll:function(d){var b,a={},c,e;e=d?f:g;b=e.length;for(d=0;d<b;d++)c=e.key(d),a[c]=e.getItem(c);return a},clear:function(d){d?g.clear():f.clear()}})}})();
(function(){if("undefined"!==$_.ajax){var f,g;f={};g={};$_.ext("template",{get:function(d){var b;b=this.el.innerHTML;if(""===b)console.log("Template is empty or cannot be found");else return f[d]=b},parse:function(d,b){var a=f[d],c=[],e=/\{([A-Z0-9_\-]+)\}(.*)\{\/\1\}/gim,j=/\{([A-Z0-9_\-]+)\}/gim,c=[],i=0,h=i=0,n=0,k="",o={},l="",m,a=(""+a).replace(/\s+/gim," "),a=a.replace(/>\s+</gim,"><"),a=a.replace(/>\s+\{/gim,">{"),a=a.replace(/\}\s+</gim,"}<"),c=a.match(e);if(null!=c){i=c.length;for(h=0;h<
i;h++){a=a.replace(c[h],"{"+h+"}");l="";k=(""+c[h]).match(/^\{([A-Z0-9_\-]+)\}/i);o=b[k[1]];if(0<o.length){k=o.length;c[h]=c[h].replace(e,"$2");for(n=0;n<k;n++)l+=c[h].replace(j,function(a,b){return o[n][b]?o[n][b]:""})}a=a.replace("{"+h+"}",l)}}c=a.match(j);if(null!=c){i=c.length;for(h=0;h<i;h++)k=c[h].replace("{",""),k=k.replace("}",""),a=a.replace(c[h],b[k])}e=document.createDocumentFragment();e.appendChild(document.createElement("section"));e=e.querySelectorAll("section")[0];e.innerHTML=a;e=e.querySelectorAll('[src=""], [href=""]');
for(m in e)e[m].parentNode&&e[m].parentNode.removeChild(e[m]);return g[d]=a},apply:function(d,b,a){"undefined"===typeof b&&"undefined"===typeof a?this.el.innerHTML="undefined"!==typeof g[d]?g[d]:d:$_.get(b,{},function(b){""===b?console.log("Template is empty or can not be found"):(f[d]=b,b=this.parse(d,a),g[d]=b,this.el.innerHTML=b)})}})}})();
(function(){var f=function(d){var b=[],a=0,c={},e,b=g.object_keys(d);b.sort(function(a,b){var c=parseFloat(b),d=parseFloat(a),e=c+""===b,f=d+""===a;return e&&f?c>d?1:c<d?-1:0:e&&!f?1:!e&&f?-1:b>a?1:b<a?-1:0});a=b.length;for(e=0;e<a;e++)c[b[e]]=d[b[e]];return c},g={object_keys:function(d){var b=[],a;for(a in d)d.hasOwnProperty(a)&&b.push(a);return b},object_values:function(d){var b=[],a;for(a in d)b.push(d[a]);return b},array_combine:function(d,b){var a={},c,e=0;"array"!==$_.type(d)&&(d=this.object_values(d));
"array"!==$_.type(b)&&(b=this.object_values(b));c=d.length;if(c!==b.length)return console.log("Object combine requires two arrays of the same size"),!1;for(e=0;e<c;e++)a[d[e]]=b[e];return a},object_merge:function(){var d=Array.prototype.slice.call(arguments),b=d.length,a={},c,e=0,f,g,h;c=!0;for(f=0;f<b;f++)if("array"!==$_.type(d[f])){c=!1;break}if(c){a=[];for(f=0;f<b;f++)a=a.contact(d[f]);return a}for(f=0,h=0;f<b;f++)if(c=d[f],"array"==$_.type(c))for(g=0,e=c.length;g<e;g++)a[h++]=c[g];else for(g in c)c.hasOwnProperty(g)&&
(parseInt(g,10)+""===g?a[h++]=c[g]:a[g]=c[g]);return a},str_trans:function(d,b,a){var c=[],e=[],f=!1,i=0,h=0,k="",l="",o="",m="",n;if("object"===typeof b){b=g(b);for(n in b)b.hasOwnProperty(n)&&(c.push(n),e.push(b[n]));b=c;a=e}h=d.length;i=b.length;k="string"===typeof a;l="string"===typeof b;for(c=0;c<h;c++){f=!1;if(l){d.charAt(c-1);o=d.charAt(c);d.charAt(c+1);for(e=0;e<i;e++)if(o==b.charAt(e)){f=!0;break}}else for(e=0;e<i;e++)if(d.substr(c,b[e].length)==b[e]){f=!0;c=c+b[e].length-1;break}m=f?m+(k?
a.charAt(e):a[e]):m+d.charAt(c)}return m}};$_.ext("util",f)})();
(parseInt(g,10)+""===g?a[h++]=c[g]:a[g]=c[g]);return a},str_trans:function(d,b,a){var c=[],e=[],g=!1,i=0,h=0,n="",k="",o="",l="",m;if("object"===typeof b){b=f(b);for(m in b)b.hasOwnProperty(m)&&(c.push(m),e.push(b[m]));b=c;a=e}h=d.length;i=b.length;n="string"===typeof a;k="string"===typeof b;for(c=0;c<h;c++){g=!1;if(k){d.charAt(c-1);o=d.charAt(c);d.charAt(c+1);for(e=0;e<i;e++)if(o==b.charAt(e)){g=!0;break}}else for(e=0;e<i;e++)if(d.substr(c,b[e].length)==b[e]){g=!0;c=c+b[e].length-1;break}l=g?l+(n?
a.charAt(e):a[e]):l+d.charAt(c)}return l}};$_.ext("util",g)})();

View File

@ -1,71 +0,0 @@
/**
* Module for simplifying Indexed DB access
*/
(function() {
"use strict";
var db = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.msIndexedDB,
indexedDB = {};
//Well, some browsers don't support it yet
if(typeof db === "undefined")
{
return;
}
/**
* Module for simplifying Indexed DB access
*
* @namespace
* @name indexedDB
* @memberOf $_
*/
indexedDB = {
current_db: null,
/**
* Connects to an indexedDB database
*
* @memberOf $_.indexedDB
* @name connect
* @function
* @param string dbname
* @param [int] version
* @param [function] onupgradeneeded
*/
connect: function(dbname, version, onupgradeneeded)
{
var request = {};
version = version || 0;
// Ask for permission to use db
request = db.open(dbname, version);
// Assign onupgradeneeded callback
if(typeof onupgradeneeded !== "undefined")
{
request.onupgradeneeded = onupgradeneeded;
}
/**
* @private
*/
request.onerror = function(event)
{
console.log("IndexedDB disallowed.");
};
/**
* @private
*/
request.onsuccess = function(event)
{
// Connect to the specified db
indexedDB.current_db = request.result;
};
}
};
$_.ext('indexedDB', indexedDB);
}());