From 5eb92ab9b7aa36f7778c8c266c38754f9e020308 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Mon, 10 Nov 2008 18:37:21 +0000 Subject: [PATCH] tie up the contents of the iframe with some javascript --- .../render/html/window_add_torrent_file.html | 2 +- .../templates/ajax/static/js/deluge-add.js | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/deluge/ui/webui/templates/ajax/render/html/window_add_torrent_file.html b/deluge/ui/webui/templates/ajax/render/html/window_add_torrent_file.html index 1e886342f..4613f734a 100644 --- a/deluge/ui/webui/templates/ajax/render/html/window_add_torrent_file.html +++ b/deluge/ui/webui/templates/ajax/render/html/window_add_torrent_file.html @@ -5,7 +5,7 @@

- +
diff --git a/deluge/ui/webui/templates/ajax/static/js/deluge-add.js b/deluge/ui/webui/templates/ajax/static/js/deluge-add.js index 6e1622975..31e7a9f21 100644 --- a/deluge/ui/webui/templates/ajax/static/js/deluge-add.js +++ b/deluge/ui/webui/templates/ajax/static/js/deluge-add.js @@ -107,12 +107,35 @@ Deluge.Widgets.AddTorrent.File = new Class({ initialize: function() { this.parent(); + this.bound = { + onLoad: this.onLoad.bindWithEvent(this), + onCancel: this.onCancel.bindWithEvent(this), + onSubmit: this.onSubmit.bindWithEvent(this) + }; this.iframe = new Element('iframe', { src: '/template/render/html/window_add_torrent_file.html', height: 100, width: 300 }); + this.iframe.addEvent('load', this.bound.onLoad); this.content.grab(this.iframe); + }, + + onLoad: function(e) { + var body = $(this.iframe.contentDocument.body); + this.cancelButton = body.getElement('button.cancel'); + this.cancelButton.addEvent('click', this.bound.onCancel); + + var form = body.getElement('form'); + form.addEvent('submit', this.bound.onSubmit); + }, + + onCancel: function(e) { + this.hide(); + }, + + onSubmit: function(e) { + alert('form sent'); } });