kis-js/kis-lite-min.js

10 lines
4.0 KiB
JavaScript
Executable File

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