diff --git a/4chan_x.user.js b/4chan_x.user.js index e11600b89..8b834dc64 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1348,14 +1348,12 @@ return ta.value += text; }, refresh: function(dialog) { - var f, _ref; - $('textarea', dialog).value = ''; - $('input[name=recaptcha_response_field]', dialog).value = ''; - if ((_ref = $('input[name=spoiler]', dialog)) != null) { - _ref.checked = false; - } - f = $('input[type=file]', dialog).parentNode; - return f.innerHTML = f.innerHTML; + var c, m; + $('form', dialog).reset(); + c = d.cookie; + $('input[name=name]', dialog).value = (m = c.match(/4chan_name=([^;]+)/)) ? decodeURIComponent(m[1]) : ''; + $('input[name=email]', dialog).value = (m = c.match(/4chan_email=([^;]+)/)) ? decodeURIComponent(m[1]) : ''; + return $('input[name=pwd]', dialog).value = (m = c.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value; }, dialog: function(link) { var THREAD_ID, c, challenge, dialog, html, m, mail, name, pass, spoiler, src, submitDisabled, submitValue; diff --git a/script.coffee b/script.coffee index 12d39e15b..a362492cf 100644 --- a/script.coffee +++ b/script.coffee @@ -103,8 +103,7 @@ if not Object.keys NAMESPACE = 'AEOS.4chan_x.' d = document -g = - callbacks: [] +g = callbacks: [] ui = dialog: (id, position, html) -> @@ -1064,12 +1063,11 @@ qr = ta.value += text refresh: (dialog) -> - $('textarea', dialog).value = '' - $('input[name=recaptcha_response_field]', dialog).value = '' - $('input[name=spoiler]', dialog)?.checked = false - # XXX file.value = '' doesn't work in opera - f = $('input[type=file]', dialog).parentNode - f.innerHTML = f.innerHTML + $('form', dialog).reset() + c = d.cookie + $('input[name=name]', dialog).value = if m = c.match(/4chan_name=([^;]+)/) then decodeURIComponent m[1] else '' + $('input[name=email]', dialog).value = if m = c.match(/4chan_email=([^;]+)/) then decodeURIComponent m[1] else '' + $('input[name=pwd]', dialog).value = if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value dialog: (link) -> submitValue = $('#com_submit').value