add a stub page /json/upload

couple of fixes in mooui
couple of fixes in deluge-details
This commit is contained in:
Damien Churchill 2008-11-10 12:05:21 +00:00
parent 53f3e89640
commit f2dc542aba
3 changed files with 14 additions and 4 deletions

View File

@ -238,8 +238,16 @@ class json_rpc:
aclient.add_torrent_file_binary(filename, fdump, torrent['options']) aclient.add_torrent_file_binary(filename, fdump, torrent['options'])
aclient.force_call() aclient.force_call()
class json_upload:
def GET(self):
pass
def POST(self, name=None):
pass
def register(): def register():
component.get("PageManager").register_page("/json/rpc",json_rpc) component.get("PageManager").register_page("/json/rpc",json_rpc)
component.get("PageManager").register_page("/json/upload",json_upload)
if __name__ == '__main__': if __name__ == '__main__':
print "todo: tests" print "todo: tests"

View File

@ -89,13 +89,13 @@ return menu},build:function(){var self=this
if($defined(this.element)){this.element.destroy();} if($defined(this.element)){this.element.destroy();}
this.element=this._build(this.items)},hide:function(force){if(!this.no_close){this.element.dispose() this.element=this._build(this.items)},hide:function(force){if(!this.no_close){this.element.dispose()
this.fireEvent('closed')}else if(force){this.element.dispose() this.fireEvent('closed')}else if(force){this.element.dispose()
this.fireEvent('closed')}},show:function(e){x=e.client.x,y=e.client.y-10;this.element.inject(document.body);var menuSize=this.element.getSize(),windowSize=window.getSize();if((menuSize.y+y)>=windowSize.y){y=windowSize.y-menuSize.y-(windowSize.y-y);};this.element.setStyles({'left':x,'top':y-2});this.element.addEvent('mouseleave',function(e){this.hide();}.bind(this));},fixSize:function(el){var widest=0;el.getElements('li').each(function(item){var text=item.getElement('span');var width=text.getSize().x;if(width>widest){widest=width};});el.setStyle('width',widest+32);},fixLeft:function(el){var widest=0 this.fireEvent('closed')}},show:function(e){x=e.client.x,y=e.client.y-10;this.element.inject(document.body);this.fixSize();this.fixLeft();var menuSize=this.element.getSize(),windowSize=window.getSize();if((menuSize.y+y)>=windowSize.y){y=windowSize.y-menuSize.y-(windowSize.y-y);};this.element.setStyles({'left':x,'top':y-2});this.element.addEvent('mouseleave',function(e){this.hide();}.bind(this));},fixSize:function(el){var widest=0;el.getElements('li').each(function(item){var text=item.getElement('span');var width=text.getSize().x;if(width>widest){widest=width};});el.setStyle('width',widest+32);},fixLeft:function(el){var widest=0
el.getElements('li').each(function(item){var width=item.getSize().x el.getElements('li').each(function(item){var width=item.getSize().x
if(width>widest){widest=width}});el.setStyle('width',widest+2) if(width>widest){widest=width}});el.setStyle('width',widest+2)
el.getElements('li ul').each(function(item){item.setStyle('left',widest-20)});},showPos:function(x,y){}}) el.getElements('li ul').each(function(item){item.setStyle('left',widest-20)});},showPos:function(x,y){}})
Widgets.ProgressBar=new Class({Extends:Widgets.Base,initialize:function(){this.parent(new Element('div'));this.bound={onResize:this.onResize.bindWithEvent(this)};this.element.addClass('moouiProgressBar');this.bar=new Element('div').inject(this.element);this.textSpan=new Element('span').inject(this.bar);this.sets({width:200,height:20});this.addEvent('resize',this.bound.onResize);},onResize:function(){this.textSpan.setStyles({'width':this.width,'height':this.height});this.update(this.text,this.percent);},update:function(text,percent){if(this.text!=text){this.text=text;this.textSpan.set('text',text);};if(this.percent!=percent){this.percent=percent;this.bar.setStyles({'width':Math.floor(this.width/100.0*percent),'height':this.height});};}});Widgets.Spinner=new Class({Extends:Widgets.Base,options:{precision:0,step:1,limit:{high:null,low:null}},initialize:function(input,options){this.parent(new Element('div'),options);this.bound={onMouseDown:this.onMouseDown.bindWithEvent(this),onMouseUp:this.onMouseUp.bindWithEvent(this),onMouseWheel:this.onMouseWheel.bindWithEvent(this),onKeyDown:this.onKeyDown.bindWithEvent(this),onKeyUp:this.onKeyUp.bindWithEvent(this),onChange:this.onChange.bindWithEvent(this)};value=0;this.keyDown=false;if(input){this.element.replaces(input);value=new Number(input.value);};this.input=(input)?input:new Element('input');this.input.store('moouiWidget',this);this.element.grab(this.input);this.element.addClass('moouiSpinner');this.element.addEvent('mousewheel',this.bound.onMouseWheel);this.input.addEvent('keydown',this.bound.onKeyDown);this.input.addEvent('change',this.bound.onChange);this.buttons=new Element('div').addClass('moouiSpinnerButtons');this.up=new Element('div').addClass('moouiSpinnerUp');this.down=new Element('div').addClass('moouiSpinnerDown');this.up.addEvent('mousedown',this.bound.onMouseDown);this.down.addEvent('mousedown',this.bound.onMouseDown);this.buttons.grab(this.up);this.buttons.grab(this.down);this.element.grab(this.buttons);this.setValue(value);},getPrecision:function(){return Math.pow(10,this.options.precision+1)/10;},setValue:function(value){if(this.options.limit){if(this.options.limit.low&&value<=this.options.limit.low){value=this.options.limit.low;this.down.setStyle('opacity','0.5');}else if(this.options.limit.high&&value>=this.options.limit.high){value=this.options.limit.high;this.up.setStyle('opacity','0.5');}else{this.up.setStyle('opacity','1');this.down.setStyle('opacity','1');};};this.value=new Number(value);this.input.set('value',this.value.toFixed(this.options.precision));this.settingValue=true;this.input.fireEvent('change');},changeValue:function(change){value=this.value+(change/this.getPrecision());this.setValue(value);},acceleratingChange:function(change){if(this.stop)return;this.changeValue(change);if(this.interval>100)this.interval-=100 Widgets.ProgressBar=new Class({Extends:Widgets.Base,initialize:function(){this.parent(new Element('div'));this.bound={onResize:this.onResize.bindWithEvent(this)};this.element.addClass('moouiProgressBar');this.bar=new Element('div').inject(this.element);this.textSpan=new Element('span').inject(this.bar);this.sets({width:200,height:20});this.addEvent('resize',this.bound.onResize);},onResize:function(){this.textSpan.setStyles({'width':this.width,'height':this.height});this.update(this.text,this.percent);},update:function(text,percent){if(this.text!=text){this.text=text;this.textSpan.set('text',text);};if(this.percent!=percent){this.percent=percent;this.bar.setStyles({'width':Math.floor(this.width/100.0*percent),'height':this.height});};}});Widgets.Spinner=new Class({Extends:Widgets.Base,options:{precision:0,step:1,limit:{high:null,low:null}},initialize:function(input,options){this.parent(new Element('div'),options);this.bound={onMouseDown:this.onMouseDown.bindWithEvent(this),onMouseUp:this.onMouseUp.bindWithEvent(this),onMouseWheel:this.onMouseWheel.bindWithEvent(this),onKeyDown:this.onKeyDown.bindWithEvent(this),onKeyUp:this.onKeyUp.bindWithEvent(this),onChange:this.onChange.bindWithEvent(this)};value=0;this.keyDown=false;if(input){this.element.replaces(input);value=new Number(input.value);};this.input=(input)?input:new Element('input');this.input.store('moouiWidget',this);this.element.grab(this.input);this.element.addClass('moouiSpinner');this.element.addEvent('mousewheel',this.bound.onMouseWheel);this.input.addEvent('keydown',this.bound.onKeyDown);this.input.addEvent('change',this.bound.onChange);this.buttons=new Element('div').addClass('moouiSpinnerButtons');this.up=new Element('div').addClass('moouiSpinnerUp');this.down=new Element('div').addClass('moouiSpinnerDown');this.up.addEvent('mousedown',this.bound.onMouseDown);this.down.addEvent('mousedown',this.bound.onMouseDown);this.buttons.grab(this.up);this.buttons.grab(this.down);this.element.grab(this.buttons);this.setValue(value);},getPrecision:function(){return Math.pow(10,this.options.precision+1)/10;},setValue:function(value){if(this.options.limit){if(this.options.limit.low&&value<=this.options.limit.low){value=this.options.limit.low;this.down.setStyle('opacity','0.5');}else if(this.options.limit.high&&value>=this.options.limit.high){value=this.options.limit.high;this.up.setStyle('opacity','0.5');}else{this.up.setStyle('opacity','1');this.down.setStyle('opacity','1');};};this.value=new Number(value);this.input.set('value',this.value.toFixed(this.options.precision));this.settingValue=true;this.input.fireEvent('change');},changeValue:function(change){value=this.value+(change/this.getPrecision());this.setValue(value);},acceleratingChange:function(change){if(this.stop)return;this.changeValue(change);if(this.interval>100)this.interval-=100
else if(this.interval>10)this.interval-=10 else if(this.interval>10)this.interval-=10
this.acceleratingChange.delay(this.interval,this,change);},onMouseDown:function(e){this.value=new Number(this.input.value);document.addEvent('mouseup',this.bound.onMouseUp);if(e.target.hasClass('moouiSpinnerUp'))change=this.options.step;else change=this.options.step*-1;this.interval=600;this.stop=false;this.acceleratingChange(change);},onMouseUp:function(e){this.stop=true;document.removeEvent('mouseup',this.bound.onMouseUp);},onKeyDown:function(e){if(e.key=='up'||e.key=='down'){if(this.keyDown)return;this.value=new Number(this.input.value);change=(e.key=='up')?this.options.step:this.options.step*-1;this.input.addEvent('keyup',this.bound.onKeyUp);this.interval=600;this.stop=false;this.keyDown=true;this.acceleratingChange(change);}else if($A(['left','right','backspace']).contains(e.key)){return;}else{e.key=(e.code==190)?'.':e.key;pattern=/[0-9]/;if(!this.input.value.match(/\./)&&this.options.precision>0){pattern=/[0-9\.]/;};if(!e.key.match(pattern)){e.stop();return;};};},onKeyUp:function(e){this.stop=true;this.keyDown=false;this.input.removeEvent('keyup',this.bound.onKeyUp);},onMouseWheel:function(e){this.changeValue(this.options.step*e.wheel);},onChange:function(e){if(this.settingValue){this.settingValue=false;return;};this.setValue(new Number(this.input.value));}});Widgets.SplitPane=new Class({Extends:Widgets.Base,options:{direction:'horizontal',name:null,splitSize:6,pane1:{},pane2:{}},initialize:function(element,pane1,pane2,options){this.parent(element,options);this.bound={onResize:this.onResize.bindWithEvent(this),onMouseDown:this.onMouseDown.bindWithEvent(this),onMouseMove:this.onMouseMove.bindWithEvent(this),onMouseUp:this.onMouseUp.bindWithEvent(this)};this.horizontal=(this.options.direction=='horizontal')?true:false;this.pane1=$W(pane1);this.pane2=$W(pane2);if(this.options.expand)this.expand();this.initPane(this.pane1,this.options.pane1);this.initPane(this.pane2,this.options.pane2);this.initSplitter();this.calculatePositions();this.setPosition(this.pane1);this.setPosition(this.splitter);this.setPosition(this.pane2);this.splitter.addEvent('mousedown',this.bound.onMouseDown);this.addEvent('resize',this.bound.onResize);},initSplitter:function(){this.splitter=new Element('div').addClass('moouiSplitter');this.splitter.inject(this.pane1,'after');this.splitter.paneinfo={};if(this.horizontal){this.splitter.addClass('moouiSplitterVertical');}else{this.splitter.addClass('moouiSplitterHorizontal');};this.splitter.grab(new Element('div'));this.splitter.grab(new Element('div'));this.splitter.grab(new Element('div'));},onMouseDown:function(e){document.addEvent('mouseup',this.bound.onMouseUp);document.addEvent('mousemove',this.bound.onMouseMove);this.mouseStart={x:e.client.x,y:e.client.y};this.paneInfo={one:{startWidth:this.pane1.paneinfo.width,startHeight:this.pane1.paneinfo.height},two:{startWidth:this.pane2.paneinfo.width,startHeight:this.pane2.paneinfo.height}};},onMouseMove:function(e){if(this.horizontal){diff=e.client.x-this.mouseStart.x;p1width=this.paneInfo.one.startWidth+diff;p2width=this.paneInfo.two.startWidth-diff;if((this.pane1.paneinfo.min-this.pane1.element.modifiers.y)>p1width){this.pane1.paneinfo.width=this.pane1.paneinfo.min;this.pane2.paneinfo.width=this.paneInfo.two.startWidth+(this.paneInfo.one.startWidth-this.pane1.paneinfo.min);}else if((this.pane2.paneinfo.min-this.pane2.element.modifiers.y)>p2width){this.pane2.paneinfo.width=this.pane2.paneinfo.min;this.pane1.paneinfo.width=this.paneInfo.one.startWidth+(this.paneInfo.two.startWidth-this.pane2.paneinfo.min);}else{this.pane1.paneinfo.width=p1width;this.pane2.paneinfo.width=p2width;};}else{diff=e.client.y-this.mouseStart.y;p1height=this.paneInfo.one.startHeight+diff;p2height=this.paneInfo.two.startHeight-diff;if(this.pane1.paneinfo.min>p1height){this.pane1.paneinfo.height=this.pane1.paneinfo.min;this.pane2.paneinfo.height=this.paneInfo.two.startHeight+(this.paneInfo.one.startHeight-this.pane1.paneinfo.min);}else if(this.pane2.paneinfo.min>p2height){this.pane2.paneinfo.height=this.pane2.paneinfo.min;this.pane1.paneinfo.height=this.paneInfo.one.startHeight+(this.paneInfo.two.startHeight-this.pane2.paneinfo.min);}else{this.pane1.paneinfo.height=p1height;this.pane2.paneinfo.height=p2height;};};this.setPosition(this.pane1);this.setPosition(this.pane2);},onMouseUp:function(e){document.removeEvent('mouseup',this.bound.onMouseUp);document.removeEvent('mousemove',this.bound.onMouseMove);},initPane:function(pane,options){pane.addClass('moouiPane');pane.paneinfo={} this.acceleratingChange.delay(this.interval,this,change);},onMouseDown:function(e){this.value=new Number(this.input.value);document.addEvent('mouseup',this.bound.onMouseUp);if(e.target.hasClass('moouiSpinnerUp'))change=this.options.step;else change=this.options.step*-1;this.interval=600;this.stop=false;this.acceleratingChange(change);},onMouseUp:function(e){this.stop=true;document.removeEvent('mouseup',this.bound.onMouseUp);},onKeyDown:function(e){if(e.key=='up'||e.key=='down'){if(this.keyDown)return;this.value=new Number(this.input.value);change=(e.key=='up')?this.options.step:this.options.step*-1;this.input.addEvent('keyup',this.bound.onKeyUp);this.interval=600;this.stop=false;this.keyDown=true;this.acceleratingChange(change);}else if($A(['left','right','backspace']).contains(e.key)){return;}else{e.key=(e.code==190)?'.':e.key;pattern=/[0-9]/;if(!this.input.value.match(/\./)&&this.options.precision>0){pattern=/[0-9\.]/;};if(!e.key.match(pattern)){e.stop();return;};};},onKeyUp:function(e){this.stop=true;this.keyDown=false;this.input.removeEvent('keyup',this.bound.onKeyUp);},onMouseWheel:function(e){this.changeValue(this.options.step*e.wheel);},onChange:function(e){if(this.settingValue){this.settingValue=false;return;};this.setValue(new Number(this.input.value));}});Widgets.SplitPane=new Class({Extends:Widgets.Base,options:{direction:'horizontal',name:null,splitSize:6,pane1:{},pane2:{}},initialize:function(element,pane1,pane2,options){this.parent(element,options);this.bound={onResize:this.onResize.bindWithEvent(this),onMouseDown:this.onMouseDown.bindWithEvent(this),onMouseMove:this.onMouseMove.bindWithEvent(this),onMouseUp:this.onMouseUp.bindWithEvent(this)};this.horizontal=(this.options.direction=='horizontal')?true:false;this.pane1=$W(pane1);this.pane2=$W(pane2);if(this.options.expand)this.expand();this.initPane(this.pane1,this.options.pane1);this.initPane(this.pane2,this.options.pane2);this.initSplitter();this.calculatePositions();this.setPosition(this.pane1);this.setPosition(this.splitter);this.setPosition(this.pane2);this.splitter.addEvent('mousedown',this.bound.onMouseDown);this.addEvent('resize',this.bound.onResize);},initSplitter:function(){this.splitter=new Element('div').addClass('moouiSplitter');this.splitter.inject(this.pane1,'after');this.splitter.paneinfo={};if(this.horizontal){this.splitter.addClass('moouiSplitterVertical');}else{this.splitter.addClass('moouiSplitterHorizontal');};this.splitter.grab(new Element('div'));this.splitter.grab(new Element('div'));this.splitter.grab(new Element('div'));},onMouseDown:function(e){document.addEvent('mouseup',this.bound.onMouseUp);document.addEvent('mousemove',this.bound.onMouseMove);this.mouseStart={x:e.client.x,y:e.client.y};this.paneInfo={one:{startWidth:this.pane1.paneinfo.width,startHeight:this.pane1.paneinfo.height},two:{startWidth:this.pane2.paneinfo.width,startHeight:this.pane2.paneinfo.height}};},onMouseMove:function(e){if(this.horizontal){diff=e.client.x-this.mouseStart.x;p1width=this.paneInfo.one.startWidth+diff;p2width=this.paneInfo.two.startWidth-diff;if((this.pane1.paneinfo.min+this.pane1.element.modifiers.x)>p1width){this.pane1.paneinfo.width=this.pane1.paneinfo.min;this.pane2.paneinfo.width=this.paneInfo.two.startWidth+(this.paneInfo.one.startWidth-this.pane1.paneinfo.min);}else if((this.pane2.paneinfo.min+this.pane2.element.modifiers.x)>p2width){this.pane2.paneinfo.width=this.pane2.paneinfo.min;this.pane1.paneinfo.width=this.paneInfo.one.startWidth+(this.paneInfo.two.startWidth-this.pane2.paneinfo.min);}else{this.pane1.paneinfo.width=p1width;this.pane2.paneinfo.width=p2width;};}else{diff=e.client.y-this.mouseStart.y;p1height=this.paneInfo.one.startHeight+diff;p2height=this.paneInfo.two.startHeight-diff;if((this.pane1.paneinfo.min+this.pane1.element.modifiers.y)>p1height){this.pane1.paneinfo.height=this.pane1.paneinfo.min;this.pane2.paneinfo.height=this.paneInfo.two.startHeight+(this.paneInfo.one.startHeight-this.pane1.paneinfo.min);}else if((this.pane2.paneinfo.min+this.pane2.element.modifiers.y)>p2height){this.pane2.paneinfo.height=this.pane2.paneinfo.min;this.pane1.paneinfo.height=this.paneInfo.one.startHeight+(this.paneInfo.two.startHeight-this.pane2.paneinfo.min);}else{this.pane1.paneinfo.height=p1height;this.pane2.paneinfo.height=p2height;};};this.setPosition(this.pane1);this.setPosition(this.pane2);},onMouseUp:function(e){document.removeEvent('mouseup',this.bound.onMouseUp);document.removeEvent('mousemove',this.bound.onMouseMove);},initPane:function(pane,options){pane.addClass('moouiPane');pane.paneinfo={}
if(options){pane.paneinfo.min=(options.min)?options.min:0;pane.paneinfo.expand=(options.expand)?options.expand:false;};},calculatePositions:function(resized){if(resized){if(this.horizontal){this.calculateResize(resized,'width','height','x','y');}else{this.calculateResize(resized,'height','width','y','x');}}else{if(this.horizontal){this.calculateInitial('width','height','x','y');}else{this.calculateInitial('height','width','y','x');}}},calculateInitial:function(dm,ds,pm,ps){var size=this.getInnerSize();this.pane1.getSizeModifiers();this.pane2.getSizeModifiers();this.splitter.getSizeModifiers();if(this.pane1.paneinfo.expand){this.pane2.paneinfo[dm]=this.pane2.paneinfo.min;this.pane1.paneinfo[dm]=size[pm]-this.pane2.paneinfo.min-this.options.splitSize;this.pane1.paneinfo[dm]-=this.pane1.element.modifiers[pm]+this.pane2.element.modifiers[pm];}else{this.pane1.paneinfo[dm]=this.pane1.paneinfo.min;this.pane2.paneinfo[dm]=size[pm]-this.pane1.paneinfo.min-this.options.splitSize;this.pane2.paneinfo[dm]-=this.pane2.element.modifiers[pm]+this.pane1.element.modifiers[pm];} if(options){pane.paneinfo.min=(options.min)?options.min:0;pane.paneinfo.expand=(options.expand)?options.expand:false;};},calculatePositions:function(resized){if(resized){if(this.horizontal){this.calculateResize(resized,'width','height','x','y');}else{this.calculateResize(resized,'height','width','y','x');}}else{if(this.horizontal){this.calculateInitial('width','height','x','y');}else{this.calculateInitial('height','width','y','x');}}},calculateInitial:function(dm,ds,pm,ps){var size=this.getInnerSize();this.pane1.getSizeModifiers();this.pane2.getSizeModifiers();this.splitter.getSizeModifiers();if(this.pane1.paneinfo.expand){this.pane2.paneinfo[dm]=this.pane2.paneinfo.min;this.pane1.paneinfo[dm]=size[pm]-this.pane2.paneinfo.min-this.options.splitSize;this.pane1.paneinfo[dm]-=this.pane1.element.modifiers[pm]+this.pane2.element.modifiers[pm];}else{this.pane1.paneinfo[dm]=this.pane1.paneinfo.min;this.pane2.paneinfo[dm]=size[pm]-this.pane1.paneinfo.min-this.options.splitSize;this.pane2.paneinfo[dm]-=this.pane2.element.modifiers[pm]+this.pane1.element.modifiers[pm];}
this.pane1.paneinfo[ds]=this.pane2.paneinfo[ds]=size[ps];this.pane1.paneinfo[ds]-=this.pane1.element.modifiers[ps];this.pane2.paneinfo[ds]-=this.pane2.element.modifiers[ps];this.splitter.paneinfo[ds]=size[ps];this.splitter.paneinfo[dm]=this.options.splitSize;},calculateResize:function(resized,dm,ds,pm,ps){size=this.getInnerSize();this.pane1.getSizeModifiers();this.pane2.getSizeModifiers();this.splitter.getSizeModifiers();if(resized[dm]&&resized[dm]!=resized[('old-'+dm).camelCase()]){if(this.pane1.paneinfo.expand){this.pane1.paneinfo[dm]=size[pm]-this.pane2.paneinfo[dm]-this.options.splitSize;this.pane1.paneinfo[dm]-=this.pane1.element.modifiers[pm]+this.pane2.element.modifiers[pm];}else{this.pane2.paneinfo[dm]=size[pm]-this.pane1.paneinfo[dm]-this.options.splitSize;this.pane2.paneinfo[dm]-=this.pane2.element.modifiers[pm]+this.pane1.element.modifiers[pm];}};if(resized[ds]&&resized[ds]!=resized[('old-'+ds).camelCase()]){this.pane1.paneinfo[ds]=this.pane2.paneinfo[ds]=size[ps];this.splitter.paneinfo[ds]=size[ps];this.splitter.paneinfo[ds]-=this.splitter.modifiers[ps];this.pane1.paneinfo[ds]-=this.pane1.element.modifiers[ps];this.pane2.paneinfo[ds]-=this.pane2.element.modifiers[ps];};},setPosition:function(object){if(object.hasClass('moouiSplitter')){sets=object.setStyles.bind(object);}else{sets=object.sets.bind(object);};sets({width:object.paneinfo.width,height:object.paneinfo.height});},onResize:function(event){this.calculatePositions(event) this.pane1.paneinfo[ds]=this.pane2.paneinfo[ds]=size[ps];this.pane1.paneinfo[ds]-=this.pane1.element.modifiers[ps];this.pane2.paneinfo[ds]-=this.pane2.element.modifiers[ps];this.splitter.paneinfo[ds]=size[ps];this.splitter.paneinfo[dm]=this.options.splitSize;},calculateResize:function(resized,dm,ds,pm,ps){size=this.getInnerSize();this.pane1.getSizeModifiers();this.pane2.getSizeModifiers();this.splitter.getSizeModifiers();if(resized[dm]&&resized[dm]!=resized[('old-'+dm).camelCase()]){if(this.pane1.paneinfo.expand){this.pane1.paneinfo[dm]=size[pm]-this.pane2.paneinfo[dm]-this.options.splitSize;this.pane1.paneinfo[dm]-=this.pane1.element.modifiers[pm]+this.pane2.element.modifiers[pm];}else{this.pane2.paneinfo[dm]=size[pm]-this.pane1.paneinfo[dm]-this.options.splitSize;this.pane2.paneinfo[dm]-=this.pane2.element.modifiers[pm]+this.pane1.element.modifiers[pm];}};if(resized[ds]&&resized[ds]!=resized[('old-'+ds).camelCase()]){this.pane1.paneinfo[ds]=this.pane2.paneinfo[ds]=size[ps];this.splitter.paneinfo[ds]=size[ps];this.splitter.paneinfo[ds]-=this.splitter.modifiers[ps];this.pane1.paneinfo[ds]-=this.pane1.element.modifiers[ps];this.pane2.paneinfo[ds]-=this.pane2.element.modifiers[ps];};},setPosition:function(object){if(object.hasClass('moouiSplitter')){sets=object.setStyles.bind(object);}else{sets=object.sets.bind(object);};sets({width:object.paneinfo.width,height:object.paneinfo.height});},onResize:function(event){this.calculatePositions(event)
this.setPosition(this.pane1);this.setPosition(this.splitter);this.setPosition(this.pane2);}}) this.setPosition(this.pane1);this.setPosition(this.splitter);this.setPosition(this.pane2);}})

