diff --git a/4chan_x.user.js b/4chan_x.user.js index 134dfcb87..d181dd1b9 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1327,15 +1327,12 @@ return captcha; }, change: function(e) { - var a, p; if (this.files[0].size > QR.MAX_FILE_SIZE) { alert('Error: File too large.'); QR.resetFile(this); return $('[type=file]', QR.qr).click(); } else { - p = this.parentNode; - a = p.parentNode; - if (a.id === 'files' && !p.nextSibling) { + if (this === $('#files div:last-of-type input', QR.qr)) { return QR.attach(); } } diff --git a/script.coffee b/script.coffee index 3238f9372..495774333 100644 --- a/script.coffee +++ b/script.coffee @@ -1042,9 +1042,7 @@ QR = QR.resetFile @ $('[type=file]', QR.qr).click() else - p = @parentNode - a = p.parentNode - if a.id is 'files' and not p.nextSibling + if @ is $('#files div:last-of-type input', QR.qr) QR.attach() close: -> $.rm QR.qr