Skip to content

Commit

Permalink
Use Blob.js when not available (as a temporary fix for iOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
lacek committed Apr 22, 2014
1 parent e3c52a9 commit e9960aa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ <h2>Text to Image</h2>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.11.0.min.js"><\/script>')</script>
<script src="js/vendor/bootstrap.min.js"></script>
<script src="js/vendor/Blob.js"></script>
<script src="js/vendor/canvas-toBlob.js"></script>
<script src="js/vendor/FileSaver.js"></script>
<script src="js/main.js"></script>
Expand Down
8 changes: 8 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,14 @@ function saveImage() {
function escapeRegExp(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}

var isBlobSupported = false;
try {
isBlobSupported = !!new Blob();
} catch(e) {}
if (!isBlobSupported) {
document.write('<script src="js/vendor/Blob.js"><\/script>')
}

$(document.body).ready(function() {
loadConfig(loadImage);
Expand Down

0 comments on commit e9960aa

Please sign in to comment.