roojs-core.js
authorAlan Knowles <alan@roojs.com>
Fri, 13 Apr 2012 08:45:01 +0000 (16:45 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 13 Apr 2012 08:45:01 +0000 (16:45 +0800)
roojs-core.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core.js
roojs-core.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js
roojs-core-debug.js

roojs-core.js

index bd83687..d3eb1aa 100644 (file)
@@ -262,32 +262,3 @@ H.push(n+' { '+I.join(' ')+'} ');}
 E=H.join("\n");}if(Roo.isIE){F.appendChild(G);ss=G.styleSheet;ss.cssText=E;}else {try{G.appendChild(B.createTextNode(E));}catch(e){nrules.cssText=cssText;}
 F.appendChild(G);ss=G.styleSheet?G.styleSheet:(G.sheet||B.styleSheets[B.styleSheets.length-1]);}
 this.cacheStyleSheet(ss);return ss;},removeStyleSheet:function(id){var E=B.getElementById(id);if(E){E.parentNode.removeChild(E);}},swapStyleSheet:function(id,E){this.removeStyleSheet(id);var ss=B.createElement("link");ss.setAttribute("rel","stylesheet");ss.setAttribute("type","text/css");ss.setAttribute("id",id);ss.setAttribute("href",E);B.getElementsByTagName("head")[0].appendChild(ss);},refreshCache:function(){return this.getRules(true);},cacheStyleSheet:function(E){if(!A){A={};}try{var F=E.cssRules||E.rules;for(var j=F.length-1;j>=0;--j){A[F[j].selectorText]=F[j];}}catch(e){}},getRules:function(E){if(A==null||E){A={};var ds=B.styleSheets;for(var i=0,F=ds.length;i<F;i++){try{this.cacheStyleSheet(ds[i]);}catch(e){}}}return A;},getRule:function(E,F){var rs=this.getRules(F);if(!(E instanceof Array)){return rs[E];}for(var i=0;i<E.length;i++){if(rs[E[i]]){return rs[E[i]];}}return null;},updateRule:function(E,F,G){if(!(E instanceof Array)){var H=this.getRule(E);if(H){H.style[F.replace(C,D)]=G;return true;}}else {for(var i=0;i<E.length;i++){if(this.updateRule(E[i],F,G)){return true;}}}return false;}};}();
