From fbdc956a9f2d189896a20ff225e092d8cec0a900 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 23 Aug 2011 06:14:29 +0200 Subject: [PATCH] Bring back auto post. Close #231 --- 4chan_x.user.js | 10 ++++++---- script.coffee | 7 ++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 65fb0f7b4..200fdf542 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1216,7 +1216,7 @@ submit.disabled = false; submit.value = 'Submit'; } - if (!qr.postInvalid()) { + if (qr.el && $('#auto', qr.el).checked || !qr.postInvalid()) { return qr.submit.call($('form', qr.el)); } } @@ -1296,7 +1296,7 @@ THREAD_ID = g.THREAD_ID || $.x('ancestor::div[@class="thread"]/div', link).id; spoiler = $('.postarea label') ? '' : ''; challenge = $('#recaptcha_challenge_field').value; - html = " X
Quick Reply
" + spoiler + "
" + ($.get('captchas', []).length) + " captchas
attach another file
"; + html = " X
Quick Reply
" + spoiler + "
" + ($.get('captchas', []).length) + " captchas
attach another file
"; qr.el = ui.dialog('qr', { top: '0px', left: '0px' @@ -1875,9 +1875,11 @@ return watcher.refresh(); }, watch: function(thread, id) { - var el, watched, _name; + var el, props, watched, _name; el = $('span.filetitle', thread); - props.href = "/" + g.BOARD + "/res/" + id; + props = { + href: "/" + g.BOARD + "/res/" + id + }; if (!el.textContent) { el = $('blockquote', thread); if (el.textContent) { diff --git a/script.coffee b/script.coffee index 48423580b..800940f57 100644 --- a/script.coffee +++ b/script.coffee @@ -958,7 +958,7 @@ cooldown = for submit in submits submit.disabled = false submit.value = 'Submit' - unless qr.postInvalid() + if qr.el and $('#auto', qr.el).checked or not qr.postInvalid() qr.submit.call $ 'form', qr.el qr = @@ -1042,7 +1042,7 @@ qr =
#{spoiler}
-
+
#{$.get('captchas', []).length} captchas
@@ -1539,7 +1539,8 @@ watcher = watch: (thread, id) -> el = $ 'span.filetitle', thread - props.href = "/#{g.BOARD}/res/#{id}" + props = + href: "/#{g.BOARD}/res/#{id}" if not el.textContent el = $ 'blockquote', thread if el.textContent