Opera is getting better. Slowly.

This commit is contained in:
Nicolas Stepien 2012-12-19 13:54:37 +01:00
parent 1e88e5b08e
commit fe18eca332
2 changed files with 8 additions and 41 deletions

View File

@ -2070,27 +2070,7 @@
return QR.resetFileInput();
},
resetFileInput: function() {
var clone, input;
input = $('[type=file]', QR.el);
input.value = null;
if ($.engine !== 'presto') {
return;
}
clone = $.el('input', {
type: 'file',
accept: input.accept,
max: input.max,
multiple: input.multiple,
size: input.size,
title: input.title
});
$.on(clone, 'change', QR.fileInput);
$.on(clone, 'click', function(e) {
if (e.shiftKey) {
return QR.selected.rmFile() || e.preventDefault();
}
});
return $.replace(input, clone);
return $('[type=file]', QR.el).value = null;
},
replies: [],
reply: (function() {
@ -2150,10 +2130,10 @@
this.el.style.backgroundImage = null;
return;
}
url = window.URL || window.webkitURL;
if (typeof url.revokeObjectURL === "function") {
url.revokeObjectURL(this.url);
if (!(url = window.URL || window.webkitURL)) {
return;
}
url.revokeObjectURL(this.url);
fileUrl = url.createObjectURL(file);
img = $.el('img');
$.on(img, 'load', function() {

View File

@ -1623,20 +1623,7 @@ QR =
$.addClass QR.el, 'dump'
QR.resetFileInput() # reset input
resetFileInput: ->
input = $ '[type=file]', QR.el
input.value = null
return unless $.engine is 'presto'
# XXX Opera needs extra care to reset its file input's value
clone = $.el 'input',
type: 'file'
accept: input.accept
max: input.max
multiple: input.multiple
size: input.size
title: input.title
$.on clone, 'change', QR.fileInput
$.on clone, 'click', (e) -> if e.shiftKey then QR.selected.rmFile() or e.preventDefault()
$.replace input, clone
$('[type=file]', QR.el).value = null
replies: []
reply: class
@ -1680,9 +1667,9 @@ QR =
unless /^image/.test file.type
@el.style.backgroundImage = null
return
url = window.URL or window.webkitURL
# XXX Opera does not support window.URL.revokeObjectURL
url.revokeObjectURL? @url
# XXX Opera does not support window.URL
return unless url = window.URL or window.webkitURL
url.revokeObjectURL @url
# Create a redimensioned thumbnail.
fileUrl = url.createObjectURL file