diff --git a/deluge/ui/web/js/ext-extensions.js b/deluge/ui/web/js/ext-extensions.js index 634bf00d9..20e74da68 100644 --- a/deluge/ui/web/js/ext-extensions.js +++ b/deluge/ui/web/js/ext-extensions.js @@ -1 +1 @@ -Ext.namespace("Ext.ux.form");Ext.ux.form.Spinner=function(a){Ext.ux.form.Spinner.superclass.constructor.call(this,a);this.addEvents({spin:true,spinup:true,spindown:true})};Ext.extend(Ext.ux.form.Spinner,Ext.form.TriggerField,{triggerClass:"x-form-spinner-trigger",splitterClass:"x-form-spinner-splitter",alternateKey:Ext.EventObject.shiftKey,strategy:undefined,onRender:function(b,a){Ext.ux.form.Spinner.superclass.onRender.call(this,b,a);this.splitter=this.wrap.createChild({tag:"div",cls:this.splitterClass,style:"width:13px; height:2px;"});this.splitter.show().setRight((Ext.isIE)?1:2);this.splitter.show().setTop(10);this.proxy=this.trigger.createProxy("",this.splitter,true);this.proxy.addClass("x-form-spinner-proxy");this.proxy.setStyle("left","0px");this.proxy.setSize(14,1);this.proxy.hide();this.dd=new Ext.dd.DDProxy(this.splitter.dom.id,"SpinnerDrag",{dragElId:this.proxy.id});this.initSpinner()},initTrigger:function(){this.trigger.addClassOnOver("x-form-trigger-over");this.trigger.addClassOnClick("x-form-trigger-click")},initSpinner:function(){this.keyNav=new Ext.KeyNav(this.el,{up:function(a){a.preventDefault();this.onSpinUp()},down:function(a){a.preventDefault();this.onSpinDown()},pageUp:function(a){a.preventDefault();this.onSpinUpAlternate()},pageDown:function(a){a.preventDefault();this.onSpinDownAlternate()},scope:this});this.repeater=new Ext.util.ClickRepeater(this.trigger);this.repeater.on("click",this.onTriggerClick,this,{preventDefault:true});this.trigger.on("mouseover",this.onMouseOver,this,{preventDefault:true});this.trigger.on("mouseout",this.onMouseOut,this,{preventDefault:true});this.trigger.on("mousemove",this.onMouseMove,this,{preventDefault:true});this.trigger.on("mousedown",this.onMouseDown,this,{preventDefault:true});this.trigger.on("mouseup",this.onMouseUp,this,{preventDefault:true});this.wrap.on("mousewheel",this.handleMouseWheel,this);this.dd.setXConstraint(0,0,10);this.dd.setYConstraint(1500,1500,10);this.dd.endDrag=this.endDrag.createDelegate(this);this.dd.startDrag=this.startDrag.createDelegate(this);this.dd.onDrag=this.onDrag.createDelegate(this);if("object"==typeof this.strategy&&this.strategy.xtype){switch(this.strategy.xtype){case"number":this.strategy=new Ext.ux.form.Spinner.NumberStrategy(this.strategy);break;case"date":this.strategy=new Ext.ux.form.Spinner.DateStrategy(this.strategy);break;case"time":this.strategy=new Ext.ux.form.Spinner.TimeStrategy(this.strategy);break;default:delete (this.strategy);break}delete (this.strategy.xtype)}if(this.strategy==undefined){this.strategy=new Ext.ux.form.Spinner.NumberStrategy()}},onMouseOver:function(){if(this.disabled){return}var a=this.getMiddle();this.__tmphcls=(Ext.EventObject.getPageY()a)&&this.__tmphcls=="x-form-spinner-overup")||((Ext.EventObject.getPageY()0){this.onSpinUp();a.stopEvent()}else{if(b<0){this.onSpinDown();a.stopEvent()}}},startDrag:function(){this.proxy.show();this._previousY=Ext.fly(this.dd.getDragEl()).getTop()},endDrag:function(){this.proxy.hide()},onDrag:function(){if(this.disabled){return}var b=Ext.fly(this.dd.getDragEl()).getTop();var a="";if(this._previousY>b){a="Up"}if(this._previousYthis.maxValue){a=this.maxValue}return this.fixPrecision(a)},fixPrecision:function(b){var a=isNaN(b);if(!this.allowDecimals||this.decimalPrecision==-1||a||!b){return a?"":b}return b.toFixed(this.decimalPrecision)}});Ext.ux.form.Spinner.DateStrategy=function(a){Ext.ux.form.Spinner.DateStrategy.superclass.constructor.call(this,a)};Ext.extend(Ext.ux.form.Spinner.DateStrategy,Ext.ux.form.Spinner.Strategy,{defaultValue:new Date(),format:"Y-m-d",incrementValue:1,incrementConstant:Date.DAY,alternateIncrementValue:1,alternateIncrementConstant:Date.MONTH,spin:function(d,g,e){Ext.ux.form.Spinner.DateStrategy.superclass.spin.call(this);var a=d.getRawValue();a=Date.parseDate(a,this.format);var c=(g==true)?-1:1;var f=(e==true)?this.alternateIncrementValue:this.incrementValue;var b=(e==true)?this.alternateIncrementConstant:this.incrementConstant;if(typeof this.defaultValue=="string"){this.defaultValue=Date.parseDate(this.defaultValue,this.format)}a=(a)?a.add(b,c*f):this.defaultValue;a=this.fixBoundries(a);d.setRawValue(Ext.util.Format.date(a,this.format))},fixBoundries:function(b){var d=b;var c=(typeof this.minValue=="string")?Date.parseDate(this.minValue,this.format):this.minValue;var a=(typeof this.maxValue=="string")?Date.parseDate(this.maxValue,this.format):this.maxValue;if(this.minValue!=undefined&&da){d=a}return d}});Ext.ux.form.Spinner.TimeStrategy=function(a){Ext.ux.form.Spinner.TimeStrategy.superclass.constructor.call(this,a)};Ext.extend(Ext.ux.form.Spinner.TimeStrategy,Ext.ux.form.Spinner.DateStrategy,{format:"H:i",incrementValue:1,incrementConstant:Date.MINUTE,alternateIncrementValue:1,alternateIncrementConstant:Date.HOUR});Ext.tree.ColumnTree=Ext.extend(Ext.tree.TreePanel,{lines:false,borderWidth:Ext.isBorderBox?0:2,cls:"x-column-tree",onRender:function(){Ext.tree.ColumnTree.superclass.onRender.apply(this,arguments);this.headers=this.body.createChild({cls:"x-tree-headers"},this.innerCt.dom);var e=this.columns,f;var b=0;for(var d=0,a=e.length;d
','
','',this.indentMarkup,"",'','',f?('':"/>")):"",'",'',e.text||(m.renderer?m.renderer(q[m.dataIndex],e,q):q[m.dataIndex]),"","
"];for(var g=1,k=p.length;g','
',(m.renderer?m.renderer(q[m.dataIndex],e,q):q[m.dataIndex]),"
","
")}d.push('
','',"");if(r!==true&&e.nextSibling&&e.nextSibling.ui.getEl()){this.wrap=Ext.DomHelper.insertHtml("beforeBegin",e.nextSibling.ui.getEl(),d.join(""))}else{this.wrap=Ext.DomHelper.insertHtml("beforeEnd",l,d.join(""))}this.elNode=this.wrap.childNodes[0];this.ctNode=this.wrap.childNodes[1];var j=this.elNode.firstChild.childNodes;this.indentNode=j[0];this.ecNode=j[1];this.iconNode=j[2];var h=3;if(f){this.checkbox=j[3];this.checkbox.defaultChecked=this.checkbox.checked;h++}this.anchor=j[h];this.columnNodes=[j[h].firstChild];for(var g=1,k=p.length;ga)&&this.__tmphcls=="x-form-spinner-overup")||((Ext.EventObject.getPageY()0){this.onSpinUp();a.stopEvent()}else{if(b<0){this.onSpinDown();a.stopEvent()}}},startDrag:function(){this.proxy.show();this._previousY=Ext.fly(this.dd.getDragEl()).getTop()},endDrag:function(){this.proxy.hide()},onDrag:function(){if(this.disabled){return}var b=Ext.fly(this.dd.getDragEl()).getTop();var a="";if(this._previousY>b){a="Up"}if(this._previousYthis.maxValue){a=this.maxValue}return this.fixPrecision(a)},fixPrecision:function(b){var a=isNaN(b);if(!this.allowDecimals||this.decimalPrecision==-1||a||!b){return a?"":b}return b.toFixed(this.decimalPrecision)}});Ext.ux.form.Spinner.DateStrategy=function(a){Ext.ux.form.Spinner.DateStrategy.superclass.constructor.call(this,a)};Ext.extend(Ext.ux.form.Spinner.DateStrategy,Ext.ux.form.Spinner.Strategy,{defaultValue:new Date(),format:"Y-m-d",incrementValue:1,incrementConstant:Date.DAY,alternateIncrementValue:1,alternateIncrementConstant:Date.MONTH,spin:function(d,g,e){Ext.ux.form.Spinner.DateStrategy.superclass.spin.call(this);var a=d.getRawValue();a=Date.parseDate(a,this.format);var c=(g==true)?-1:1;var f=(e==true)?this.alternateIncrementValue:this.incrementValue;var b=(e==true)?this.alternateIncrementConstant:this.incrementConstant;if(typeof this.defaultValue=="string"){this.defaultValue=Date.parseDate(this.defaultValue,this.format)}a=(a)?a.add(b,c*f):this.defaultValue;a=this.fixBoundries(a);d.setRawValue(Ext.util.Format.date(a,this.format))},fixBoundries:function(b){var d=b;var c=(typeof this.minValue=="string")?Date.parseDate(this.minValue,this.format):this.minValue;var a=(typeof this.maxValue=="string")?Date.parseDate(this.maxValue,this.format):this.maxValue;if(this.minValue!=undefined&&da){d=a}return d}});Ext.ux.form.Spinner.TimeStrategy=function(a){Ext.ux.form.Spinner.TimeStrategy.superclass.constructor.call(this,a)};Ext.extend(Ext.ux.form.Spinner.TimeStrategy,Ext.ux.form.Spinner.DateStrategy,{format:"H:i",incrementValue:1,incrementConstant:Date.MINUTE,alternateIncrementValue:1,alternateIncrementConstant:Date.HOUR});Ext.tree.ColumnTree=Ext.extend(Ext.tree.TreePanel,{lines:false,borderWidth:Ext.isBorderBox?0:2,cls:"x-column-tree",onRender:function(){Ext.tree.ColumnTree.superclass.onRender.apply(this,arguments);this.headers=this.body.createChild({cls:"x-tree-headers"},this.innerCt.dom);var e=this.columns,f;var b=0;for(var d=0,a=e.length;d
','
','',this.indentMarkup,"",'','',f?('':"/>")):"",'",'',e.text||(m.renderer?m.renderer(q[m.dataIndex],e,q):q[m.dataIndex]),"","
"];for(var g=1,k=p.length;g','
',(m.renderer?m.renderer(q[m.dataIndex],e,q):q[m.dataIndex]),"
","
")}d.push('
','',"");if(r!==true&&e.nextSibling&&e.nextSibling.ui.getEl()){this.wrap=Ext.DomHelper.insertHtml("beforeBegin",e.nextSibling.ui.getEl(),d.join(""))}else{this.wrap=Ext.DomHelper.insertHtml("beforeEnd",l,d.join(""))}this.elNode=this.wrap.childNodes[0];this.ctNode=this.wrap.childNodes[1];var j=this.elNode.firstChild.childNodes;this.indentNode=j[0];this.ecNode=j[1];this.iconNode=j[2];var h=3;if(f){this.checkbox=j[3];this.checkbox.defaultChecked=this.checkbox.checked;h++}this.anchor=j[h];this.columnNodes=[j[h].firstChild];for(var g=1,k=p.length;g