Remove extraneous IIFEs in concatenated file, remove indexedJS module

This commit is contained in:
Timothy Warren 2012-04-05 18:39:10 -04:00
parent 08f1e03f23
commit 000b462b17
13 changed files with 262 additions and 407 deletions

View File

@ -8,7 +8,7 @@
</style></head><body><pre><span class='line'> 1</span> <span class="COMM">/** </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'> 2</span> * Module for simplifying Indexed DB access
<span class='line'> 3</span> */</span><span class="WHIT"> <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'> 4</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</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'> 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'> 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'> 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">

View File

@ -11,7 +11,7 @@
<span class='line'> 4</span> * Various object and string manipulation functions <span class='line'> 4</span> * Various object and string manipulation functions
<span class='line'> 5</span> * Note: these are based on similar phpjs functions: http://phpjs.org <span class='line'> 5</span> * Note: these are based on similar phpjs functions: http://phpjs.org
<span class='line'> 6</span> */</span><span class="WHIT"> <span class='line'> 6</span> */</span><span class="WHIT">
<span class='line'> 7</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> <span class='line'> 7</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 8</span> <span class='line'> 8</span>
<span class='line'> 9</span> </span><span class="WHIT"> </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'> 9</span> </span><span class="WHIT"> </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 10</span> <span class='line'> 10</span>

View File

@ -223,66 +223,69 @@
* A module of various browser polyfills * A module of various browser polyfills
* @file polyfill.js * @file polyfill.js
*/ */
(function(){
"use strict"; // Console.log polyfill for IE 8 stupidity
if(typeof window.console === "undefined")
{
window.console = {
log:function(){}
};
}
// 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")
{
/** /**
* String trim function polyfill
*/
if(typeof String.prototype.trim === "undefined")
{
/**
* @private
*/
String.prototype.trim = function()
{
return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, "");
};
}
// --------------------------------------------------------------------------
/**
* event.preventDefault/e.stopPropagation polyfill
* @private * @private
*/ */
if(typeof Event.preventDefault === "undefined" && typeof window.event !== "undefined") String.prototype.trim = function()
{ {
Event.prototype.preventDefault = function() return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, "");
{ };
window.event.returnValue = false; }
},
Event.prototype.stopPropagation = function()
{
window.event.cancelBubble = true;
}
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
* Array.isArray polyfill * event.preventDefault/e.stopPropagation polyfill
*/ * @private
if (typeof [].isArray === "undefined") */
if(typeof Event.preventDefault === "undefined" && typeof window.event !== "undefined")
{
Event.prototype.preventDefault = function()
{ {
Array.isArray = function(v) window.event.returnValue = false;
{ },
return Object.prototype.toString.apply(v) === '[object Array]'; Event.prototype.stopPropagation = function()
} {
window.event.cancelBubble = true;
} }
}
}()); // --------------------------------------------------------------------------
/**
* Array.isArray polyfill
*/
if (typeof Array.isArray === "undefined")
{
Array.isArray = function(v)
{
return Object.prototype.toString.apply(v) === '[object Array]';
}
}
// --------------------------------------------------------------------------
(function ($_){
"use strict"
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@ -458,9 +461,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
* *
* Dom manipulation module * Dom manipulation module
*/ */
(function (){
"use strict";
var d; var d;
@ -825,7 +826,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
$_.ext('dom', d); $_.ext('dom', d);
}());
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@ -834,9 +835,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
* *
* Module for making ajax requests * Module for making ajax requests
*/ */
(function (){
"use strict";
// Don't bother even defining the object if the XMLHttpRequest isn't available // Don't bother even defining the object if the XMLHttpRequest isn't available
if(typeof window.XMLHttpRequest === "undefined") if(typeof window.XMLHttpRequest === "undefined")
@ -976,7 +975,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
} }
}); });
}());
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@ -986,9 +985,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
* Event api wrapper * Event api wrapper
* @todo Add method for triggering events * @todo Add method for triggering events
*/ */
(function (){
"use strict";
// Property name for expandos on DOM objects // Property name for expandos on DOM objects
var kis_expando = "KIS_0_6_0"; var kis_expando = "KIS_0_6_0";
@ -1234,15 +1231,13 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
$_.ext('event', e); $_.ext('event', e);
}());
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
* Module for simplifying Indexed DB access * Module for simplifying Indexed DB access
*/ */
(function() {
"use strict";
var db = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.msIndexedDB, var db = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.msIndexedDB,
indexedDB = {}; indexedDB = {};
@ -1352,7 +1347,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
$_.ext('indexedDB', indexedDB); $_.ext('indexedDB', indexedDB);
}());
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@ -1361,9 +1356,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
* *
* Wrapper for local / sessionstorage * Wrapper for local / sessionstorage
*/ */
(function (){
"use strict";
//No support for localstorage? Bail out early //No support for localstorage? Bail out early
if(typeof localStorage === "undefined" || typeof JSON === "undefined") if(typeof localStorage === "undefined" || typeof JSON === "undefined")
@ -1480,7 +1473,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
}; };
$_.ext('store', store); $_.ext('store', store);
}());
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@ -1490,9 +1483,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
* Various object and string manipulation functions * Various object and string manipulation functions
* Note: these are based on similar phpjs functions: http://phpjs.org * Note: these are based on similar phpjs functions: http://phpjs.org
*/ */
(function(){
"use strict";
var reverse_key_sort = function(o) var reverse_key_sort = function(o)
{ {
@ -1843,5 +1834,6 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
//Add it to the $_ object //Add it to the $_ object
$_.ext('util', u); $_.ext('util', u);
}());
}($_));

