new mooui with a "beforeShow" event in the window class
make use of this new event in the preferences window to get the values before the window is shown
This commit is contained in:
parent
75936dd1ab
commit
7ddee092e0
|
@ -840,7 +840,7 @@ Deluge.Widgets.PreferencesWindow = new Class({
|
|||
this.categories = [];
|
||||
this.currentPage = -1;
|
||||
this.addEvent('loaded', this.loaded.bindWithEvent(this));
|
||||
this.addEvent('show', this.shown.bindWithEvent(this));
|
||||
this.addEvent('beforeShow', this.beforeShown.bindWithEvent(this));
|
||||
},
|
||||
|
||||
loaded: function(event) {
|
||||
|
@ -922,7 +922,7 @@ Deluge.Widgets.PreferencesWindow = new Class({
|
|||
this.webui.apply();
|
||||
},
|
||||
|
||||
shown: function(event) {
|
||||
beforeShown: function(event) {
|
||||
// we want this to be blocking
|
||||
var config = Deluge.Client.get_config({async: false});
|
||||
|
||||
|
|
|
@ -1021,7 +1021,7 @@ Widgets.Window = new Class({
|
|||
width: this.options.width,
|
||||
height: this.options.height
|
||||
});
|
||||
this.element.setStyle('opacity', 0)
|
||||
this.element.setStyle('opacity', 0);
|
||||
this.title = new Element('h3').addClass('mooui-window-title');
|
||||
this.element.grab(this.title);
|
||||
this.title.set('text', this.options.title);
|
||||
|
@ -1033,8 +1033,8 @@ Widgets.Window = new Class({
|
|||
this.close = new Element('div').addClass('mooui-window-close');
|
||||
this.close.inject(this.element);
|
||||
this.close.addEvent('click', function(e) {
|
||||
this.hide()
|
||||
}.bindWithEvent(this))
|
||||
this.hide();
|
||||
}.bindWithEvent(this));
|
||||
|
||||
this.content = new Element('div').addClass('mooui-window-content');
|
||||
this.content.inject(this.element);
|
||||
|
@ -1044,22 +1044,23 @@ Widgets.Window = new Class({
|
|||
url: this.options.url,
|
||||
update: this.content,
|
||||
onSuccess: function(e) {
|
||||
this.fireEvent('loaded')
|
||||
this.fireEvent('loaded');
|
||||
}.bindWithEvent(this)
|
||||
}).get()
|
||||
}).get();
|
||||
}
|
||||
},
|
||||
|
||||
show: function() {
|
||||
var size = document.body.getInnerSize()
|
||||
var left = (size.x - this.options.width) / 2, top = (size.y - this.options.height) / 2
|
||||
this.fireEvent('beforeShow');
|
||||
var size = document.body.getInnerSize();
|
||||
var left = (size.x - this.options.width) / 2, top = (size.y - this.options.height) / 2;
|
||||
this.sets({
|
||||
left: left,
|
||||
top: top
|
||||
})
|
||||
document.body.grab(this.element)
|
||||
this.element.setStyle('opacity', 1)
|
||||
this.fireEvent('show')
|
||||
});
|
||||
document.body.grab(this.element);
|
||||
this.element.setStyle('opacity', 1);
|
||||
this.fireEvent('show');
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
|
|
Loading…
Reference in New Issue