diff --git a/4chan_x.js b/4chan_x.js
index d20a665dc..e1150692f 100644
--- a/4chan_x.js
+++ b/4chan_x.js
@@ -85,7 +85,7 @@
'Sauce': [true, 'Add sauce to images']
},
post: {
- 'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'],
+ 'Cooldown': [true, 'Prevent \'flood detected\' errors'],
'Quick Reply': [true, 'Reply without leaving the page'],
'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.']
},
@@ -1129,32 +1129,34 @@
},
cooldownCB: function() {
var submit, submits, _i, _len;
- qr.duration = qr.duration - 1;
+ qr.duration--;
submits = $$('#com_submit');
for (_i = 0, _len = submits.length; _i < _len; _i++) {
submit = submits[_i];
- if (qr.duration === 0) {
+ if (qr.duration) {
+ submit.value = qr.duration;
+ } else {
submit.disabled = false;
submit.value = 'Submit';
- } else {
- submit.value = qr.duration;
}
}
- if (qr.duration === 0) {
- return clearInterval(qr.cooldownIntervalID);
+ if (!qr.duration) {
+ return window.clearInterval(qr.cooldownIntervalID);
}
},
dialog: function(link) {
- var MAX_FILE_SIZE, THREAD_ID, c, challenge, dialog, html, m, mail, name, pass, spoiler, src;
+ var MAX_FILE_SIZE, THREAD_ID, c, challenge, dialog, html, m, mail, name, pass, spoiler, src, submitDisabled, submitValue;
MAX_FILE_SIZE = $('input[name="MAX_FILE_SIZE"]').value;
+ submitValue = $('#com_submit').value;
+ submitDisabled = $('#com_submit').disabled ? 'disabled' : '';
THREAD_ID = g.THREAD_ID || $.x('ancestor::div[@class="thread"]/div', link).id;
challenge = $('input[name=recaptcha_challenge_field]').value;
src = "http://www.google.com/recaptcha/api/image?c=" + challenge;
c = d.cookie;
- name = (m = c.match(/4chan_name=([^;]+)/)) ? unescape(m[1]) : '';
- mail = (m = c.match(/4chan_email=([^;]+)/)) ? unescape(m[1]) : '';
- pass = (m = c.match(/4chan_pass=([^;]+)/)) ? unescape(m[1]) : $('input[name=pwd]').value;
- html = "
";
+ name = (m = c.match(/4chan_name=([^;]+)/)) ? decodeURIComponent(m[1]) : '';
+ mail = (m = c.match(/4chan_email=([^;]+)/)) ? decodeURIComponent(m[1]) : '';
+ pass = (m = c.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value;
+ html = " ";
dialog = ui.dialog('qr', {
top: '0px',
left: '0px'
@@ -1405,7 +1407,7 @@
count.textContent = 404;
count.className = 'error';
timer.textContent = '';
- clearInterval(updater.intervalID);
+ window.clearInterval(updater.intervalID);
_ref = $$('input[type=submit]');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
input = _ref[_i];
diff --git a/script.coffee b/script.coffee
index 26b70e8cb..aefc659e8 100644
--- a/script.coffee
+++ b/script.coffee
@@ -26,7 +26,7 @@ config =
'Image Preloading': [false, 'Preload Images']
'Sauce': [true, 'Add sauce to images']
post:
- 'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)']
+ 'Cooldown': [true, 'Prevent \'flood detected\' errors']
'Quick Reply': [true, 'Reply without leaving the page']
'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.']
quote:
@@ -887,33 +887,35 @@ qr =
qr.duration = duration
cooldownCB: ->
- qr.duration = qr.duration - 1
+ qr.duration--
submits = $$ '#com_submit'
for submit in submits
- if qr.duration == 0
+ if qr.duration
+ submit.value = qr.duration
+ else
submit.disabled = false
submit.value = 'Submit'
- else
- submit.value = qr.duration
- if qr.duration == 0
- clearInterval qr.cooldownIntervalID
+ window.clearInterval qr.cooldownIntervalID unless qr.duration
+
dialog: (link) ->
#maybe should be global
MAX_FILE_SIZE = $('input[name="MAX_FILE_SIZE"]').value
+ submitValue = $('#com_submit').value
+ submitDisabled = if $('#com_submit').disabled then 'disabled' else ''
#FIXME inlined cross-thread quotes
THREAD_ID = g.THREAD_ID or $.x('ancestor::div[@class="thread"]/div', link).id
challenge = $('input[name=recaptcha_challenge_field]').value
src = "http://www.google.com/recaptcha/api/image?c=#{challenge}"
c = d.cookie
- name = if m = c.match(/4chan_name=([^;]+)/) then unescape m[1] else ''
- mail = if m = c.match(/4chan_email=([^;]+)/) then unescape m[1] else ''
- pass = if m = c.match(/4chan_pass=([^;]+)/) then unescape m[1] else $('input[name=pwd]').value
+ name = if m = c.match(/4chan_name=([^;]+)/) then decodeURIComponent m[1] else ''
+ mail = if m = c.match(/4chan_email=([^;]+)/) then decodeURIComponent m[1] else ''
+ pass = if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value
html = "