max file size

This commit is contained in:
James Campos 2011-09-03 15:07:15 -07:00
parent d60d214f1b
commit ee040e52ad
2 changed files with 15 additions and 4 deletions

View File

@ -1255,6 +1255,7 @@
}
});
QR.accept = "'" + accept + "'";
QR.MAX_FILE_SIZE = $('input[name=MAX_FILE_SIZE]').value;
QR.spoiler = $('.postarea label') ? ' <label>[<input type=checkbox name=spoiler>Spoiler Image?]</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);

View File

@ -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 ' <label>[<input type=checkbox name=spoiler>Spoiler Image?]</label>' 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