-//Roo/util/ClickRepeater.js
-Roo.util.ClickRepeater=function(el,A){this.el=Roo.get(el);this.el.unselectable();Roo.apply(this,A);this.addEvents({"mousedown":true,"click":true,"mouseup":true});this.el.on("mousedown",this.handleMouseDown,this);if(this.preventDefault||this.stopDefault){this.el.on("click",function(e){if(this.preventDefault){e.preventDefault();}if(this.stopDefault){e.stopEvent();}},this);}if(this.handler){this.on("click",this.handler,this.scope||this);}
-Roo.util.ClickRepeater.superclass.constructor.call(this);};Roo.extend(Roo.util.ClickRepeater,Roo.util.Observable,{interval:20,delay:250,preventDefault:true,stopDefault:false,timer:0,handleMouseDown:function(){clearTimeout(this.timer);this.el.blur();if(this.pressClass){this.el.addClass(this.pressClass);}
-this.mousedownTime=new Date();Roo.get(document).on("mouseup",this.handleMouseUp,this);this.el.on("mouseout",this.handleMouseOut,this);this.fireEvent("mousedown",this);this.fireEvent("click",this);this.timer=this.click.defer(this.delay||this.interval,this);},click:function(){this.fireEvent("click",this);this.timer=this.click.defer(this.getInterval(),this);},getInterval:function(){if(!this.accelerate){return this.interval;}var A=this.mousedownTime.getElapsed();if(A<500){return 400;}else if(A<1700){return 320;}else if(A<2600){return 250;}else if(A<3500){return 180;}else if(A<4400){return 140;}else if(A<5300){return 80;}else if(A<6200){return 50;}else {return 10;}},handleMouseOut:function(){clearTimeout(this.timer);if(this.pressClass){this.el.removeClass(this.pressClass);}
-this.el.on("mouseover",this.handleMouseReturn,this);},handleMouseReturn:function(){this.el.un("mouseover",this.handleMouseReturn);if(this.pressClass){this.el.addClass(this.pressClass);}
-this.click();},handleMouseUp:function(){clearTimeout(this.timer);this.el.un("mouseover",this.handleMouseReturn);this.el.un("mouseout",this.handleMouseOut);Roo.get(document).un("mouseup",this.handleMouseUp);this.el.removeClass(this.pressClass);this.fireEvent("mouseup",this);}});
-//Roo/KeyNav.js
-Roo.KeyNav=function(el,A){this.el=Roo.get(el);Roo.apply(this,A);if(!this.disabled){this.disabled=true;this.enable();}};Roo.KeyNav.prototype={disabled:false,defaultEventAction:"stopEvent",forceKeyDown:false,prepareEvent:function(e){var k=e.getKey();var h=this.keyToHandler[k];if(Roo.isSafari&&h&&k>=37&&k<=40){e.stopEvent();}},relay:function(e){var k=e.getKey();var h=this.keyToHandler[k];if(h&&this[h]){if(this.doRelay(e,this[h],h)!==true){e[this.defaultEventAction]();}}},doRelay:function(e,h,A){return h.call(this.scope||this,e);},enter:false,left:false,right:false,up:false,down:false,tab:false,esc:false,pageUp:false,pageDown:false,del:false,home:false,end:false,keyToHandler:{37:"left",39:"right",38:"up",40:"down",33:"pageUp",34:"pageDown",46:"del",36:"home",35:"end",13:"enter",27:"esc",9:"tab"},enable:function(){if(this.disabled){if(this.forceKeyDown||Roo.isIE||Roo.isAir){this.el.on("keydown",this.relay,this);}else {this.el.on("keydown",this.prepareEvent,this);this.el.on("keypress",this.relay,this);}
-this.disabled=false;}},disable:function(){if(!this.disabled){if(this.forceKeyDown||Roo.isIE||Roo.isAir){this.el.un("keydown",this.relay);}else {this.el.un("keydown",this.prepareEvent);this.el.un("keypress",this.relay);}
-this.disabled=true;}}};
-//Roo/KeyMap.js
-Roo.KeyMap=function(el,A,B){this.el=Roo.get(el);this.eventName=B||"keydown";this.bindings=[];if(A){this.addBinding(A);}
-this.enable();};Roo.KeyMap.prototype={stopEvent:false,addBinding:function(A){if(A instanceof Array){for(var i=0,B=A.length;i<B;i++){this.addBinding(A[i]);}return;}var C=A.key,D=A.shift,E=A.ctrl,F=A.alt,fn=A.fn,G=A.scope;if(typeof C=="string"){var ks=[];var H=C.toUpperCase();for(var j=0,B=H.length;j<B;j++){ks.push(H.charCodeAt(j));}
-C=ks;}var I=C instanceof Array;var J=function(e){if((!D||e.shiftKey)&&(!E||e.ctrlKey)&&(!F||e.altKey)){var k=e.getKey();if(I){for(var i=0,K=C.length;i<K;i++){if(C[i]==k){if(this.stopEvent){e.stopEvent();}
-fn.call(G||window,k,e);return;}}}else {if(k==C){if(this.stopEvent){e.stopEvent();}
-fn.call(G||window,k,e);}}}};this.bindings.push(J);},on:function(A,fn,B){var C,D,E,F;if(typeof A=="object"&&!(A instanceof Array)){C=A.key;D=A.shift;E=A.ctrl;F=A.alt;}else {C=A;}
-this.addBinding({key:C,shift:D,ctrl:E,alt:F,fn:fn,scope:B})},handleKeyDown:function(e){if(this.enabled){var b=this.bindings;for(var i=0,A=b.length;i<A;i++){b[i].call(this,e);}}},isEnabled:function(){return this.enabled;},enable:function(){if(!this.enabled){this.el.on(this.eventName,this.handleKeyDown,this);this.enabled=true;}},disable:function(){if(this.enabled){this.el.removeListener(this.eventName,this.handleKeyDown,this);this.enabled=false;}}};
-//Roo/util/TextMetrics.js
-Roo.util.TextMetrics=function(){var A;return {measure:function(el,B,C){if(!A){A=Roo.util.TextMetrics.Instance(el,C);}
-A.bind(el);A.setFixedWidth(C||'auto');return A.getSize(B);},createInstance:function(el,B){return Roo.util.TextMetrics.Instance(el,B);}};}();Roo.util.TextMetrics.Instance=function(A,B){var ml=new Roo.Element(document.createElement('div'));document.body.appendChild(ml.dom);ml.position('absolute');ml.setLeftTop(-1000,-1000);ml.hide();if(B){ml.setWidth(B);}var C={getSize:function(D){ml.update(D);var s=ml.getSize();ml.update('');return s;},bind:function(el){ml.setStyle(Roo.fly(el).getStyles('font-size','font-style','font-weight','font-family','line-height'));},setFixedWidth:function(D){ml.setWidth(D);},getWidth:function(D){ml.dom.style.width='auto';return this.getSize(D).width;},getHeight:function(D){return this.getSize(D).height;}};C.bind(A);return C;};Roo.Element.measureText=Roo.util.TextMetrics.measure;
-//Roo/state/Provider.js
-Roo.state.Provider=function(){this.addEvents({"statechange":true});this.state={};Roo.state.Provider.superclass.constructor.call(this);};Roo.extend(Roo.state.Provider,Roo.util.Observable,{get:function(A,B){return typeof this.state[A]=="undefined"?B:this.state[A];},clear:function(A){delete this.state[A];this.fireEvent("statechange",this,A,null);},set:function(A,B){this.state[A]=B;this.fireEvent("statechange",this,A,B);},decodeValue:function(A){var re=/^(a|n|d|b|s|o)\:(.*)$/;var B=re.exec(unescape(A));if(!B||!B[1])return;var C=B[1];var v=B[2];switch(C){case "n":return parseFloat(v);case "d":return new Date(Date.parse(v));case "b":return (v=="1");case "a":var D=[];var E=v.split("^");for(var i=0,F=E.length;i<F;i++){D.push(this.decodeValue(E[i]));}return D;case "o":var D={};var E=v.split("^");for(var i=0,F=E.length;i<F;i++){var kv=E[i].split("=");D[kv[0]]=this.decodeValue(kv[1]);}return D;default:return v;}},encodeValue:function(v){var A;if(typeof v=="number"){A="n:"+v;}else if(typeof v=="boolean"){A="b:"+(v?"1":"0");}else if(v instanceof Date){A="d:"+v.toGMTString();}else if(v instanceof Array){var B="";for(var i=0,C=v.length;i<C;i++){B+=this.encodeValue(v[i]);if(i!=C-1)B+="^";}
-A="a:"+B;}else if(typeof v=="object"){var B="";for(var D in v){if(typeof v[D]!="function"){B+=D+"="+this.encodeValue(v[D])+"^";}}
-A="o:"+B.substring(0,B.length-1);}else {A="s:"+v;}return escape(A);}});
-//Roo/state/Manager.js
-Roo.state.Manager=function(){var A=new Roo.state.Provider();return {setProvider:function(B){A=B;},get:function(B,C){return A.get(B,C);},set:function(B,C){A.set(B,C);},clear:function(B){A.clear(B);},getProvider:function(){return A;}};}();
-//Roo/state/CookieProvider.js
-Roo.state.CookieProvider=function(A){Roo.state.CookieProvider.superclass.constructor.call(this);this.path="/";this.expires=new Date(new Date().getTime()+(1000*60*60*24*7));this.domain=null;this.secure=false;Roo.apply(this,A);this.state=this.readCookies();};Roo.extend(Roo.state.CookieProvider,Roo.state.Provider,{set:function(A,B){if(typeof B=="undefined"||B===null){this.clear(A);return;}
-this.setCookie(A,B);Roo.state.CookieProvider.superclass.set.call(this,A,B);},clear:function(A){this.clearCookie(A);Roo.state.CookieProvider.superclass.clear.call(this,A);},readCookies:function(){var A={};var c=document.cookie+";";var re=/\s?(.*?)=(.*?);/g;var B;while((B=re.exec(c))!=null){var C=B[1];var D=B[2];if(C&&C.substring(0,3)=="ys-"){A[C.substr(3)]=this.decodeValue(D);}}return A;},setCookie:function(A,B){document.cookie="ys-"+A+"="+this.encodeValue(B)+((this.expires==null)?"":("; expires="+this.expires.toGMTString()))+((this.path==null)?"":("; path="+this.path))+((this.domain==null)?"":("; domain="+this.domain))+((this.secure==true)?"; secure":"");},clearCookie:function(A){document.cookie="ys-"+A+"=null; expires=Thu, 01-Jan-70 00:00:01 GMT"+((this.path==null)?"":("; path="+this.path))+((this.domain==null)?"":("; domain="+this.domain))+((this.secure==true)?"; secure":"");}});