31
kis-lite-dom-min.js vendored
View File

@ -1,18 +1,17 @@
(function(){if("undefined"!==typeof document.querySelector){var c,g,e,b;c=function(a){b="undefined"===typeof a?"undefined"!==typeof c.el?c.el:document.documentElement:"object"!==typeof a?g(a):a;c.prototype.el=b;var a=e(c),d;for(d in a)"object"===typeof a[d]&&(a[d].el=b);a.el=b;return a};g=function(a,d){var b;if("string"!=typeof a||"undefined"===typeof a)return a;b=null!=d&&1===d.nodeType?d:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);b=b.querySelectorAll(a); (function(){if("undefined"!==typeof document.querySelector){var c,g,e,b;c=function(a){b="undefined"===typeof a?"undefined"!==typeof c.el?c.el:document.documentElement:"object"!==typeof a?g(a):a;c.prototype.el=b;var a=e(c),d;for(d in a)"object"===typeof a[d]&&(a[d].el=b);a.el=b;return a};g=function(a,d){var b;if("string"!=typeof a||"undefined"===typeof a)return a;b=null!=d&&1===d.nodeType?d:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);b=b.querySelectorAll(a);
return 1===b.length?b[0]:b};e=function(a){var d;if("undefined"!==typeof a){if("undefined"!==typeof Object.create)return Object.create(a);d=typeof a;if(!("object"!==d&&"function"!==d))return d=function(){},d.prototype=a,new d}};c.ext=function(a,d){d.el=b;c[a]=d};c.ext("each",function(a){if("undefined"!==typeof b.length&&b!==window)if("undefined"!==typeof Array.prototype.forEach)[].forEach.call(b,a);else{var d=b.length;if(0!==d)for(var h,f=0;f<d;f++)h=b.item(f)?b.item(f):b[f],a.call(h,h)}else a.call(b, return 1===b.length?b[0]:b};e=function(a){var d;if("undefined"!==typeof a){if("undefined"!==typeof Object.create)return Object.create(a);d=typeof a;if(!("object"!==d&&"function"!==d))return d=function(){},d.prototype=a,new d}};c.ext=function(a,d){d.el=b;c[a]=d};c.ext("each",function(a){if("undefined"!==typeof b.length&&b!==window)if("undefined"!==typeof Array.prototype.forEach)[].forEach.call(b,a);else{var d=b.length;if(0!==d)for(var h,f=0;f<d;f++)h=b.item(f)?b.item(f):b[f],a.call(h,h)}else a.call(b,
b)});c.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()};c=window.$_=window.$_||c;c.$=g}})(); b)});c.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()};c=window.$_=window.$_||c;c.$=g}})();"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,"")});
(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=false},Event.prototype.stopPropagation=function(){window.event.cancelBubble=true});"undefined"===typeof[].isArray&&(Array.isArray=function(c){return Object.prototype.toString.apply(c)=== "undefined"===typeof Event.preventDefault&&"undefined"!==typeof window.event&&(Event.prototype.preventDefault=function(){window.event.returnValue=false},Event.prototype.stopPropagation=function(){window.event.cancelBubble=true});"undefined"===typeof Array.isArray&&(Array.isArray=function(c){return Object.prototype.toString.apply(c)==="[object Array]"});
"[object Array]"})})(); (function(){if(typeof window.XMLHttpRequest!=="undefined"){var c={_do:function(g,c,b,a){var d=new XMLHttpRequest;typeof b==="undefined"&&(b=function(){});a=a?"POST":"GET";g=g+(a==="GET"?"?"+this._serialize(c):"");d.open(a,g);d.onreadystatechange=function(){d.readyState===4&&b(d.responseText)};if(a==="POST"){d.setRequestHeader("Content-Type","application/x-www-form-urlencoded");d.send(this._serialize(c))}else d.send(null)},_serialize:function(c){var e,b,a=[];for(e in c)if(c.hasOwnProperty(e)&&typeof c[e]!==
(function(){if("undefined"!==typeof window.XMLHttpRequest){var c={_do:function(g,c,b,a){var d=new XMLHttpRequest;"undefined"===typeof b&&(b=function(){});a=a?"POST":"GET";g+="GET"===a?"?"+this._serialize(c):"";d.open(a,g);d.onreadystatechange=function(){4===d.readyState&&b(d.responseText)};"POST"===a?(d.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),d.send(this._serialize(c))):d.send(null)},_serialize:function(c){var e,b,a=[];for(e in c)c.hasOwnProperty(e)&&"function"!==typeof c[e]&& "function"){b=c[e].toString();e=encodeURIComponent(e);b=encodeURIComponent(b);a.push(e+"="+b)}return a.join("&")}};$_.ext("get",function(g,e,b){c._do(g,e,b,false)});$_.ext("post",function(g,e,b){c._do(g,e,b,true)});$_.ext("sse",function(c,e,b){if(typeof EventSource!=="undefined"){c=new EventSource(c);c.onmessage=function(a){e(a.data)}}else setInterval($_.get,b||3E4,c,{},function(a){a.trim().replace(/data:/gim,"");a.replace(/^event|id|retry?:(.*)$/gim,"");e(a)})})}})();
(b=c[e].toString(),e=encodeURIComponent(e),b=encodeURIComponent(b),a.push(e+"="+b));return a.join("&")}};$_.ext("get",function(g,e,b){c._do(g,e,b,!1)});$_.ext("post",function(g,e,b){c._do(g,e,b,!0)});$_.ext("sse",function(c,e,b){"undefined"!==typeof EventSource?(c=new EventSource(c),c.onmessage=function(a){e(a.data)}):setInterval($_.get,b||3E4,c,{},function(a){a.trim().replace(/data:/gim,"");a.replace(/^event|id|retry?:(.*)$/gim,"");e(a)})})}})(); (function(){var c,g,e,b;if(typeof document.addEventListener!=="undefined"){c=function(a,d,b){typeof a.addEventListener!=="undefined"&&a.addEventListener(d,b,false)};g=function(a,d,b){typeof a.removeEventListener!=="undefined"&&a.removeEventListener(d,b,false)}}else if(typeof document.attachEvent!=="undefined"){c=function(a,b,h){function c(a){h.apply(a)}if(typeof a.attachEvent!=="undefined"){g(b,h);a.attachEvent("on"+b,c);a=a.KIS_0_6_0=a.KIS_0_6_0||{};a.listeners=a.listeners||{};a.listeners[b]=a.listeners[b]||
(function(){var c,g,e,b;"undefined"!==typeof document.addEventListener?(c=function(a,d,b){"undefined"!==typeof a.addEventListener&&a.addEventListener(d,b,!1)},g=function(a,d,b){"undefined"!==typeof a.removeEventListener&&a.removeEventListener(d,b,!1)}):"undefined"!==typeof document.attachEvent&&(c=function(a,b,h){function c(a){h.apply(a)}"undefined"!==typeof a.attachEvent?(g(b,h),a.attachEvent("on"+b,c),a=a.KIS_0_6_0=a.KIS_0_6_0||{},a.listeners=a.listeners||{},a.listeners[b]=a.listeners[b]||[],a.listeners[b].push({callback:h, [];a.listeners[b].push({callback:h,_listener:c})}else console.log("Failed to _attach event:"+b+" on "+a)};g=function(a,b,c){if(typeof a.detachEvent!=="undefined"){var f=a.KIS_0_6_0;if(f&&f.listeners&&f.listeners[b])for(var e=f.listeners[b],g=e.length,i=0;i<g;i++)if(e[i].callback===c){a.detachEvent("on"+b,e[i]._listener);e.splice(i,1);e.length===0&&delete f.listeners[b];break}}}}e=function(a,b,h,f){var j,k;if(typeof a==="undefined"){console.log(arguments);console.log(b);return false}if(b.match(/^([\w\-]+)$/))f===
_listener:c})):console.log("Failed to _attach event:"+b+" on "+a)},g=function(a,b,c){if("undefined"!==typeof a.detachEvent){var f=a.KIS_0_6_0;if(f&&f.listeners&&f.listeners[b])for(var e=f.listeners[b],g=e.length,i=0;i<g;i++)if(e[i].callback===c){a.detachEvent("on"+b,e[i]._listener);e.splice(i,1);0===e.length&&delete f.listeners[b];break}}});e=function(a,b,h,f){var j,k;if(typeof a==="undefined"){console.log(arguments);console.log(b);return false}if(b.match(/^([\w\-]+)$/))f===true?c(a,b,h):g(a,b,h); true?c(a,b,h):g(a,b,h);else{b=b.split(" ");k=b.length;for(j=0;j<k;j++)e(a,b[j],h,f)}};b=function(a,b,c,f){e(a,c,function(c){var h,i,e,c=c||window.event;i=$_.$(b,a);for(h in i){e=c.target||c.srcElement;if(e==i[h]){f.call(i[h],c);c.stopPropagation()}}},true)};$_.ext("event",{add:function(a,b){$_.each(function(c){e(c,a,b,true)})},remove:function(a,b){$_.each(function(c){e(c,a,b,false)})},live:function(a,d,c){b(document.documentElement,a,d,c)},delegate:function(a,d,c){$_.each(function(e){b(e,a,d,c)})}})})();
else{b=b.split(" ");k=b.length;for(j=0;j<k;j++)e(a,b[j],h,f)}};b=function(a,b,c,f){e(a,c,function(c){var h,i,e,c=c||window.event;i=$_.$(b,a);for(h in i){e=c.target||c.srcElement;if(e==i[h]){f.call(i[h],c);c.stopPropagation()}}},true)};$_.ext("event",{add:function(a,b){$_.each(function(c){e(c,a,b,true)})},remove:function(a,b){$_.each(function(c){e(c,a,b,false)})},live:function(a,d,c){b(document.documentElement,a,d,c)},delegate:function(a,d,c){$_.each(function(e){b(e,a,d,c)})}})})(); "undefined"!==typeof document&&!("classList"in document.createElement("a"))&&function(c){var c=(c.HTMLElement||c.Element).prototype,g=Object,e=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},b=Array.prototype.indexOf||function(a){for(var b=0,d=this.length;b<d;b++)if(b in this&&this[b]===a)return b;return-1},a=function(a,b){this.name=a;this.code=DOMException[a];this.message=b},d=function(d,c){if(c==="")throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(c))throw new a("INVALID_CHARACTER_ERR",
"undefined"!==typeof document&&!("classList"in document.createElement("a"))&&function(c){var c=(c.HTMLElement||c.Element).prototype,g=Object,e=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},b=Array.prototype.indexOf||function(a){for(var b=0,d=this.length;b<d;b++)if(b in this&&this[b]===a)return b;return-1},a=function(a,b){this.name=a;this.code=DOMException[a];this.message=b},d=function(d,c){if(""===c)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(c))throw new a("INVALID_CHARACTER_ERR", "String contains an invalid character");return b.call(d,c)},h=function(a){for(var b=e.call(a.className),b=b?b.split(/\s+/):[],d=0,c=b.length;d<c;d++)this.push(b[d]);this._updateClassName=function(){a.className=this.toString()}},f=h.prototype=[],j=function(){return new h(this)};a.prototype=Error.prototype;f.item=function(a){return this[a]||null};f.contains=function(a){return d(this,a+"")!==-1};f.add=function(a){a=a+"";if(d(this,a)===-1){this.push(a);this._updateClassName()}};f.remove=function(a){a=
"String contains an invalid character");return b.call(d,c)},h=function(a){for(var b=e.call(a.className),b=b?b.split(/\s+/):[],d=0,c=b.length;d<c;d++)this.push(b[d]);this._updateClassName=function(){a.className=this.toString()}},f=h.prototype=[],j=function(){return new h(this)};a.prototype=Error.prototype;f.item=function(a){return this[a]||null};f.contains=function(a){return-1!==d(this,a+"")};f.add=function(a){a+="";-1===d(this,a)&&(this.push(a),this._updateClassName())};f.remove=function(a){a=d(this, d(this,a+"");if(a!==-1){this.splice(a,1);this._updateClassName()}};f.toggle=function(a){a=a+"";d(this,a)===-1?this.add(a):this.remove(a)};f.toString=function(){return this.join(" ")};if(g.defineProperty){f={get:j,enumerable:true,configurable:true};try{g.defineProperty(c,"classList",f)}catch(k){if(k.number===-2146823252){f.enumerable=false;g.defineProperty(c,"classList",f)}}}else g.prototype.__defineGetter__&&c.__defineGetter__("classList",j)}(self);
a+"");-1!==a&&(this.splice(a,1),this._updateClassName())};f.toggle=function(a){a+="";-1===d(this,a)?this.add(a):this.remove(a)};f.toString=function(){return this.join(" ")};if(g.defineProperty){f={get:j,enumerable:!0,configurable:!0};try{g.defineProperty(c,"classList",f)}catch(k){-2146823252===k.number&&(f.enumerable=!1,g.defineProperty(c,"classList",f))}}else g.prototype.__defineGetter__&&c.__defineGetter__("classList",j)}(self); (function(){function c(b,a,d){var c,e;if(typeof b.hasAttribute!=="undefined"){b.hasAttribute(a)&&(c=b.getAttribute(a));e=true}else if(typeof b[a]!=="undefined"){c=b[a];e=false}else if(a==="class"&&typeof b.className!=="undefined"){a="className";c=b.className;e=false}if(typeof c==="undefined"&&(typeof d==="undefined"||d===null)){console.log(d);console.log(b);console.log("Element does not have the selected attribute");return null}if(typeof d==="undefined")return c;typeof d!=="undefined"&&d!==null?e===
(function(){function c(b,a,d){var c,e;"undefined"!==typeof b.hasAttribute?(b.hasAttribute(a)&&(c=b.getAttribute(a)),e=!0):"undefined"!==typeof b[a]?(c=b[a],e=!1):"class"===a&&"undefined"!==typeof b.className&&(a="className",c=b.className,e=!1);if("undefined"===typeof c&&("undefined"===typeof d||null===d))return console.log(d),console.log(b),console.log("Element does not have the selected attribute"),null;if("undefined"===typeof d)return c;"undefined"!==typeof d&&null!==d?!0===e?b.setAttribute(a,d): true?b.setAttribute(a,d):b[a]=d:d===null&&(e===true?b.removeAttribute(a):delete b[a]);return typeof d!=="undefined"?d:c}function g(b){return b.replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")})}function e(b,a,c){var e,a=g(a);e={outerHeight:"offsetHeight",outerWidth:"offsetWidth",top:"posTop"};if(typeof c==="undefined"&&b.style[a]!=="undefined")return b.style[a];if(typeof c==="undefined"&&b.style[e[a]]!=="undefined")return b.style[e[a]];if(typeof b.style[a]!=="undefined"){b.style[a]=
b[a]=d:null===d&&(!0===e?b.removeAttribute(a):delete b[a]);return"undefined"!==typeof d?d:c}function g(b){return b.replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")})}function e(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]];if("undefined"!==typeof b.style[a])return b.style[a]=c,null;if(b.style[e[a]])return b.style[e[a]]= c;return null}if(b.style[e[a]]){b.style[e[a]]=c;return null}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){typeof b==="undefined"&&(b="block");this.css("display",b)},attr:function(b,a){var d=this.el;if(d.length>1&&typeof a==="undefined"){console.log(d);console.log("Must be a singular element")}else if(d.length>
c,null;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 d=this.el;if(1<d.length&&"undefined"===typeof a)console.log(d),console.log("Must be a singular element");else if(1<d.length&&"undefined"!==typeof a)$_.each(function(d){return c(d, 1&&typeof a!=="undefined")$_.each(function(d){return c(d,b,a)});else return c(d,b,a)},text:function(b){var a,c,e;e=this.el;c=typeof e.textContent!=="undefined"?"textContent":typeof e.innerText!=="undefined"?"innerText":"innerHTML";a=e[c];if(typeof b!=="undefined")return e[c]=b;return a},css:function(b,a){if(typeof a==="undefined")return e(this.el,b);$_.each(function(c){e(c,b,a)})},append:function(b){typeof document.insertAdjacentHTML!=="undefined"?this.el.insertAdjacentHTML("beforeend",b):this.el.innerHTML=
b,a)});else return c(d,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 e(this.el,b);$_.each(function(c){e(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.innerHTML+b},prepend:function(b){typeof document.insertAdjacentHTML!=="undefined"?this.el.insertAdjacentHTML("afterbegin",b):this.el.innerHTML=b+this.el.innerHTML},html:function(b){if(typeof b!=="undefined")this.el.innerHTML=b;return this.el.innerHTML}})})();
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}})})();

