Use form.reset().

This commit is contained in:
Nicolas Stepien 2011-07-20 02:47:14 +02:00
parent 7a4a238c0c
commit 23edff7283
2 changed files with 12 additions and 16 deletions

View File

@ -1348,14 +1348,12 @@
return ta.value += text; return ta.value += text;
}, },
refresh: function(dialog) { refresh: function(dialog) {
var f, _ref; var c, m;
$('textarea', dialog).value = ''; $('form', dialog).reset();
$('input[name=recaptcha_response_field]', dialog).value = ''; c = d.cookie;
if ((_ref = $('input[name=spoiler]', dialog)) != null) { $('input[name=name]', dialog).value = (m = c.match(/4chan_name=([^;]+)/)) ? decodeURIComponent(m[1]) : '';
_ref.checked = false; $('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;
f = $('input[type=file]', dialog).parentNode;
return f.innerHTML = f.innerHTML;
}, },
dialog: function(link) { dialog: function(link) {
var THREAD_ID, c, challenge, dialog, html, m, mail, name, pass, spoiler, src, submitDisabled, submitValue; var THREAD_ID, c, challenge, dialog, html, m, mail, name, pass, spoiler, src, submitDisabled, submitValue;

View File

@ -103,8 +103,7 @@ if not Object.keys
NAMESPACE = 'AEOS.4chan_x.' NAMESPACE = 'AEOS.4chan_x.'
d = document d = document
g = g = callbacks: []
callbacks: []
ui = ui =
dialog: (id, position, html) -> dialog: (id, position, html) ->
@ -1064,12 +1063,11 @@ qr =
ta.value += text ta.value += text
refresh: (dialog) -> refresh: (dialog) ->
$('textarea', dialog).value = '' $('form', dialog).reset()
$('input[name=recaptcha_response_field]', dialog).value = '' c = d.cookie
$('input[name=spoiler]', dialog)?.checked = false $('input[name=name]', dialog).value = if m = c.match(/4chan_name=([^;]+)/) then decodeURIComponent m[1] else ''
# XXX file.value = '' doesn't work in opera $('input[name=email]', dialog).value = if m = c.match(/4chan_email=([^;]+)/) then decodeURIComponent m[1] else ''
f = $('input[type=file]', dialog).parentNode $('input[name=pwd]', dialog).value = if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value
f.innerHTML = f.innerHTML
dialog: (link) -> dialog: (link) ->
submitValue = $('#com_submit').value submitValue = $('#com_submit').value