diff --git a/4chan_x.user.js b/4chan_x.user.js
index 3c0218017..b7ec7269d 100644
--- a/4chan_x.user.js
+++ b/4chan_x.user.js
@@ -1255,6 +1255,7 @@
}
});
QR.accept = "'" + accept + "'";
+ QR.MAX_FILE_SIZE = $('input[name=MAX_FILE_SIZE]').value;
QR.spoiler = $('.postarea label') ? ' ' : '';
if (conf['Persistent QR']) {
QR.dialog();
@@ -1332,8 +1333,13 @@
return captcha;
},
change: function() {
- $.unbind(this, 'change', QR.change);
- return QR.attach();
+ if (this.files[0].size > QR.MAX_FILE_SIZE) {
+ alert('Error: File too large.');
+ return this.click();
+ } else {
+ $.unbind(this, 'change', QR.change);
+ return QR.attach();
+ }
},
close: function() {
$.rm(QR.qr);
diff --git a/script.coffee b/script.coffee
index d95bb2357..48785a622 100644
--- a/script.coffee
+++ b/script.coffee
@@ -987,6 +987,7 @@ QR =
else
'image/' + type
QR.accept = "'#{accept}'"
+ QR.MAX_FILE_SIZE = $('input[name=MAX_FILE_SIZE]').value
QR.spoiler = if $('.postarea label') then ' ' else ''
if conf['Persistent QR']
QR.dialog()
@@ -1040,8 +1041,12 @@ QR =
$('#cl', QR.qr).textContent = captchas.length + ' captchas'
captcha
change: ->
- $.unbind @, 'change', QR.change
- QR.attach()
+ if @files[0].size > QR.MAX_FILE_SIZE
+ alert 'Error: File too large.'
+ @.click()
+ else
+ $.unbind @, 'change', QR.change
+ QR.attach()
close: ->
$.rm QR.qr
QR.qr = null