View File

@ -223,66 +223,61 @@
* A module of various browser polyfills * A module of various browser polyfills
* @file polyfill.js * @file polyfill.js
*/ */
(function(){
"use strict"; // Console.log polyfill for IE 8 stupidity
if(typeof window.console === "undefined")
{
window.console = {
log:function(){}
};
}
// 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")
{
/** /**
* String trim function polyfill
*/
if(typeof String.prototype.trim === "undefined")
{
/**
* @private
*/
String.prototype.trim = function()
{
return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, "");
};
}
// --------------------------------------------------------------------------
/**
* event.preventDefault/e.stopPropagation polyfill
* @private * @private
*/ */
if(typeof Event.preventDefault === "undefined" && typeof window.event !== "undefined") String.prototype.trim = function()
{ {
Event.prototype.preventDefault = function() return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, "");
{ };
window.event.returnValue = false; }
},
Event.prototype.stopPropagation = function()
{
window.event.cancelBubble = true;
}
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
* Array.isArray polyfill * event.preventDefault/e.stopPropagation polyfill
*/ * @private
if (typeof [].isArray === "undefined") */
if(typeof Event.preventDefault === "undefined" && typeof window.event !== "undefined")
{
Event.prototype.preventDefault = function()
{ {
Array.isArray = function(v) window.event.returnValue = false;
{ },
return Object.prototype.toString.apply(v) === '[object Array]'; Event.prototype.stopPropagation = function()
} {
window.event.cancelBubble = true;
} }
}
}()); // --------------------------------------------------------------------------
/**
* Array.isArray polyfill
*/
if (typeof Array.isArray === "undefined")
{
Array.isArray = function(v)
{
return Object.prototype.toString.apply(v) === '[object Array]';
}
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

15
kis-lite-min.js vendored
View File

@ -1,10 +1,9 @@
(function(){if("undefined"!==typeof document.querySelector){var f,d,e,c;f=function(a){c="undefined"===typeof a?"undefined"!==typeof f.el?f.el:document.documentElement:"object"!==typeof a?d(a):a;f.prototype.el=c;var a=e(f),b;for(b in a)"object"===typeof a[b]&&(a[b].el=c);a.el=c;return a};d=function(a,b){var g;if("string"!=typeof a||"undefined"===typeof a)return a;g=null!=b&&1===b.nodeType?b:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);g=g.querySelectorAll(a); (function(){if("undefined"!==typeof document.querySelector){var f,d,e,c;f=function(a){c="undefined"===typeof a?"undefined"!==typeof f.el?f.el:document.documentElement:"object"!==typeof a?d(a):a;f.prototype.el=c;var a=e(f),b;for(b in a)"object"===typeof a[b]&&(a[b].el=c);a.el=c;return a};d=function(a,b){var g;if("string"!=typeof a||"undefined"===typeof a)return a;g=null!=b&&1===b.nodeType?b:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);g=g.querySelectorAll(a);
return 1===g.length?g[0]:g};e=function(a){var b;if("undefined"!==typeof a){if("undefined"!==typeof Object.create)return Object.create(a);b=typeof a;if(!("object"!==b&&"function"!==b))return b=function(){},b.prototype=a,new b}};f.ext=function(a,b){b.el=c;f[a]=b};f.ext("each",function(a){if("undefined"!==typeof c.length&&c!==window)if("undefined"!==typeof Array.prototype.forEach)[].forEach.call(c,a);else{var b=c.length;if(0!==b)for(var g,d=0;d<b;d++)g=c.item(d)?c.item(d):c[d],a.call(g,g)}else a.call(c, return 1===g.length?g[0]:g};e=function(a){var b;if("undefined"!==typeof a){if("undefined"!==typeof Object.create)return Object.create(a);b=typeof a;if(!("object"!==b&&"function"!==b))return b=function(){},b.prototype=a,new b}};f.ext=function(a,b){b.el=c;f[a]=b};f.ext("each",function(a){if("undefined"!==typeof c.length&&c!==window)if("undefined"!==typeof Array.prototype.forEach)[].forEach.call(c,a);else{var b=c.length;if(0!==b)for(var g,d=0;d<b;d++)g=c.item(d)?c.item(d):c[d],a.call(g,g)}else a.call(c,
c)});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.$=d}})(); c)});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.$=d}})();"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,"")});
(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=false},Event.prototype.stopPropagation=function(){window.event.cancelBubble=true});"undefined"===typeof[].isArray&&(Array.isArray=function(f){return Object.prototype.toString.apply(f)=== "undefined"===typeof Event.preventDefault&&"undefined"!==typeof window.event&&(Event.prototype.preventDefault=function(){window.event.returnValue=false},Event.prototype.stopPropagation=function(){window.event.cancelBubble=true});"undefined"===typeof Array.isArray&&(Array.isArray=function(f){return Object.prototype.toString.apply(f)==="[object Array]"});
"[object Array]"})})(); (function(){if(typeof window.XMLHttpRequest!=="undefined"){var f={_do:function(d,e,c,a){var b=new XMLHttpRequest;typeof c==="undefined"&&(c=function(){});a=a?"POST":"GET";d=d+(a==="GET"?"?"+this._serialize(e):"");b.open(a,d);b.onreadystatechange=function(){b.readyState===4&&c(b.responseText)};if(a==="POST"){b.setRequestHeader("Content-Type","application/x-www-form-urlencoded");b.send(this._serialize(e))}else b.send(null)},_serialize:function(d){var e,c,a=[];for(e in d)if(d.hasOwnProperty(e)&&typeof d[e]!==
(function(){if("undefined"!==typeof window.XMLHttpRequest){var f={_do:function(d,e,c,a){var b=new XMLHttpRequest;"undefined"===typeof c&&(c=function(){});a=a?"POST":"GET";d+="GET"===a?"?"+this._serialize(e):"";b.open(a,d);b.onreadystatechange=function(){4===b.readyState&&c(b.responseText)};"POST"===a?(b.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),b.send(this._serialize(e))):b.send(null)},_serialize:function(d){var e,c,a=[];for(e in d)d.hasOwnProperty(e)&&"function"!==typeof d[e]&& "function"){c=d[e].toString();e=encodeURIComponent(e);c=encodeURIComponent(c);a.push(e+"="+c)}return a.join("&")}};$_.ext("get",function(d,e,c){f._do(d,e,c,false)});$_.ext("post",function(d,e,c){f._do(d,e,c,true)});$_.ext("sse",function(d,e,c){if(typeof EventSource!=="undefined"){d=new EventSource(d);d.onmessage=function(a){e(a.data)}}else setInterval($_.get,c||3E4,d,{},function(a){a.trim().replace(/data:/gim,"");a.replace(/^event|id|retry?:(.*)$/gim,"");e(a)})})}})();
(c=d[e].toString(),e=encodeURIComponent(e),c=encodeURIComponent(c),a.push(e+"="+c));return a.join("&")}};$_.ext("get",function(d,e,c){f._do(d,e,c,!1)});$_.ext("post",function(d,e,c){f._do(d,e,c,!0)});$_.ext("sse",function(d,e,c){"undefined"!==typeof EventSource?(d=new EventSource(d),d.onmessage=function(a){e(a.data)}):setInterval($_.get,c||3E4,d,{},function(a){a.trim().replace(/data:/gim,"");a.replace(/^event|id|retry?:(.*)$/gim,"");e(a)})})}})(); (function(){var f,d,e,c;if(typeof document.addEventListener!=="undefined"){f=function(a,b,g){typeof a.addEventListener!=="undefined"&&a.addEventListener(b,g,false)};d=function(a,b,g){typeof a.removeEventListener!=="undefined"&&a.removeEventListener(b,g,false)}}else if(typeof document.attachEvent!=="undefined"){f=function(a,b,g){function c(a){g.apply(a)}if(typeof a.attachEvent!=="undefined"){d(b,g);a.attachEvent("on"+b,c);a=a.KIS_0_6_0=a.KIS_0_6_0||{};a.listeners=a.listeners||{};a.listeners[b]=a.listeners[b]||
(function(){var f,d,e,c;"undefined"!==typeof document.addEventListener?(f=function(a,b,g){"undefined"!==typeof a.addEventListener&&a.addEventListener(b,g,!1)},d=function(a,b,g){"undefined"!==typeof a.removeEventListener&&a.removeEventListener(b,g,!1)}):"undefined"!==typeof document.attachEvent&&(f=function(a,b,g){function c(a){g.apply(a)}"undefined"!==typeof a.attachEvent?(d(b,g),a.attachEvent("on"+b,c),a=a.KIS_0_6_0=a.KIS_0_6_0||{},a.listeners=a.listeners||{},a.listeners[b]=a.listeners[b]||[],a.listeners[b].push({callback:g, [];a.listeners[b].push({callback:g,_listener:c})}else console.log("Failed to _attach event:"+b+" on "+a)};d=function(a,b,c){if(typeof a.detachEvent!=="undefined"){var d=a.KIS_0_6_0;if(d&&d.listeners&&d.listeners[b])for(var e=d.listeners[b],f=e.length,h=0;h<f;h++)if(e[h].callback===c){a.detachEvent("on"+b,e[h]._listener);e.splice(h,1);e.length===0&&delete d.listeners[b];break}}}}e=function(a,b,c,j){var i,k;if(typeof a==="undefined"){console.log(arguments);console.log(b);return false}if(b.match(/^([\w\-]+)$/))j===
_listener:c})):console.log("Failed to _attach event:"+b+" on "+a)},d=function(a,b,c){if("undefined"!==typeof a.detachEvent){var d=a.KIS_0_6_0;if(d&&d.listeners&&d.listeners[b])for(var e=d.listeners[b],f=e.length,h=0;h<f;h++)if(e[h].callback===c){a.detachEvent("on"+b,e[h]._listener);e.splice(h,1);0===e.length&&delete d.listeners[b];break}}});e=function(a,b,c,j){var i,k;if(typeof a==="undefined"){console.log(arguments);console.log(b);return false}if(b.match(/^([\w\-]+)$/))j===true?f(a,b,c):d(a,b,c); true?f(a,b,c):d(a,b,c);else{b=b.split(" ");k=b.length;for(i=0;i<k;i++)e(a,b[i],c,j)}};c=function(a,b,c,d){e(a,c,function(c){var e,g,f,c=c||window.event;g=$_.$(b,a);for(e in g){f=c.target||c.srcElement;if(f==g[e]){d.call(g[e],c);c.stopPropagation()}}},true)};$_.ext("event",{add:function(a,b){$_.each(function(c){e(c,a,b,true)})},remove:function(a,b){$_.each(function(c){e(c,a,b,false)})},live:function(a,b,d){c(document.documentElement,a,b,d)},delegate:function(a,b,d){$_.each(function(e){c(e,a,b,d)})}})})();
else{b=b.split(" ");k=b.length;for(i=0;i<k;i++)e(a,b[i],c,j)}};c=function(a,b,c,d){e(a,c,function(c){var e,g,f,c=c||window.event;g=$_.$(b,a);for(e in g){f=c.target||c.srcElement;if(f==g[e]){d.call(g[e],c);c.stopPropagation()}}},true)};$_.ext("event",{add:function(a,b){$_.each(function(c){e(c,a,b,true)})},remove:function(a,b){$_.each(function(c){e(c,a,b,false)})},live:function(a,b,d){c(document.documentElement,a,b,d)},delegate:function(a,b,d){$_.each(function(e){c(e,a,b,d)})}})})();

