upgrade app

This commit is contained in:
Xes
2025-08-14 22:33:03 +02:00
parent d862a535e5
commit 2fe1c43b3e
39284 changed files with 991979 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
{
"name": "blueimp-canvas-to-blob",
"homepage": "https://github.com/blueimp/JavaScript-Canvas-to-Blob",
"version": "3.27.0",
"_release": "3.27.0",
"_resolution": {
"type": "version",
"tag": "v3.27.0",
"commit": "6ebdd94912328c934dfc822289ca7f1f1e8f5822"
},
"_source": "https://github.com/blueimp/JavaScript-Canvas-to-Blob.git",
"_target": ">=2.1.1",
"_originalSource": "blueimp-canvas-to-blob"
}

View File

@@ -0,0 +1 @@
github: [blueimp]

View File

@@ -0,0 +1,34 @@
name: Test
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: npm install
run: npm install
env:
CI: true
- name: lint
run: npm run lint
env:
CI: true
unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: mocha
run: docker-compose run --rm mocha
- name: docker-compose logs
if: always()
run: docker-compose logs nginx
- name: docker-compose down
if: always()
run: docker-compose down -v

View File

@@ -0,0 +1 @@
node_modules

View File

@@ -0,0 +1,20 @@
MIT License
Copyright © 2012 Sebastian Tschan, https://blueimp.net
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,135 @@
# JavaScript Canvas to Blob
## Contents
- [Description](#description)
- [Setup](#setup)
- [Usage](#usage)
- [Requirements](#requirements)
- [Browsers](#browsers)
- [API](#api)
- [Test](#test)
- [License](#license)
## Description
Canvas to Blob is a
[polyfill](https://developer.mozilla.org/en-US/docs/Glossary/Polyfill) for
Browsers that don't support the standard JavaScript
[HTMLCanvasElement.toBlob](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob)
method.
It can be used to create
[Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) objects from an
HTML [canvas](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas)
element.
## Setup
Install via [NPM](https://www.npmjs.com/package/blueimp-canvas-to-blob):
```sh
npm install blueimp-canvas-to-blob
```
This will install the JavaScript files inside
`./node_modules/blueimp-canvas-to-blob/js/` relative to your current directory,
from where you can copy them into a folder that is served by your web server.
Next include the minified JavaScript Canvas to Blob script in your HTML markup:
```html
<script src="js/canvas-to-blob.min.js"></script>
```
Or alternatively, include the non-minified version:
```html
<script src="js/canvas-to-blob.js"></script>
```
## Usage
You can use the `canvas.toBlob()` method in the same way as the native
implementation:
```js
var canvas = document.createElement('canvas')
// Edit the canvas ...
if (canvas.toBlob) {
canvas.toBlob(function (blob) {
// Do something with the blob object,
// e.g. create multipart form data for file uploads:
var formData = new FormData()
formData.append('file', blob, 'image.jpg')
// ...
}, 'image/jpeg')
}
```
## Requirements
The JavaScript Canvas to Blob function has zero dependencies.
However, it is a very suitable complement to the
[JavaScript Load Image](https://github.com/blueimp/JavaScript-Load-Image)
function.
## Browsers
The following browsers have native support for
[HTMLCanvasElement.toBlob](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob):
- Chrome 50+
- Firefox 19+
- Safari 11+
- Mobile Chrome 50+ (Android)
- Mobile Firefox 4+ (Android)
- Mobile Safari 11+ (iOS)
- Edge 79+
Browsers which implement the following APIs support `canvas.toBlob()` via
polyfill:
- [HTMLCanvasElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement)
- [HTMLCanvasElement.toDataURL](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)
- [Blob() constructor](https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob)
- [atob](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/atob)
- [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)
- [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)
This includes the following browsers:
- Chrome 20+
- Firefox 13+
- Safari 8+
- Mobile Chrome 25+ (Android)
- Mobile Firefox 14+ (Android)
- Mobile Safari 8+ (iOS)
- Edge 74+
- Edge Legacy 12+
- Internet Explorer 10+
## API
In addition to the `canvas.toBlob()` polyfill, the JavaScript Canvas to Blob
script exposes its helper function `dataURLtoBlob(url)`:
```js
// Uncomment the following line when using a module loader like webpack:
// var dataURLtoBlob = require('blueimp-canvas-to-blob')
// black+white 3x2 GIF, base64 data:
var b64 = 'R0lGODdhAwACAPEAAAAAAP///yZFySZFySH5BAEAAAIALAAAAAADAAIAAAIDRAJZADs='
var url = 'data:image/gif;base64,' + b64
var blob = dataURLtoBlob(url)
```
## Test
[Unit tests](https://blueimp.github.io/JavaScript-Canvas-to-Blob/test/)
## License
The JavaScript Canvas to Blob script is released under the
[MIT license](https://opensource.org/licenses/MIT).

View File

@@ -0,0 +1,16 @@
version: '3.7'
services:
nginx:
image: nginx:alpine
ports:
- 127.0.0.1:80:80
- ${SERVER_HOST:-127.0.0.1}:${SERVER_PORT-}:80
volumes:
- .:/usr/share/nginx/html:ro
mocha:
image: blueimp/mocha-chrome
command: http://nginx/test
environment:
- WAIT_FOR_HOSTS=nginx:80
depends_on:
- nginx

View File

@@ -0,0 +1,143 @@
/*
* JavaScript Canvas to Blob
* https://github.com/blueimp/JavaScript-Canvas-to-Blob
*
* Copyright 2012, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
*
* Based on stackoverflow user Stoive's code snippet:
* http://stackoverflow.com/q/4998908
*/
/* global define, Uint8Array, ArrayBuffer, module */
;(function (window) {
'use strict'
var CanvasPrototype =
window.HTMLCanvasElement && window.HTMLCanvasElement.prototype
var hasBlobConstructor =
window.Blob &&
(function () {
try {
return Boolean(new Blob())
} catch (e) {
return false
}
})()
var hasArrayBufferViewSupport =
hasBlobConstructor &&
window.Uint8Array &&
(function () {
try {
return new Blob([new Uint8Array(100)]).size === 100
} catch (e) {
return false
}
})()
var BlobBuilder =
window.BlobBuilder ||
window.WebKitBlobBuilder ||
window.MozBlobBuilder ||
window.MSBlobBuilder
var dataURIPattern = /^data:((.*?)(;charset=.*?)?)(;base64)?,/
var dataURLtoBlob =
(hasBlobConstructor || BlobBuilder) &&
window.atob &&
window.ArrayBuffer &&
window.Uint8Array &&
function (dataURI) {
var matches,
mediaType,
isBase64,
dataString,
byteString,
arrayBuffer,
intArray,
i,
bb
// Parse the dataURI components as per RFC 2397
matches = dataURI.match(dataURIPattern)
if (!matches) {
throw new Error('invalid data URI')
}
// Default to text/plain;charset=US-ASCII
mediaType = matches[2]
? matches[1]
: 'text/plain' + (matches[3] || ';charset=US-ASCII')
isBase64 = !!matches[4]
dataString = dataURI.slice(matches[0].length)
if (isBase64) {
// Convert base64 to raw binary data held in a string:
byteString = atob(dataString)
} else {
// Convert base64/URLEncoded data component to raw binary:
byteString = decodeURIComponent(dataString)
}
// Write the bytes of the string to an ArrayBuffer:
arrayBuffer = new ArrayBuffer(byteString.length)
intArray = new Uint8Array(arrayBuffer)
for (i = 0; i < byteString.length; i += 1) {
intArray[i] = byteString.charCodeAt(i)
}
// Write the ArrayBuffer (or ArrayBufferView) to a blob:
if (hasBlobConstructor) {
return new Blob([hasArrayBufferViewSupport ? intArray : arrayBuffer], {
type: mediaType
})
}
bb = new BlobBuilder()
bb.append(arrayBuffer)
return bb.getBlob(mediaType)
}
if (window.HTMLCanvasElement && !CanvasPrototype.toBlob) {
if (CanvasPrototype.mozGetAsFile) {
CanvasPrototype.toBlob = function (callback, type, quality) {
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) {
if (CanvasPrototype.msToBlob) {
CanvasPrototype.toBlob = function (callback, type, quality) {
var self = this
setTimeout(function () {
if (
((type && type !== 'image/png') || quality) &&
CanvasPrototype.toDataURL &&
dataURLtoBlob
) {
callback(dataURLtoBlob(self.toDataURL(type, quality)))
} else {
callback(self.msToBlob(type))
}
})
}
} else {
CanvasPrototype.toBlob = function (callback, type, quality) {
var self = this
setTimeout(function () {
callback(dataURLtoBlob(self.toDataURL(type, quality)))
})
}
}
}
}
if (typeof define === 'function' && define.amd) {
define(function () {
return dataURLtoBlob
})
} else if (typeof module === 'object' && module.exports) {
module.exports = dataURLtoBlob
} else {
window.dataURLtoBlob = dataURLtoBlob
}
})(window)

View File

@@ -0,0 +1,2 @@
!function(t){"use strict";var a=t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype,b=t.Blob&&function(){try{return Boolean(new Blob)}catch(t){return!1}}(),f=b&&t.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(t){return!1}}(),B=t.BlobBuilder||t.WebKitBlobBuilder||t.MozBlobBuilder||t.MSBlobBuilder,s=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,r=(b||B)&&t.atob&&t.ArrayBuffer&&t.Uint8Array&&function(t){var e,o,n,a,r,i,l,u,c=t.match(s);if(!c)throw new Error("invalid data URI");for(e=c[2]?c[1]:"text/plain"+(c[3]||";charset=US-ASCII"),o=!!c[4],n=t.slice(c[0].length),a=(o?atob:decodeURIComponent)(n),r=new ArrayBuffer(a.length),i=new Uint8Array(r),l=0;l<a.length;l+=1)i[l]=a.charCodeAt(l);return b?new Blob([f?i:r],{type:e}):((u=new B).append(r),u.getBlob(e))};t.HTMLCanvasElement&&!a.toBlob&&(a.mozGetAsFile?a.toBlob=function(t,e,o){var n=this;setTimeout(function(){o&&a.toDataURL&&r?t(r(n.toDataURL(e,o))):t(n.mozGetAsFile("blob",e))})}:a.toDataURL&&r&&(a.msToBlob?a.toBlob=function(t,e,o){var n=this;setTimeout(function(){(e&&"image/png"!==e||o)&&a.toDataURL&&r?t(r(n.toDataURL(e,o))):t(n.msToBlob(e))})}:a.toBlob=function(t,e,o){var n=this;setTimeout(function(){t(r(n.toDataURL(e,o)))})})),"function"==typeof define&&define.amd?define(function(){return r}):"object"==typeof module&&module.exports?module.exports=r:t.dataURLtoBlob=r}(window);
//# sourceMappingURL=canvas-to-blob.min.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["canvas-to-blob.js"],"names":["window","CanvasPrototype","HTMLCanvasElement","prototype","hasBlobConstructor","Blob","Boolean","e","hasArrayBufferViewSupport","Uint8Array","size","BlobBuilder","WebKitBlobBuilder","MozBlobBuilder","MSBlobBuilder","dataURIPattern","dataURLtoBlob","atob","ArrayBuffer","dataURI","mediaType","isBase64","dataString","byteString","arrayBuffer","intArray","i","bb","matches","match","Error","slice","length","decodeURIComponent","charCodeAt","type","append","getBlob","toBlob","mozGetAsFile","callback","quality","self","this","setTimeout","toDataURL","msToBlob","define","amd","module","exports"],"mappings":"CAgBC,SAAWA,gBAGV,IAAIC,EACFD,EAAOE,mBAAqBF,EAAOE,kBAAkBC,UACnDC,EACFJ,EAAOK,MACP,WACE,IACE,OAAOC,QAAQ,IAAID,MACnB,MAAOE,GACP,OAAO,GAJX,G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AAW,YAELT,GAAiB,cAATA,GAAyBM,IACnCxC,EAAgB4C,WAChB7B,EAEAwB,EAASxB,EAAc0B,EAAKG,UAAUV,EAAMM,KAE5CD,EAASE,EAAKI,SAASX,OAK7BlC,EAAgBqC,OAAS,SAAUE,EAAUL,EAAMM,GACjD,IAAIC,EAAOC,KACXC,WAAW,WACTJ,EAASxB,EAAc0B,EAAKG,UAAUV,EAAMM,UAMhC,mBAAXM,QAAyBA,OAAOC,IACzCD,OAAO,WACL,OAAO/B,IAEkB,iBAAXiC,QAAuBA,OAAOC,QAC9CD,OAAOC,QAAUlC,EAEjBhB,EAAOgB,cAAgBA,EA5H1B,CA8HEhB"}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,68 @@
{
"name": "blueimp-canvas-to-blob",
"version": "3.27.0",
"title": "JavaScript Canvas to Blob",
"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.",
"keywords": [
"javascript",
"canvas",
"blob",
"convert",
"conversion"
],
"homepage": "https://github.com/blueimp/JavaScript-Canvas-to-Blob",
"author": {
"name": "Sebastian Tschan",
"url": "https://blueimp.net"
},
"repository": {
"type": "git",
"url": "git://github.com/blueimp/JavaScript-Canvas-to-Blob.git"
},
"license": "MIT",
"devDependencies": {
"eslint": "7",
"eslint-config-blueimp": "2",
"eslint-config-prettier": "6",
"eslint-plugin-jsdoc": "25",
"eslint-plugin-prettier": "3",
"prettier": "2",
"uglify-js": "3"
},
"eslintConfig": {
"extends": [
"blueimp",
"plugin:jsdoc/recommended",
"plugin:prettier/recommended"
],
"env": {
"browser": true
}
},
"eslintIgnore": [
"js/*.min.js",
"test/vendor"
],
"prettier": {
"arrowParens": "avoid",
"proseWrap": "always",
"semi": false,
"singleQuote": true,
"trailingComma": "none"
},
"scripts": {
"lint": "eslint .",
"unit": "docker-compose run --rm mocha",
"test": "npm run lint && npm run unit",
"posttest": "docker-compose down -v",
"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",
"version": "npm run build && git add -A js",
"postversion": "git push --tags origin master master:gh-pages && npm publish"
},
"files": [
"js/*.js",
"js/*.js.map"
],
"main": "./js/canvas-to-blob.js"
}