diff --git a/4chan_x.js b/4chan_x.js
index 0ea867657..b6de43b64 100644
--- a/4chan_x.js
+++ b/4chan_x.js
@@ -1285,7 +1285,7 @@
return window.setTimeout(qr.cooldown, 1000);
},
dialog: function(link) {
- var clone, dialog, el, html, input, script, xpath, _i, _len, _ref;
+ var clone, dialog, el, html, resto, script, xpath, _i, _len, _ref;
html = "
";
dialog = ui.dialog('qr', {
top: '0px',
@@ -1304,12 +1304,12 @@
$.bind($('input[name=recaptcha_response_field]', clone), 'keydown', recaptchaListener);
if (!g.REPLY) {
xpath = 'preceding::span[@class="postername"][1]/preceding::input[1]';
- input = $.el('input', {
+ resto = $.el('input', {
type: 'hidden',
name: 'resto',
value: $.x(xpath, link).name
});
- $.append(clone, input);
+ $.before(clone.lastChild, resto);
}
$.append(dialog, clone);
$.append(d.body, dialog);
diff --git a/script.coffee b/script.coffee
index 94468cffd..ba8d04850 100644
--- a/script.coffee
+++ b/script.coffee
@@ -1010,11 +1010,11 @@ qr =
if not g.REPLY
#figure out which thread we're replying to
xpath = 'preceding::span[@class="postername"][1]/preceding::input[1]'
- input = $.el 'input',
+ resto = $.el 'input',
type: 'hidden'
name: 'resto'
value: $.x(xpath, link).name
- $.append clone, input
+ $.before clone.lastChild, resto
$.append dialog, clone
$.append d.body, dialog