mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-12 12:34:43 +00:00
tie up the contents of the iframe with some javascript
This commit is contained in:
parent
b49a4c66d8
commit
5eb92ab9b7
@ -5,7 +5,7 @@
|
||||
<body style="background: none;">
|
||||
<form method="post" action="/json/upload" enctype="multipart/form-data">
|
||||
<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>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -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');
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user