diff --git a/4chan_x.user.js b/4chan_x.user.js
index 74e7ec264..a3e98b478 100644
--- a/4chan_x.user.js
+++ b/4chan_x.user.js
@@ -1294,19 +1294,35 @@
QR.el = el = ui.dialog('qr', {
top: '0',
left: '0'
- }, " X
Quick Reply
");
+ }, " X Quick Reply
");
if (conf['Cooldown']) {
QR.cooldown;
}
$.bind($('.close', el), 'click', QR.close);
$.bind($('form', el), 'submit', QR.submit);
$.bind($('#recaptcha_response_field', el), 'keydown', QR.keydown);
+ $.bind($('#attach', el), 'click', QR.attach);
$.append(d.body, el);
ta = $('textarea', el);
l = text.length;
ta.setSelectionRange(l, l);
return ta.focus();
},
+ change: function() {
+ $.unbind(this, 'change', QR.change);
+ return QR.attach();
+ },
+ attach: function() {
+ var div;
+ div = $.el('div', {
+ innerHTML: 'X'
+ });
+ $.bind($('input', div), 'change', QR.change);
+ $.bind($('a', div), 'click', function() {
+ return $.rm(this.parentNode);
+ });
+ return $.append($('#files', QR.el), div);
+ },
hasContent: function() {
return $('textarea', QR.el).value || $('[type=file]', QR.el).files.length;
},
diff --git a/script.coffee b/script.coffee
index e43142eb5..a4c76e673 100644
--- a/script.coffee
+++ b/script.coffee
@@ -1020,19 +1020,30 @@ QR =
#{$.get('captchas', []).length} captchas
-
+
+
"
QR.cooldown if conf['Cooldown']
$.bind $('.close', el), 'click', QR.close
$.bind $('form', el), 'submit', QR.submit
$.bind $('#recaptcha_response_field', el), 'keydown', QR.keydown
+ $.bind $('#attach', el), 'click', QR.attach
$.append d.body, el
ta = $ 'textarea', el
l = text.length
ta.setSelectionRange l, l
ta.focus()
+ change: ->
+ $.unbind @, 'change', QR.change
+ QR.attach()
+ attach: ->
+ div = $.el 'div',
+ innerHTML: 'X'
+ $.bind $('input', div), 'change', QR.change
+ $.bind $('a', div), 'click', -> $.rm @parentNode
+ $.append $('#files', QR.el), div
hasContent: ->
$('textarea', QR.el).value or $('[type=file]', QR.el).files.length
autoPost: ->