battles/js/_e2.js

1 line
4.8 KiB
JavaScript

(function(){function v(a){if(!a._e_version)for(func in j)a[func]=j[func];return a}function w(a){this.o=this.original=a}function q(a,b){w.prototype[b]=function(c,d,i){if(typeof i==="undefined"){if(this[a+"|"+c]===d)return this;this[a+"|"+c]=d;this.original[a](c,d)}else{var f=[];for(g=len=arguments.length;g-- >1;){var l=arguments[g],h=arguments[--g];if(this[a+"|"+h]!==d){this[a+"|"+h]=d;f.push(h,l)}}f.length&&this.original[a].apply(this.original,f)}return this}}function u(a,b){w.prototype[b]=function(c){if(this[a]===c)return this;this[a]=c;this.original[a](c);return this}}function y(a){this.o=this.original=a}function s(a,b,c,d,i,f){var l;try{var h="";if(c||c==0)h=' name="'+c+'"';var z="";if(b)z=' type="'+b+'"';l=n.createElement("<input"+h+z+"/>")}catch(A){l=n.createElement("input")}l.name=c;l.type=b;b=v(l);if(i&&(d||d==0))b.sp(i,d);a&&a.AppendChild(b);if(f)if(typeof f==="object")b.sp(f);else return b;return a}function p(a,b,c){var d=b.length,i;for(i=0;i<d;i++){var f=b[i];if(typeof f==="object"){var l;for(l in f){var h=f[l];if(c)a[c](l,h);else a[l]=h;h&&h.addRewritable&&h.addRewritable(a,c,l,h.addRewritableKey)}}else{h=b[i+1];if(c)a[c](f,h);else a[f]=h;i++;h&&h.addRewritable&&h.addRewritable(a,c,f,h.addRewritableKey)}}}var x=window;if(x._e)return true;var n=document,r,o=true;if(typeof Element!="undefined")r=Element;else o=false;if(o)try{r.prototype._e_version="2"}catch(B){o=false}var j={_e_version:"2",AppendText:function(a,b,c){var d=n.createTextNode(a);a.hasOwnProperty("addRewritable")&&a.addRewritable(d,"","data",a.addRewritableKey);this.appendChild(d);if(b){if(typeof c==="undefined")return d;b[c]=new y(d)}return this},AppendChild:function(a){this.appendChild(a);return this},SetProperties:function(){p(this,arguments);return this},SetStyle:function(){p(this.style,arguments);return this},SetAttributes:function(){p(this,arguments,"setAttribute");return this},SetClass:function(a){this.SetProperties("className",a);return this},Title:function(a){a=["title",a];p(this,a,"setAttribute");p(this,a);return this},AppendElement:function(a,b){this.appendChild(t(a,b));return this},AppendElementNext:function(a,b){var c=t(a,b);this.appendChild(c);return c},CacheSetter:function(a,b){a[b]=new w(this);return this},checkbox:function(a,b,c,d){a=s(this,"checkbox",a,c,"defaultChecked",1);a.value=b;return d?a:this},submit:function(a,b,c){return s(this,"submit",a,b,"value",c)},button:function(a,b){return s(this,"button",null,a,"value",b)},hidden:function(a,b,c){return s(this,"hidden",a,b,"value",c)},input:function(a,b,c){return s(this,"text",a,b,"value",c)},td:o?function(){return this.insertCell(-1)}:function(){return v(this.insertCell(-1))},tr:o?function(){return this.insertRow(-1)}:function(){return v(this.insertRow(-1))}},m={AppendText:["at"],AppendChild:["ac"],SetProperties:["sp"],SetStyle:["st","ss"],SetAttributes:["sa"],SetClass:["sc"],AppendElement:["e"],AppendElementNext:["ex"],AddEvent:["ev"],Title:["tt"],CacheSetter:["c"]};(function(a,b){if(o){var c=function(){var d=b();r.prototype[a]=d;return d.apply(this,arguments)};r.prototype[a]=c;j[a]=c}else j[a]=function(){var d=arguments.callee.real;if(!d){d=b();arguments.callee.real=d}if(!arguments.callee.install){j[a]=d;for(var i=m[a].length;i--;)j[m[a][i]]=d;arguments.callee.install=1}this[a]=d;return d.apply(this,arguments)}})("AddEvent",function(){return this.addEventListener?function(a,b){this.addEventListener(a,b,false);return this}:this.attachEvent?function(a,b){this.attachEvent("on"+a,b);return this}:function(){return this}});var e;for(e in m)for(var g=m[e].length;g--;)j[m[e][g]]=j[e];if(o)for(e in j)r.prototype[e]=j[e];e="SetStyle";q(e,e);var k=m[e];for(g=k.length;g--;)q(e,k[g]);e="SetProperties";q(e,e);k=m[e];for(g=k.length;g--;)q(e,k[g]);e="SetAttributes";q(e,e);k=m[e];for(g=k.length;g--;)q(e,k[g]);e="SetClass";u(e,e);k=m[e];for(g=k.length;g--;)u(e,k[g]);e="Title";u(e,e);k=m[e];for(g=k.length;g--;)u(e,k[g]);var t=o?function(a,b){a=n.createElement(a);if(b)typeof b==="object"?a.SetAttributes(b):p(a,["className",b]);return a}:function(a,b){a=n.createElement(a);var c;for(c in j)a[c]=j[c];if(b)typeof b==="object"?a.SetAttributes(b):p(a,["className",b]);return a};y.prototype.data=function(a){if(this.d===a)return this;this.d=a;a.hasOwnProperty("addRewritable")&&a.addRewritable(tnode,"","data",a.addRewritableKey);this.original.data=a;return this};x._e=t;t.add=o?function(a,b){r.prototype[a]=b;j[a]=b}:function(a,b){j[a]=b};t.post=function(){var a=n.createElement("form");a.method="POST";a.style.display="none";var b=arguments.length,c;for(c=0;c<b;c++){var d=arguments[c];if(typeof d==="object"){var i;for(i in d){var f=n.createElement("input");f.name=i;f.value=d[i];a.appendChild(f)}}else{f=n.createElement("input");f.name=d;f.value=arguments[c+1];a.appendChild(f);c++}}n.body.appendChild(a);a.submit()};typeof x.DLoad==="object"&&(new DLoad.pkg("_e")).complete()})()