kis-js/kis-lite-min.js

7 lines
2.2 KiB
JavaScript
Executable File

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