kis-js/kis-lite-min.js

8 lines
2.8 KiB
JavaScript
Executable File

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