diff --git a/4chan_x.user.js b/4chan_x.user.js index c84c42e2b..bdef3fc5f 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1532,17 +1532,17 @@ return qr.el = null; }, dialog: function(link) { - var THREAD_ID, c, email, html, m, name, pwd, submitDisabled, submitValue; - c = d.cookie; - name = (m = c.match(/4chan_name=([^;]+)/)) ? decodeURIComponent(m[1]) : ''; - email = (m = c.match(/4chan_email=([^;]+)/)) ? decodeURIComponent(m[1]) : ''; - pwd = (m = c.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value; + var THREAD_ID, c, html, m, submitDisabled, submitValue; submitValue = $('#com_submit').value; submitDisabled = $('#com_submit').disabled ? 'disabled' : ''; THREAD_ID = g.THREAD_ID || $.x('ancestor::div[@class="thread"]/div', link).id; qr.challenge = $('#recaptcha_challenge_field').value; - html = " X
Quick Reply
" + qr.spoiler + "
" + ($.get('captchas', []).length) + " captchas
attach another file
"; + html = " X
Quick Reply
" + qr.spoiler + "
" + ($.get('captchas', []).length) + " captchas
attach another file
"; qr.el = ui.dialog('qr', 'top: 0; left: 0;', html); + c = d.cookie; + $('input[name=name]', qr.el).value = (m = c.match(/4chan_name=([^;]+)/)) ? decodeURIComponent(m[1]) : ''; + $('input[name=email]', qr.el).value = (m = c.match(/4chan_email=([^;]+)/)) ? decodeURIComponent(m[1]) : ''; + $('input[name=pwd]', qr.el).value = (m = c.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value; $.on($('input[name=name]', qr.el), 'mousedown', function(e) { return e.stopPropagation(); }); diff --git a/script.coffee b/script.coffee index fad56c7a8..f792b676b 100644 --- a/script.coffee +++ b/script.coffee @@ -1143,10 +1143,6 @@ qr = qr.el = null dialog: (link) -> - c = d.cookie - name = if m = c.match(/4chan_name=([^;]+)/) then decodeURIComponent m[1] else '' - email = if m = c.match(/4chan_email=([^;]+)/) then decodeURIComponent m[1] else '' - pwd = if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value submitValue = $('#com_submit').value submitDisabled = if $('#com_submit').disabled then 'disabled' else '' #FIXME inlined cross-thread quotes @@ -1157,7 +1153,7 @@ qr = X
- + Quick Reply
@@ -1166,7 +1162,7 @@ qr = -
#{qr.spoiler}
+
#{qr.spoiler}
@@ -1174,12 +1170,20 @@ qr =
-
attach another file
+
attach another file
" qr.el = ui.dialog 'qr', 'top: 0; left: 0;', html + c = d.cookie + $('input[name=name]', qr.el).value = + if m = c.match(/4chan_name=([^;]+)/) then decodeURIComponent m[1] else '' + $('input[name=email]', qr.el).value = + if m = c.match(/4chan_email=([^;]+)/) then decodeURIComponent m[1] else '' + $('input[name=pwd]', qr.el).value = + if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value + $.on $('input[name=name]', qr.el), 'mousedown', (e) -> e.stopPropagation() $.on $('input[name=upfile]', qr.el), 'change', qr.validateFileSize $.on $('#close', qr.el), 'click', qr.close