diff --git a/4chan_x.user.js b/4chan_x.user.js index 11209e783..af9f135f2 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1383,9 +1383,6 @@ ta.setSelectionRange(l, l); return ta.focus(); }, - hasContent: function() { - return $('textarea', QR.qr).value || $('[type=file]', QR.qr).files.length; - }, keydown: function(e) { if (!(e.keyCode === 13 && this.value)) { return; @@ -1448,7 +1445,7 @@ }, submit: function(e) { var captcha, challenge, el, qr, response; - if (!QR.hasContent()) { + if (!($('textarea', QR.qr).value || $('[type=file]', QR.qr).files.length)) { if (e) { alert('Error: No text entered.'); } diff --git a/script.coffee b/script.coffee index ab379d067..6a775ec7d 100644 --- a/script.coffee +++ b/script.coffee @@ -1089,8 +1089,6 @@ QR = l = text.length ta.setSelectionRange l, l ta.focus() - hasContent: -> - $('textarea', QR.qr).value or $('[type=file]', QR.qr).files.length keydown: (e) -> return unless e.keyCode is 13 and @value #enter, captcha filled QR.captchaPush @ @@ -1135,8 +1133,8 @@ QR = QR.attachNext() submit: (e) -> #XXX e is undefined if method is called explicitly, eg, from auto posting - unless QR.hasContent() - alert 'Error: No text entered.' if e #don't alert at the end of auto posting + unless $('textarea', QR.qr).value or $('[type=file]', QR.qr).files.length + alert 'Error: No text entered.' if e #only alert if explicitly submitting return {qr} = QR $('.error', qr).textContent = ''