kis-js/kis-lite-min.js

8 lines
3.0 KiB
JavaScript
Executable File

(function(){if("undefined"!==typeof document.querySelector){var d,f,c,a;d=function(b){a="undefined"===typeof b?"undefined"!==typeof d.el?d.el:document.documentElement:f(b);d.prototype.el=a;var b=c(d),g;for(g in b)"object"===typeof b[g]&&(b[g].el=a);b.el=a;return b};f=function(b,a){var c;if("string"!=typeof b||"undefined"===typeof b)return b;c=null!=a&&1===a.nodeType?a:document;if(b.match(/^#([\w\-]+$)/))return document.getElementById(b.split("#")[1]);c=c.querySelectorAll(b);return 1===c.length?c[0]:
c};c=function(b){var a;if("undefined"!==typeof b){if("undefined"!==typeof Object.create)return Object.create(b);a=typeof b;if(!("object"!==a&&"function"!==a))return a=function(){},a.prototype=b,new a}};d.ext=function(b,c){c.el=a;d[b]=c};d.ext("each",function(b){if("undefined"!==typeof a.length&&a!==window)if("undefined"!==typeof Array.prototype.forEach)[].forEach.call(a,b);else{var c=a.length;if(0!==c)for(var e,d=0;d<c;d++)e=a.item(d)?a.item(d):a[d],b.call(e,e)}else b.call(a,a)});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.$=f}})();"undefined"===typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")});"undefined"===typeof Array.isArray&&(Array.isArray=function(d){return"[object Array]"===Object.prototype.toString.apply(d)});
(function(){if("undefined"!==typeof window.XMLHttpRequest){var d={_do:function(d,c,a,b,g){var e=new XMLHttpRequest;"undefined"===typeof a&&(a=function(){});g=g?"POST":"GET";d+="GET"===g?"?"+this._serialize(c):"";e.open(g,d);e.onreadystatechange=function(){4===e.readyState&&(200===e.status?a.call(e.responseText,e.responseText):"undefined"!==typeof b&&b.call(e.status,e.status))};"POST"===g?(e.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),e.send(this._serialize(c))):e.send(null)},
_serialize:function(d){var c,a,b=[];for(c in d)d.hasOwnProperty(c)&&"function"!==typeof d[c]&&(a=d[c].toString(),c=encodeURIComponent(c),a=encodeURIComponent(a),b.push(c+"="+a));return b.join("&")}};$_.ext("get",function(f,c,a,b){d._do(f,c,a,b,!1)});$_.ext("post",function(f,c,a,b){d._do(f,c,a,b,!0)});$_.ext("sse",function(d,c){var a;"undefined"!==typeof EventSource&&(a=new EventSource(d),a.onmessage=function(a){c.call(a.data,a.data)})})}})();
(function(){var d,f;if("undefined"===typeof document.addEventListener)return!1;d=function(c,a,b,g){var e,f;if("undefined"===typeof c)return null;if(a.match(/^([\w\-]+)$/))!0===g?c.addEventListener(a,b,!1):c.removeEventListener(a,b,!1);else{a=a.split(" ");f=a.length;for(e=0;e<f;e++)d(c,a[e],b,g)}};f=function(c,a,b,g){d(c,b,function(b){var d,f;f=$_.$(a,c);for(d in f)b.target==f[d]&&(g.call(f[d],b),b.stopPropagation())},!0)};$_.ext("event",{add:function(c,a){$_.each(function(b){d(b,c,a,!0)})},remove:function(c,
a){$_.each(function(b){d(b,c,a,!1)})},live:function(c,a,b){f(document.documentElement,c,a,b)},delegate:function(c,a,b){$_.each(function(d){f(d,c,a,b)})}})})();