From a027010073ad21a17672b6f8d9c7f866b048bc7f Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Mon, 10 Nov 2008 12:19:50 +0000 Subject: [PATCH] add a check to see if the ui is initialized before running an update --- deluge/ui/webui/static/mooui.js | 13 +------------ .../ui/webui/templates/ajax/static/js/deluge-ui.js | 4 +++- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/deluge/ui/webui/static/mooui.js b/deluge/ui/webui/static/mooui.js index 00f848df7..47dcd209a 100644 --- a/deluge/ui/webui/static/mooui.js +++ b/deluge/ui/webui/static/mooui.js @@ -44,18 +44,7 @@ if(hours>0){return days+'d '+hours+'h';}else{return days+'d';}}}) String.implement({strip:function(){var stripped=this.replace(/^\s*/,'') stripped.replace(/\s*$/,'') return stripped}}) -Sorters={Simple:new Class({initialize:function(column,order){this.column=column -this.order=order},sorter:function(){return function(a,b){var av,bv -av=a.cells[this.column].value -bv=b.cells[this.column].value -return this.sort(av,bv)}.bind(this)},sort:function(a,b){if(a>b) -return 1*this.order -if(a0)this.element.setStyle(property,value);if(!noFire)this.fireEvent('resize',eventArgs);}else{this[property]=value;this.element.setStyle(property,value);}},sets:function(properties){properties=new Hash(properties);var fireResize=false;var eventArgs={};properties.each(function(value,key){if(key=='height'||key=='width'){eventArgs[('old-'+key).camelCase()]=this[key];eventArgs[key]=value;fireResize=true;} +Sorters={Simple:new Class({initialize:function(column,order){this.column=column;this.order=order;},sorter:function(){return function(a,b){var av,bv;av=a.cells[this.column].value;bv=b.cells[this.column].value;return this.sort(av,bv);}.bind(this);},sort:function(a,b){if(a>b)return 1*this.order;if(a0)this.element.setStyle(property,value);if(!noFire)this.fireEvent('resize',eventArgs);}else{this[property]=value;this.element.setStyle(property,value);}},sets:function(properties){properties=new Hash(properties);var fireResize=false;var eventArgs={};properties.each(function(value,key){if(key=='height'||key=='width'){eventArgs[('old-'+key).camelCase()]=this[key];eventArgs[key]=value;fireResize=true;} this.set(key,value,true);},this);if(fireResize)this.fireEvent('resize',eventArgs);},toElement:function(){return this.element;}});$W=function(wrap){if(!wrap.isMoouiWidget){if(wrap.retrieve){wrap=wrap.retrieve('moouiWidget');return(wrap)?wrap:new Widgets.Base(wrap);}else{return new Widgets.Base(wrap);};}else{return wrap;};};$$W=function(test){if(!test.isMoouiWidget){if(test.retrieve){test=test.retrieve('moouiWidget');return(test)?test:null;}else{return null;};}else{return wrap;};};Widgets.PopupMenu=new Class({Extends:Widgets.WidgetBase,Implements:Events,initialize:function(){this.items=[] this.noClose=false this.build()},add:function(item){if($type(item)=='array'){for(var i=0;i