Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

prevent js error on non FileReader browsers. for fun. h

  • Loading branch information...
commit 49ae5b014ac80a3a4281af50fcceb1925cd204ef 1 parent 6b77cd4
@paulirish paulirish authored
Showing with 19 additions and 15 deletions.
  1. +19 −15 assets/js/scripts.js
View
34 assets/js/scripts.js
@@ -107,18 +107,7 @@
setupDrag();
-
- // Bail out if the browser doesn't support required features
- // blobbuilder and a[download] are not required, as there is a fallback
- var support = FileReaderJS.enabled && Modernizr.draganddrop &&
- document.querySelector && Modernizr.postmessage && window.JSON;
- if (!support) {
- body.addClass("disabled");
- var caniscript = document.createElement('script');
- caniscript.src = 'http://sandbox.thewikies.com/caniuse/json+filereader+draganddrop+querySelector+postmessage.html?callback=canicallback';
- document.body.appendChild(caniscript);
- }
-
+
// drag and drop setup.
var opts = {
accept: 'image/*',
@@ -162,9 +151,24 @@
}
};
- // the library handles most of the dnd bits.
- FileReaderJS.setupDrop(document.body, opts);
- FileReaderJS.setupClipboard(document.body, opts);
+
+ // Bail out if the browser doesn't support required features
+ // blobbuilder and a[download] are not required, as there is a fallback
+ var support = FileReaderJS.enabled && Modernizr.draganddrop &&
+ document.querySelector && Modernizr.postmessage && window.JSON;
+ if (!support) {
+ body.addClass("disabled");
+ var caniscript = document.createElement('script');
+ caniscript.src = 'http://sandbox.thewikies.com/caniuse/json+filereader+draganddrop+querySelector+postmessage.html?callback=canicallback';
+ document.body.appendChild(caniscript);
+
+ } else {
+
+ // the library handles most of the dnd bits.
+ FileReaderJS.setupDrop(document.body, opts);
+ FileReaderJS.setupClipboard(document.body, opts);
+
+ }
$(document).on('click', '.rotateimg', function(e) {
var currentRotation = parseInt($(e.currentTarget).attr('data-rotation')) + 90;
Please sign in to comment.
Something went wrong with that request. Please try again.