blueimp-canvas-to-blob
Advanced tools
Comparing version 3.11.0 to 3.12.0
@@ -90,11 +90,17 @@ /* | ||
CanvasPrototype.toBlob = function (callback, type, quality) { | ||
if (quality && CanvasPrototype.toDataURL && dataURLtoBlob) { | ||
callback(dataURLtoBlob(this.toDataURL(type, quality))) | ||
} else { | ||
callback(this.mozGetAsFile('blob', type)) | ||
} | ||
var self = this | ||
setTimeout(function () { | ||
if (quality && CanvasPrototype.toDataURL && dataURLtoBlob) { | ||
callback(dataURLtoBlob(self.toDataURL(type, quality))) | ||
} else { | ||
callback(self.mozGetAsFile('blob', type)) | ||
} | ||
}) | ||
} | ||
} else if (CanvasPrototype.toDataURL && dataURLtoBlob) { | ||
CanvasPrototype.toBlob = function (callback, type, quality) { | ||
callback(dataURLtoBlob(this.toDataURL(type, quality))) | ||
var self = this | ||
setTimeout(function () { | ||
callback(dataURLtoBlob(self.toDataURL(type, quality))) | ||
}) | ||
} | ||
@@ -101,0 +107,0 @@ } |
@@ -1,2 +0,2 @@ | ||
!function(t){"use strict";var e=t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype,o=t.Blob&&function(){try{return Boolean(new Blob)}catch(t){return!1}}(),n=o&&t.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(t){return!1}}(),r=t.BlobBuilder||t.WebKitBlobBuilder||t.MozBlobBuilder||t.MSBlobBuilder,a=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,i=(o||r)&&t.atob&&t.ArrayBuffer&&t.Uint8Array&&function(t){var e,i,l,u,b,c,d,B,f;if(e=t.match(a),!e)throw new Error("invalid data URI");for(i=e[2]?e[1]:"text/plain"+(e[3]||";charset=US-ASCII"),l=!!e[4],u=t.slice(e[0].length),b=l?atob(u):decodeURIComponent(u),c=new ArrayBuffer(b.length),d=new Uint8Array(c),B=0;B<b.length;B+=1)d[B]=b.charCodeAt(B);return o?new Blob([n?d:c],{type:i}):(f=new r,f.append(c),f.getBlob(i))};t.HTMLCanvasElement&&!e.toBlob&&(e.mozGetAsFile?e.toBlob=function(t,o,n){t(n&&e.toDataURL&&i?i(this.toDataURL(o,n)):this.mozGetAsFile("blob",o))}:e.toDataURL&&i&&(e.toBlob=function(t,e,o){t(i(this.toDataURL(e,o)))})),"function"==typeof define&&define.amd?define(function(){return i}):"object"==typeof module&&module.exports?module.exports=i:t.dataURLtoBlob=i}(window); | ||
!function(t){"use strict";var e=t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype,o=t.Blob&&function(){try{return Boolean(new Blob)}catch(t){return!1}}(),n=o&&t.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(t){return!1}}(),r=t.BlobBuilder||t.WebKitBlobBuilder||t.MozBlobBuilder||t.MSBlobBuilder,a=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,i=(o||r)&&t.atob&&t.ArrayBuffer&&t.Uint8Array&&function(t){var e,i,l,u,c,f,b,d,B;if(!(e=t.match(a)))throw new Error("invalid data URI");for(i=e[2]?e[1]:"text/plain"+(e[3]||";charset=US-ASCII"),l=!!e[4],u=t.slice(e[0].length),c=l?atob(u):decodeURIComponent(u),f=new ArrayBuffer(c.length),b=new Uint8Array(f),d=0;d<c.length;d+=1)b[d]=c.charCodeAt(d);return o?new Blob([n?b:f],{type:i}):((B=new r).append(f),B.getBlob(i))};t.HTMLCanvasElement&&!e.toBlob&&(e.mozGetAsFile?e.toBlob=function(t,o,n){var r=this;setTimeout(function(){t(n&&e.toDataURL&&i?i(r.toDataURL(o,n)):r.mozGetAsFile("blob",o))})}:e.toDataURL&&i&&(e.toBlob=function(t,e,o){var n=this;setTimeout(function(){t(i(n.toDataURL(e,o)))})})),"function"==typeof define&&define.amd?define(function(){return i}):"object"==typeof module&&module.exports?module.exports=i:t.dataURLtoBlob=i}(window); | ||
//# sourceMappingURL=canvas-to-blob.min.js.map |
{ | ||
"name": "blueimp-canvas-to-blob", | ||
"version": "3.11.0", | ||
"version": "3.12.0", | ||
"title": "JavaScript Canvas to Blob", | ||
@@ -25,12 +25,21 @@ "description": "Canvas to Blob is a polyfill for the standard JavaScript canvas.toBlob method. It can be used to create Blob objects from an HTML canvas element.", | ||
"devDependencies": { | ||
"phantomjs-prebuilt": "2.1.13", | ||
"mocha-phantomjs-core": "1.3.1", | ||
"standard": "8.3.0", | ||
"uglify-js": "2.7.3" | ||
"concurrently": "^3.5.0", | ||
"eslint": "^4.5.0", | ||
"eslint-config-standard": "^10.2.1", | ||
"eslint-plugin-import": "^2.7.0", | ||
"eslint-plugin-node": "^5.1.1", | ||
"eslint-plugin-promise": "^3.5.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"get-port-cli": "^1.1.0", | ||
"http-server": "^0.10.0", | ||
"mocha-chrome": "^0.1.1", | ||
"uglify-js": "^3.0.28" | ||
}, | ||
"scripts": { | ||
"lint": "standard js/*.js test/*.js", | ||
"unit": "phantomjs node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html", | ||
"lint": "eslint .", | ||
"serve": "http-server . -a 127.0.0.1 -p $PORT -s", | ||
"mocha": "mocha-chrome http://127.0.0.1:$PORT/test", | ||
"unit": "PORT=$(get-port) concurrently -k 'npm run serve' 'npm run mocha'", | ||
"test": "npm run lint && npm run unit", | ||
"build": "cd js && uglifyjs canvas-to-blob.js -c -m -o canvas-to-blob.min.js --source-map canvas-to-blob.min.js.map", | ||
"build": "cd js && uglifyjs canvas-to-blob.js -c -m -o canvas-to-blob.min.js --source-map url=canvas-to-blob.min.js.map", | ||
"preversion": "npm test", | ||
@@ -37,0 +46,0 @@ "version": "npm run build && git add -A js", |
Sorry, the diff of this file is not supported yet
12868
119
11