From c26d4a123a5add6189de8d0fb1c1bdf2795f9a4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz=20=28arab=2C=20vx?= =?UTF-8?q?p=29?= Date: Thu, 25 Oct 2018 00:57:16 +0200 Subject: [PATCH] js/ext/dataUriToBlob.js: removed. index.html: updates script URIs. --- index.html | 1 - js/ext/dataUriToBlob.js | 58 ----------------------------------------- 2 files changed, 59 deletions(-) delete mode 100644 js/ext/dataUriToBlob.js diff --git a/index.html b/index.html index 9215c97..eff8f0e 100644 --- a/index.html +++ b/index.html @@ -126,7 +126,6 @@ // lex.opacity = 1 - diff --git a/js/ext/dataUriToBlob.js b/js/ext/dataUriToBlob.js deleted file mode 100644 index 80189b8..0000000 --- a/js/ext/dataUriToBlob.js +++ /dev/null @@ -1,58 +0,0 @@ -var dataUriToUint8Array = function(uri){ - var data = uri.split(',')[1]; - var bytes = atob(data); - var buf = new ArrayBuffer(bytes.length); - var u8 = new Uint8Array(buf); - for (var i = 0; i < bytes.length; i++) { - u8[i] = bytes.charCodeAt(i); - } - return u8 -} - -window.dataUriToBlob = (function(){ -/** - * Blob constructor. - */ - -var Blob = window.Blob; - -/** - * ArrayBufferView support. - */ - -var hasArrayBufferView = new Blob([new Uint8Array(100)]).size == 100; - -/** - * Return a `Blob` for the given data `uri`. - * - * @param {String} uri - * @return {Blob} - * @api public - */ - -var dataUriToBlob = function(uri){ - var data = uri.split(',')[1]; - var bytes = atob(data); - var buf = new ArrayBuffer(bytes.length); - var arr = new Uint8Array(buf); - for (var i = 0; i < bytes.length; i++) { - arr[i] = bytes.charCodeAt(i); - } - - if (!hasArrayBufferView) arr = buf; - var blob = new Blob([arr], { type: mime(uri) }); - blob.slice = blob.slice || blob.webkitSlice; - return blob; -}; - -/** - * Return data uri mime type. - */ - -function mime(uri) { - return uri.split(';')[0].slice(5); -} - -return dataUriToBlob; - -})()