kis-js/kis-lite-min.js

13 lines
5.2 KiB
JavaScript

(function(){if("undefined"!==typeof document.querySelector){var d,g,f,e;d=function(a){e="undefined"===typeof a?"undefined"!==typeof d.el?d.el:document.documentElement:"object"!==typeof a?g(a):a;d.prototype.el=e;var a=f(d),b;for(b in a)if("object"===typeof a[b])a[b].el=e;a.el=e;return a};g=function(a,b){var c;if("string"!=typeof a||"undefined"===typeof a)return a;c=null!=b&&1===b.nodeType?b:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);c=c.querySelectorAll(a);
return 1===c.length?c[0]:c};f=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}};d.ext=function(a,b){b.el=e;d[a]=b};d.ext("each",function(a){if("undefined"!==typeof e.length&&e!==window){var b=e.length;if(0!==b)for(var c,h=0;h<b;h++)c=e.item(h)?e.item(h):e[h],a.call(c,c)}else a.call(e,e)});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.$=g}})();
(function(){if("undefined"===typeof window.console)window.console={log:function(){}};if("undefined"===typeof String.prototype.trim)String.prototype.trim=function(){return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")};"undefined"!==typeof document&&!("classList"in document.createElement("a"))&&function(d){var d=(d.HTMLElement||d.Element).prototype,g=Object,f=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},e=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},a=function(a,b){this.name=a;this.code=DOMException[a];this.message=b},b=function(b,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 e.call(b,c)},c=function(a){for(var b=f.call(a.className),b=b?b.split(/\s+/):[],c=0,e=b.length;c<e;c++)this.push(b[c]);this._updateClassName=function(){a.className=this.toString()}},h=c.prototype=[],
i=function(){return new c(this)};a.prototype=Error.prototype;h.item=function(a){return this[a]||null};h.contains=function(a){return-1!==b(this,a+"")};h.add=function(a){a+="";-1===b(this,a)&&(this.push(a),this._updateClassName())};h.remove=function(a){a=b(this,a+"");-1!==a&&(this.splice(a,1),this._updateClassName())};h.toggle=function(a){a+="";-1===b(this,a)?this.add(a):this.remove(a)};h.toString=function(){return this.join(" ")};if(g.defineProperty){h={get:i,enumerable:!0,configurable:!0};try{g.defineProperty(d,
"classList",h)}catch(j){if(-2146823252===j.number)h.enumerable=!1,g.defineProperty(d,"classList",h)}}else g.prototype.__defineGetter__&&d.__defineGetter__("classList",i)}(self);if("undefined"===typeof Event.preventDefault&&"undefined"!==typeof window.event)Event.prototype.preventDefault=function(){window.event.stop()},Event.prototype.stopPropagation=function(){window.event.returnValue=!1}})();
(function(){if("undefined"!==typeof window.XMLHttpRequest){var d={_do:function(d,f,e,a){var b=new XMLHttpRequest;"undefined"===typeof e&&(e=function(){});a=a?"POST":"GET";d+="GET"===a?"?"+this._serialize(f):"";b.open(a,d);b.onreadystatechange=function(){4===b.readyState&&e(b.responseText)};"POST"===a?(b.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),b.send(this._serialize(f))):b.send(null)},_serialize:function(d){var f,e,a=[];for(f in d)d.hasOwnProperty(f)&&"function"!==typeof d[f]&&
(e=d[f].toString(),f=encodeURIComponent(f),e=encodeURIComponent(e),a.push(f+"="+e));return a.join("&")}};$_.ext("get",function(g,f,e){d._do(g,f,e,!1)});$_.ext("post",function(g,f,e){d._do(g,f,e,!0)})}})();
(function(){var d,g,f,e;"undefined"!==typeof document.addEventListener?(d=function(a,b,c){"undefined"!==typeof a.addEventListener&&a.addEventListener(b,c,!1)},g=function(a,b,c){"undefined"!==typeof a.removeEventListener&&a.removeEventListener(b,c,!1)}):"undefined"!==typeof document.attachEvent&&(d=function(a,b,c){var h;function d(a){c.apply(a)}"undefined"!==typeof a.attachEvent?(g(b,c),a.attachEvent("on"+b,d),h=a.KIS_0_5_0=a.KIS_0_5_0||{},a=h,a.listeners=a.listeners||{},a.listeners[b]=a.listeners[b]||
[],a.listeners[b].push({callback:c,_listener:d})):console.log("Failed to _attach event:"+b+" on "+a)},g=function(a,b,c){if("undefined"!==typeof a.detachEvent){var d=a.KIS_0_5_0;if(d&&d.listeners&&d.listeners[b])for(var e=d.listeners[b],f=e.length,g=0;g<f;g++)if(e[g].callback===c){a.detachEvent("on"+b,e[g]._listener);e.splice(g,1);0===e.length&&delete d.listeners[b];break}}});f=function(a,b,c,e){var i,j;if("undefined"===typeof a)return console.log(arguments),console.log(b),!1;if(b.match(/^([\w\-]+)$/))!0===
e?d(a,b,c):g(a,b,c);else{b=b.split(" ");j=b.length;for(i=0;i<j;i++)f(a,b[i],c,e)}};e=function(a,b,c,d){f(a,c,function(a){var c,e,f,a=a||window.event;e=$_.$(b);for(c in e)f=a.target||a.srcElement,f==e[c]&&(d.call(e[c],a),a.stopPropagation())},!0)};$_.ext("event",{add:function(a,b){$_.each(function(c){f(c,a,b,!0)})},remove:function(a,b){$_.each(function(c){f(c,a,b,!1)})},live:function(a,b,c){e(document.documentElement,a,b,c)},delegate:function(a,b,c){$_.each(function(d){e(d,a,b,c)})}})})();