View File

@ -223,66 +223,61 @@
* A module of various browser polyfills * A module of various browser polyfills
* @file polyfill.js * @file polyfill.js
*/ */
(function(){
"use strict"; // Console.log polyfill for IE 8 stupidity
if(typeof window.console === "undefined")
{
window.console = {
log:function(){}
};
}
// 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")
{
/** /**
* String trim function polyfill
*/
if(typeof String.prototype.trim === "undefined")
{
/**
* @private
*/
String.prototype.trim = function()
{
return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, "");
};
}
// --------------------------------------------------------------------------
/**
* event.preventDefault/e.stopPropagation polyfill
* @private * @private
*/ */
if(typeof Event.preventDefault === "undefined" && typeof window.event !== "undefined") String.prototype.trim = function()
{ {
Event.prototype.preventDefault = function() return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, "");
{ };
window.event.returnValue = false; }
},
Event.prototype.stopPropagation = function()
{
window.event.cancelBubble = true;
}
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
* Array.isArray polyfill * event.preventDefault/e.stopPropagation polyfill
*/ * @private
if (typeof [].isArray === "undefined") */
if(typeof Event.preventDefault === "undefined" && typeof window.event !== "undefined")
{
Event.prototype.preventDefault = function()
{ {
Array.isArray = function(v) window.event.returnValue = false;
{ },
return Object.prototype.toString.apply(v) === '[object Array]'; Event.prototype.stopPropagation = function()
} {
window.event.cancelBubble = true;
} }
}
}()); // --------------------------------------------------------------------------
/**
* Array.isArray polyfill
*/
if (typeof Array.isArray === "undefined")
{
Array.isArray = function(v)
{
return Object.prototype.toString.apply(v) === '[object Array]';
}
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

47
kis-min.js vendored
View File

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

View File

@ -1,115 +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 || 1;
// 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;
};
},
/**
* Helper function to create a new object store
*
* @memberOf $_.indexedDB
* @name create_store
* @function
* @param string name
* @param [string] key
* @param [bool] generator
* @return IDBDataStore object
*/
create_store: function(name, key, generator)
{
var params = {};
if(typeof key !== "undefined")
{
params.keyPath = key;
}
if(typeof generator !== "undefined")
{
// Cast to a boolean value
params.autoIncrement = !! generator;
}
return db.createObjectStore(name, params);
},
/**
* Delete an object store
*
* @memberOf $_.indexedDB
* @name delete_store
* @function
* @param string name
*/
delete_store: function(name)
{
var request = db.deleteObjectStore();
// Pass the error up
request.onerror = db.onerror;
}
};
$_.ext('indexedDB', indexedDB);
}());