View File

@ -114,7 +114,7 @@ Deluge.Widgets.StatisticsPage = new Class({
}, },
clear: function() { clear: function() {
this.bar.update('', 0); if (this.bar) this.bar.update('', 0);
this.element.getElements('dd').each(function(item) { this.element.getElements('dd').each(function(item) {
item.set('text', ''); item.set('text', '');
}, this); }, this);
@ -298,7 +298,7 @@ Deluge.Widgets.FilesPage = new Class({
}, },
clear: function() { clear: function() {
this.grid.clear(); if (this.grid) this.grid.clear();
}, },
resized: function(e) { resized: function(e) {
@ -371,6 +371,7 @@ Deluge.Widgets.PeersPage = new Class({
}, },
clear: function() { clear: function() {
if (!this.grid) return;
this.grid.rows.empty(); this.grid.rows.empty();
this.grid.body.empty(); this.grid.body.empty();
}, },
@ -517,6 +518,7 @@ Deluge.Widgets.OptionsPage = new Class({
}, },
clear: function() { clear: function() {
if (!this.form) return;
$$W(this.form.max_download_speed).setValue(0); $$W(this.form.max_download_speed).setValue(0);
$$W(this.form.max_upload_speed).setValue(0); $$W(this.form.max_upload_speed).setValue(0);
$$W(this.form.max_connections).setValue(0); $$W(this.form.max_connections).setValue(0);