21 lines
8.7 KiB
JavaScript
21 lines
8.7 KiB
JavaScript
(function(){if(document.querySelectorAll){var d,h,f,b;d=function(a){b=typeof a==="undefined"?typeof d.el!=="undefined"?d.el:document.documentElement:typeof a!=="object"?h(a):a;d.prototype.el=b;var a=f(d),c;for(c in a)if(typeof a[c]==="object")a[c].el=b;a.el=b;return a};h=function(a,c){var b;if(typeof a!="string"||typeof a==="undefined")return a;b=c!=null&&c.nodeType===1?c:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);else b=b.querySelectorAll(a);return b.length===
|
|
1?b[0]:b};f=function(a){var c;if(typeof a!=="undefined"){if(typeof Object.create!=="undefined")return Object.create(a);c=typeof a;if(!(c!=="object"&&c!=="function"))return c=function(){},c.prototype=a,new c}};d.ext=function(a,c){c.el=b;d[a]=c};d.ext("each",function(a){if(typeof b.length!=="undefined"&&b!==window){var c=b.length;if(c!==0)for(var e,g=0;g<c;g++)e=b.item(g)?b.item(g):b[g],a(e)}else a(b)});d.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()};
|
|
d=window.$_=window.$_||d;d.$=h;if(typeof window.console==="undefined")window.console={log:function(){}};if(typeof String.prototype.trim==="undefined")String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}}})();
|
|
typeof document!=="undefined"&&!("classList"in document.createElement("a"))&&function(d){var d=(d.HTMLElement||d.Element).prototype,h=Object,f=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=f.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()}},g=e.prototype=[],j=function(){return new e(this)};a.prototype=Error.prototype;g.item=function(a){return this[a]||null};g.contains=function(a){a+="";return c(this,a)!==-1};g.add=function(a){a+="";c(this,a)===-1&&(this.push(a),this._updateClassName())};g.remove=function(a){a+=
|
|
"";a=c(this,a);a!==-1&&(this.splice(a,1),this._updateClassName())};g.toggle=function(a){a+="";c(this,a)===-1?this.add(a):this.remove(a)};g.toString=function(){return this.join(" ")};if(h.defineProperty){g={get:j,enumerable:true,configurable:true};try{h.defineProperty(d,"classList",g)}catch(k){if(k.number===-2146823252)g.enumerable=false,h.defineProperty(d,"classList",g)}}else h.prototype.__defineGetter__&&d.__defineGetter__("classList",j)}(self);
|
|
(function(){function d(b,a,c){var e,g;if(typeof b.hasAttribute!=="undefined")b.hasAttribute(a)&&(e=b.getAttribute(a)),g=true;else if(typeof b[a]!=="undefined")e=b[a],g=false;else if(a==="class"&&typeof b.className!=="undefined")a="className",e=b.className,g=false;if(typeof e==="undefined"&&(typeof c==="undefined"||c===null))console.log(c),console.log(b),console.log("Element does not have the selected attribute");else{if(typeof c==="undefined")return e;typeof c!=="undefined"&&c!==null?g===true?b.setAttribute(a,
|
|
c):b[a]=c:c===null&&(g===true?b.removeAttribute(a):delete b[a]);return typeof c!=="undefined"?c:e}}function h(b){return b.replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")})}function f(b,a,c){var e,a=h(a);e={outerHeight:"offsetHeight",outerWidth:"offsetWidth",top:"posTop"};if(typeof c==="undefined"&&b.style[a]!=="undefined")return b.style[a];else if(typeof c==="undefined"&&b.style[e[a]]!=="undefined")return b.style[e[a]];typeof b.style[a]!=="undefined"?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){typeof b==="undefined"&&(b="block");this.css("display",b)},attr:function(b,a){var c=this.el;if(c.length>1&&typeof a==="undefined")console.log(c),console.log("Must be a singular element");else if(c.length>1&&typeof a!==
|
|
"undefined")$_.each(function(c){return d(c,b,a)});else return d(c,b,a)},text:function(b){var a,c,e;e=this.el;c=typeof e.innerText!=="undefined"?"innerText":typeof e.textContent!=="undefined"?"textContent":"innerHTML";a=e[c];return typeof b!=="undefined"?e[c]=b:a},css:function(b,a){if(typeof a==="undefined")return f(this.el,b);$_.each(function(c){f(c,b,a)})}})})();
|
|
(function(){$_.ext("store",{get:function(d){return JSON.parse(localStorage.getItem(d))},set:function(d,h){typeof h!=="string"&&(h=JSON.stringify(h));localStorage.setItem(d,h)},remove:function(d){localStorage.removeItem(d)},getAll:function(){var d,h,f;h=localStorage.length;f={};for(d=0;d<h;d++){var b=localStorage.key(d),a=localStorage.getItem(b);f[b]=a}return f}})})();
|
|
(function(){var d={_do:function(d,f,b,a){typeof b==="undefined"&&(b=function(){});var c=typeof window.XMLHttpRequest!=="undefined"?new XMLHttpRequest:false,a=a?"POST":"GET";d+=a==="GET"?"?"+this._serialize(f):"";c.open(a,d);c.onreadystatechange=function(){c.readyState===4&&b(c.responseText)};a==="POST"?(c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(this._serialize(f))):c.send(null)},_serialize:function(d){var f=[],b;for(b in d)if(d.hasOwnProperty(b)&&typeof d[b]!==
|
|
"function"){var a=d[b].toString();b=encodeURIComponent(b);a=encodeURIComponent(a);f.push(b+"="+a)}return f.join("&")}};$_.ext("get",function(h,f,b){d._do(h,f,b,false)});$_.ext("post",function(h,f,b){d._do(h,f,b,true)})})();
|
|
(function(){var d=function(f){var b=[],a=0,c={},e,b=h.object_keys(f);b.sort(function(a,c){var b=parseFloat(c),e=parseFloat(a),f=b+""===c,d=e+""===a;if(f&&d)return b>e?1:b<e?-1:0;else if(f&&!d)return 1;else if(!f&&d)return-1;return c>a?1:c<a?-1:0});a=b.length;for(e=0;e<a;e++)c[b[e]]=f[b[e]];return c},h={object_keys:function(f){var b=[],a;for(a in f)f.hasOwnProperty(a)&&b.push(a);return b},object_values:function(f){var b=[],a;for(a in f)b.push(f[a]);return b},array_combine:function(f,b){var a={},c,
|
|
e=0;$_.type(f)!=="array"&&(f=this.object_values(f));$_.type(b)!=="array"&&(b=this.object_values(b));c=f.length;if(c!==b.length)return console.log("Object combine requires two arrays of the same size"),false;for(e=0;e<c;e++)a[f[e]]=b[e];return a},object_merge:function(){var f=Array.prototype.slice.call(arguments),b=f.length,a={},c,e=0,g,d,h;c=true;for(g=0;g<b;g++)if($_.type(f[g])!=="array"){c=false;break}if(c){a=[];for(g=0;g<b;g++)a=a.contact(f[g]);return a}for(g=0,h=0;g<b;g++)if(c=f[g],$_.type(c)==
|
|
"array")for(d=0,e=c.length;d<e;d++)a[h++]=c[d];else for(d in c)c.hasOwnProperty(d)&&(parseInt(d,10)+""===d?a[h++]=c[d]:a[d]=c[d]);return a},str_trans:function(f,b,a){var c=[],e=[],g=false,h=0,k=0,i="",m="",n="",o="",l;if(typeof b==="object"){b=d(b);for(l in b)b.hasOwnProperty(l)&&(c.push(l),e.push(b[l]));b=c;a=e}k=f.length;h=b.length;i=typeof a==="string";m=typeof b==="string";for(c=0;c<k;c++){g=false;if(m){f.charAt(c-1);n=f.charAt(c);f.charAt(c+1);for(e=0;e<h;e++)if(n==b.charAt(e)){g=true;break}}else for(e=
|
|
0;e<h;e++)if(f.substr(c,b[e].length)==b[e]){g=true;c=c+b[e].length-1;break}o+=g?i?a.charAt(e):a[e]:f.charAt(c)}return o}};$_.ext("util",h)})();
|
|
(function(){var d,h,f,b;typeof document.addEventListener!=="undefined"?(d=function(a,c,b){typeof a.addEventListener!=="undefined"&&a.addEventListener(c,b,false)},h=function(a,c,b){typeof a.removeEventListener!=="undefined"&&a.removeEventListener(c,b,false)}):typeof document.attachEvent!=="undefined"&&(d=function(a,c,b){var e;function d(a){b.apply(a)}typeof a.attachEvent!=="undefined"?(h(c,b),a.attachEvent("on"+c,d),e=a.KIS_0_5_0=a.KIS_0_5_0||{},a=e,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)},h=function(a,c,b){if(typeof a.detachEvent!=="undefined"){var d=a.KIS_0_5_0;if(d&&d.listeners&&d.listeners[c])for(var f=d.listeners[c],h=f.length,i=0;i<h;i++)if(f[i].callback===b){a.detachEvent("on"+c,f[i].listener);f.splice(i,1);f.length===0&&delete d.listeners[c];break}}});f=function(a,c,b,g){var j,k;if(typeof a==="undefined")return console.log(arguments),console.log(c),false;if(c.match(/^([\w\-]+)$/))g===
|
|
true?d(a,c,b):h(a,c,b);else{c=c.split(" ");k=c.length;for(j=0;j<k;j++)f(a,c[j],b,g)}};b=function(a,c,b,d){f(a,b,function(a){var b,e;e=$_.$(c);for(b in e)a.target==e[b]&&(d.call(e[b],a),a.stopPropagation())},true)};$_.ext("event",{add:function(a,b){$_.each(function(d){f(d,a,b,true)})},remove:function(a,b){$_.each(function(d){f(d,a,b,false)})},live:function(a,c,d){b(document.documentElement,a,c,d)},delegate:function(a,c,d){$_.each(function(f){b(f,a,c,d)})}})})();
|