View File

@ -4,7 +4,7 @@
* Various object and string manipulation functions * Various object and string manipulation functions
* Note: these are based on similar phpjs functions: http://phpjs.org * Note: these are based on similar phpjs functions: http://phpjs.org
*/ */
(function(){ (function (){
"use strict"; "use strict";

View File

@ -2,63 +2,58 @@
* A module of various browser polyfills * A module of various browser polyfills
* @file polyfill.js * @file polyfill.js
*/ */
(function(){
"use strict"; // Console.log polyfill for IE 8 stupidity
if(typeof window.console === "undefined")
{
window.console = {
log:function(){}
};
}
// 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")
{
/** /**
* String trim function polyfill
*/
if(typeof String.prototype.trim === "undefined")
{
/**
* @private
*/
String.prototype.trim = function()
{
return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, "");
};
}
// --------------------------------------------------------------------------
/**
* event.preventDefault/e.stopPropagation polyfill
* @private * @private
*/ */
if(typeof Event.preventDefault === "undefined" && typeof window.event !== "undefined") String.prototype.trim = function()
{ {
Event.prototype.preventDefault = function() return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, "");
{ };
window.event.returnValue = false; }
},
Event.prototype.stopPropagation = function()
{
window.event.cancelBubble = true;
}
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
* Array.isArray polyfill * event.preventDefault/e.stopPropagation polyfill
*/ * @private
if (typeof [].isArray === "undefined") */
if(typeof Event.preventDefault === "undefined" && typeof window.event !== "undefined")
{
Event.prototype.preventDefault = function()
{ {
Array.isArray = function(v) window.event.returnValue = false;
{ },
return Object.prototype.toString.apply(v) === '[object Array]'; Event.prototype.stopPropagation = function()
} {
window.event.cancelBubble = true;
} }
}
}()); // --------------------------------------------------------------------------
/**
* Array.isArray polyfill
*/
if (typeof Array.isArray === "undefined")
{
Array.isArray = function(v)
{
return Object.prototype.toString.apply(v) === '[object Array]';
}
}

View File

@ -53,6 +53,12 @@
equal($_().el, window.document.documentElement, "Empty selector is set to documentElement"); equal($_().el, window.document.documentElement, "Empty selector is set to documentElement");
}); });
test("Array.isArray", function(){
expect(2);
strictEqual(Array.isArray([1, 2, 3]), true, "Array.isArray returns true on an array");
strictEqual(Array.isArray({arr:[1,2,3]}), false, "Array.isArray returns false on a non-array");
});
test("Sub-modules", function(){ test("Sub-modules", function(){
expect(4); expect(4);
ok($_().event, "Event module"); ok($_().event, "Event module");

View File

@ -1,8 +0,0 @@
(function(){
"use strict";
module("template");
}());