Permalink
Browse files

Refactor last merge with a fix for Opera 12.

Update demo page to fix drag&drop for Opera 12.
  • Loading branch information...
1 parent 9f2ef8d commit 3202fb470d88f4e67be317fb52edecfe339e95f2 @blueimp committed Jun 18, 2012
Showing with 14 additions and 12 deletions.
  1. +2 −2 index.html
  2. +10 −8 load-image.js
  3. +1 −1 load-image.min.js
  4. +1 −1 package.json
View
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<!--
/*
- * JavaScript Load Image Demo 1.0
+ * JavaScript Load Image Demo 1.0.1
* https://github.com/blueimp/JavaScript-Load-Image
*
* Copyright 2011, Sebastian Tschan
@@ -95,7 +95,7 @@
.on('dragover', function (e) {
e = e.originalEvent;
e.preventDefault();
- e.dataTransfer.dropEffect = e.dataTransfer.effectAllowed = 'copy';
+ e.dataTransfer.dropEffect = 'copy';
})
.on('drop', load);
$('#file-input').on('change', load);
View
@@ -1,5 +1,5 @@
/*
- * JavaScript Load Image 1.1.6
+ * JavaScript Load Image 1.1.7
* https://github.com/blueimp/JavaScript-Load-Image
*
* Copyright 2011, Sebastian Tschan
@@ -37,17 +37,19 @@
} else {
url = file;
}
- if (url && !(window.File && url instanceof File)) {
+ if (url) {
img.src = url;
return img;
- } else {
- return loadImage.readFile(file, function (url) {
- img.src = url;
- });
}
+ return loadImage.readFile(file, function (url) {
+ img.src = url;
+ });
},
+ // The check for URL.revokeObjectURL fixes an issue with Opera 12,
+ // which provides URL.createObjectURL but doesn't properly implement it:
urlAPI = (window.createObjectURL && window) ||
- (window.URL && URL) || (window.webkitURL && webkitURL);
+ (window.URL && URL.revokeObjectURL && URL) ||
+ (window.webkitURL && webkitURL);
// Scales the given image (img or canvas HTML element)
// using the given options.
@@ -92,7 +94,7 @@
};
loadImage.revokeObjectURL = function (url) {
- return urlAPI && typeof urlAPI.revokeObjectURL !== 'undefined' ? urlAPI.revokeObjectURL(url) : false;
+ return urlAPI ? urlAPI.revokeObjectURL(url) : false;
};
// Loads a given File object via FileReader interface,
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,6 +1,6 @@
{
"name": "blueimp-load-image",
- "version": "1.1.4",
+ "version": "1.1.7",
"title": "JavaScript Load Image",
"description": "JavaScript Load Image is a function to load images provided as File or Blob objects or via URL. It returns an optionally scaled HTML img or canvas element.",
"keywords": [

0 comments on commit 3202fb4

Please sign in to comment.