mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
tie up the contents of the iframe with some javascript
This commit is contained in:
parent
b49a4c66d8
commit
5eb92ab9b7
2 changed files with 24 additions and 1 deletions
|
@ -5,7 +5,7 @@
|
||||||
<body style="background: none;">
|
<body style="background: none;">
|
||||||
<form method="post" action="/json/upload" enctype="multipart/form-data">
|
<form method="post" action="/json/upload" enctype="multipart/form-data">
|
||||||
<label>$_('File'):</label><input type="file" name="torrentFile" /> <br/>
|
<label>$_('File'):</label><input type="file" name="torrentFile" /> <br/>
|
||||||
<button>$_('Ok')</button><button>$_('Cancel')</button>
|
<button class="ok">$_('Ok')</button><button class="cancel">$_('Cancel')</button>
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -107,12 +107,35 @@ Deluge.Widgets.AddTorrent.File = new Class({
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
this.bound = {
|
||||||
|
onLoad: this.onLoad.bindWithEvent(this),
|
||||||
|
onCancel: this.onCancel.bindWithEvent(this),
|
||||||
|
onSubmit: this.onSubmit.bindWithEvent(this)
|
||||||
|
};
|
||||||
this.iframe = new Element('iframe', {
|
this.iframe = new Element('iframe', {
|
||||||
src: '/template/render/html/window_add_torrent_file.html',
|
src: '/template/render/html/window_add_torrent_file.html',
|
||||||
height: 100,
|
height: 100,
|
||||||
width: 300
|
width: 300
|
||||||
});
|
});
|
||||||
|
this.iframe.addEvent('load', this.bound.onLoad);
|
||||||
this.content.grab(this.iframe);
|
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');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue