slight improvement to the add torrent from file

This commit is contained in:
Damien Churchill 2008-11-11 15:40:05 +00:00
commit 374335cae8
2 changed files with 8 additions and 5 deletions

File diff suppressed because one or more lines are too long

View file

@ -134,6 +134,7 @@ Deluge.Widgets.AddTorrent.File = new Class({
var form = body.getElement('form'); var form = body.getElement('form');
form.addEvent('submit', this.bound.onSubmit); form.addEvent('submit', this.bound.onSubmit);
this.iframe.removeEvent('load', this.bound.onLoad);
}, },
onCancel: function(e) { onCancel: function(e) {
@ -146,7 +147,7 @@ Deluge.Widgets.AddTorrent.File = new Class({
}, },
onComplete: function(e) { onComplete: function(e) {
filename = this.iframe.contentDocument.body.get('text'); filename = $(this.iframe.contentDocument.body).get('text');
Deluge.Client.get_torrent_info(filename, { Deluge.Client.get_torrent_info(filename, {
onSuccess: this.bound.onGetInfoSuccess onSuccess: this.bound.onGetInfoSuccess
}); });
@ -155,6 +156,9 @@ Deluge.Widgets.AddTorrent.File = new Class({
onGetInfoSuccess: function(info) { onGetInfoSuccess: function(info) {
this.fireEvent('torrentAdded', info); this.fireEvent('torrentAdded', info);
this.hide(); this.hide();
this.iframe.removeEvent('load', this.bound.onComplete);
this.iframe.addEvent('load', this.bound.onLoad);
this.iframe.src = '/template/render/html/window_add_torrent_file.html';
} }
}); });
@ -232,13 +236,12 @@ Deluge.Widgets.AddTorrent.FilesTab = new Class({
}, },
initialize: function() { initialize: function() {
this.parent('Files');
this.addEvent('loaded', this.onLoad.bindWithEvent(this)); this.addEvent('loaded', this.onLoad.bindWithEvent(this));
this.parent('Files');
}, },
onLoad: function(e) { onLoad: function(e) {
this.table = this.element.getElement('table'); this.table = this.element.getElement('table');
alert('boo');
}, },
setTorrent: function(torrent) { setTorrent: function(torrent) {