Use objectURLs instead of massively memory consuming dataURL strings.
This commit is contained in:
parent
771964993a
commit
d78381759b
@ -1331,19 +1331,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
_Class.prototype.setFile = function(file) {
|
_Class.prototype.setFile = function(file) {
|
||||||
var reader,
|
var url;
|
||||||
_this = this;
|
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.el.title = file.name;
|
this.el.title = file.name;
|
||||||
if (file.type === 'application/pdf') {
|
if (file.type === 'application/pdf') {
|
||||||
this.el.style.backgroundImage = null;
|
this.el.style.backgroundImage = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
reader = new FileReader();
|
url = window.URL || window.webkitURL;
|
||||||
reader.onload = function() {
|
url.revokeObjectURL(this.url);
|
||||||
return _this.el.style.backgroundImage = "url(" + reader.result + ")";
|
this.url = url.createObjectURL(file);
|
||||||
};
|
return this.el.style.backgroundImage = "url(" + this.url + ")";
|
||||||
return reader.readAsDataURL(file);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_Class.prototype.select = function() {
|
_Class.prototype.select = function() {
|
||||||
@ -1360,7 +1358,11 @@
|
|||||||
return _results;
|
return _results;
|
||||||
};
|
};
|
||||||
|
|
||||||
_Class.prototype.rm = function() {};
|
_Class.prototype.rm = function() {
|
||||||
|
var url;
|
||||||
|
url = window.URL || window.webkitURL;
|
||||||
|
return url.revokeObjectURL(this.url);
|
||||||
|
};
|
||||||
|
|
||||||
return _Class;
|
return _Class;
|
||||||
|
|
||||||
|
|||||||
@ -1001,9 +1001,10 @@ qr =
|
|||||||
if file.type is 'application/pdf'
|
if file.type is 'application/pdf'
|
||||||
@el.style.backgroundImage = null
|
@el.style.backgroundImage = null
|
||||||
return
|
return
|
||||||
reader = new FileReader()
|
url = window.URL or window.webkitURL
|
||||||
reader.onload = => @el.style.backgroundImage = "url(#{reader.result})"
|
url.revokeObjectURL @url
|
||||||
reader.readAsDataURL file
|
@url = url.createObjectURL file
|
||||||
|
@el.style.backgroundImage = "url(#{@url})"
|
||||||
select: ->
|
select: ->
|
||||||
qr.selected?.el.id = null
|
qr.selected?.el.id = null
|
||||||
qr.selected = @
|
qr.selected = @
|
||||||
@ -1012,6 +1013,8 @@ qr =
|
|||||||
$("[name=#{data}]", qr.el).value = @[data]
|
$("[name=#{data}]", qr.el).value = @[data]
|
||||||
rm: ->
|
rm: ->
|
||||||
# rm reply from qr.replies and the UI
|
# rm reply from qr.replies and the UI
|
||||||
|
url = window.URL or window.webkitURL
|
||||||
|
url.revokeObjectURL @url
|
||||||
|
|
||||||
|
|
||||||
dialog: ->
|
dialog: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user