From d12c78ea39e1dd93998da2964e8449b4b1c752f7 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 19 May 2012 14:01:53 +0200 Subject: [PATCH] Don't submit a new thread without a selected file. Fix #485. --- 4chan_x.user.js | 4 ++-- script.coffee | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 4bea065cd..a30aab865 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1951,7 +1951,8 @@ } QR.abort(); reply = QR.replies[0]; - if (!(reply.com || reply.file)) { + threadID = g.THREAD_ID || $('select', QR.el).value; + if (!(threadID === 'new' && reply.file || threadID !== 'new' && (reply.com || reply.file))) { err = 'No file selected.'; } else { captchas = $.get('captchas', []); @@ -1980,7 +1981,6 @@ return; } QR.cleanError(); - threadID = g.THREAD_ID || $('select', QR.el).value; QR.cooldown.auto = QR.replies.length > 1; if (Conf['Auto Hide QR'] && !QR.cooldown.auto) { QR.hide(); diff --git a/script.coffee b/script.coffee index 986fb047b..c6e4872a1 100644 --- a/script.coffee +++ b/script.coffee @@ -1471,8 +1471,10 @@ QR = QR.abort() reply = QR.replies[0] + threadID = g.THREAD_ID or $('select', QR.el).value + # prevent errors - unless reply.com or reply.file + unless threadID is 'new' and reply.file or threadID isnt 'new' and (reply.com or reply.file) err = 'No file selected.' else # get oldest valid captcha @@ -1499,8 +1501,6 @@ QR = return QR.cleanError() - threadID = g.THREAD_ID or $('select', QR.el).value - # Enable auto-posting if we have stuff to post, disable it otherwise. QR.cooldown.auto = QR.replies.length > 1 if Conf['Auto Hide QR'] and not QR.cooldown.auto