Lazy init file input's FileReader
This commit is contained in:
parent
c8274d7bc7
commit
6fe262ceed
1 changed files with 1 additions and 1 deletions
|
@ -50,7 +50,6 @@ var Whisper = Whisper || {};
|
||||||
this.clearForm();
|
this.clearForm();
|
||||||
var files = this.$input.prop('files');
|
var files = this.$input.prop('files');
|
||||||
for (var i = 0; i < files.length; i++) {
|
for (var i = 0; i < files.length; i++) {
|
||||||
var FR = new FileReader();
|
|
||||||
var limitKb = 1000000;
|
var limitKb = 1000000;
|
||||||
switch (files[i].type.split('/')[0]) {
|
switch (files[i].type.split('/')[0]) {
|
||||||
case 'image': limitKb = 420; break;
|
case 'image': limitKb = 420; break;
|
||||||
|
@ -64,6 +63,7 @@ var Whisper = Whisper || {};
|
||||||
this.deleteFiles();
|
this.deleteFiles();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
var FR = new FileReader();
|
||||||
FR.onload = this.addThumb.bind(this);
|
FR.onload = this.addThumb.bind(this);
|
||||||
FR.readAsDataURL(files[i]);
|
FR.readAsDataURL(files[i]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue