kis-js/kis-lite-min.js

7 lines
2.3 KiB
JavaScript
Executable File

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