auto attach

This commit is contained in:
James Campos 2011-09-02 21:04:11 -07:00
parent 32dfad4da1
commit 571ca1f9b9
2 changed files with 8 additions and 4 deletions

View File

@ -1251,15 +1251,17 @@
}
},
attach: function() {
var div;
var div, file;
div = $.el('div', {
innerHTML: '<input name=upfile type=file><a class=close>X</a>'
});
$.bind($('input', div), 'change', QR.change);
file = $('input', div);
$.bind(file, 'change', QR.change);
$.bind($('a', div), 'click', function() {
return $.rm(this.parentNode);
});
return $.append($('#files', QR.el), div);
$.append($('#files', QR.el), div);
return file.click();
},
autoPost: function() {
if (!QR.hasContent()) {

View File

@ -982,9 +982,11 @@ QR =
attach: ->
div = $.el 'div',
innerHTML: '<input name=upfile type=file><a class=close>X</a>'
$.bind $('input', div), 'change', QR.change
file = $ 'input', div
$.bind file, 'change', QR.change
$.bind $('a', div), 'click', -> $.rm @parentNode
$.append $('#files', QR.el), div
file.click()
autoPost: ->
return unless QR.hasContent()
QR.submit()