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