appscms-tools-theme 2.4.7 → 2.4.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/js/batch.js +2 -2
- data/assets/js/testing-batch.js +35 -32
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ff8e4d6cf7046c1f997584867907b2374e663345dbb5801e82db8bfb269d802
|
4
|
+
data.tar.gz: 8b3a0109c8daf839a9ce16a71400b2be6bef6523ffb98975f2063b110998608c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24f4a73a2419072f537426a23d0dcfaeb26956eca4b095bfef8c0f7c964a920073034fe7477d06095f7b303751a39db7d5083449b7acc4cb85fa331319a51f1b
|
7
|
+
data.tar.gz: 523524b8df4662daf4c17caef143eef94d266577d77970e0e639c1c04729c347fa826bf558b7a3fbbae42e36434f5b3e0665ec4ac062a5d815281a1e6917ea28
|
data/assets/js/batch.js
CHANGED
@@ -11,7 +11,7 @@ const downloadButton = document.querySelector('#download-button')
|
|
11
11
|
const submitButton = document.querySelector('#submit-button')
|
12
12
|
const showProcessingFiles = document.querySelector('.files-processing-list')
|
13
13
|
let zipFileType = null
|
14
|
-
let renderFileTypes =
|
14
|
+
let renderFileTypes = null
|
15
15
|
let root = document.querySelector(':root')
|
16
16
|
root.style.setProperty('--maincolor', fileDropBox.dataset.color)
|
17
17
|
|
@@ -102,7 +102,7 @@ let renderFileTypesHtml = ` <option value="png">png</option>
|
|
102
102
|
`
|
103
103
|
|
104
104
|
const renderFiles = (files) => {
|
105
|
-
if (renderFileTypes !==
|
105
|
+
if (renderFileTypes !== null) {
|
106
106
|
renderFileTypesHtml = ''
|
107
107
|
renderFileTypes.map((i) => {
|
108
108
|
renderFileTypesHtml += `<option value="${i}">${i}</option>`
|
data/assets/js/testing-batch.js
CHANGED
@@ -1,36 +1,39 @@
|
|
1
|
+
zipFileType = 'svg'
|
2
|
+
renderFileTypes = ['svg']
|
1
3
|
const batchConversion = async (file, indexValue) => {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
4
|
+
return new Promise((resolve, reject) => {
|
5
|
+
if (file) {
|
6
|
+
const reader = new FileReader()
|
7
|
+
reader.readAsDataURL(file)
|
8
|
+
reader.onload = (e) => {
|
9
|
+
if (e.target.result) {
|
10
|
+
let image = new Image()
|
11
|
+
let canvas = document.createElement('canvas')
|
12
|
+
canvas.setAttribute('id', 'canvas-img')
|
13
|
+
let ctx = canvas.getContext('2d')
|
14
|
+
image.onload = () => {
|
15
|
+
canvas.width = image.width
|
16
|
+
canvas.height = image.height
|
17
|
+
// counter.innerHTML = e.target.value + "%"
|
18
|
+
let filters = document.querySelector('#applyFilter')
|
19
|
+
if (filters.getAttribute('data-filter') === 'opacity') {
|
20
|
+
ctx.globalAlpha = filters.value
|
21
|
+
ctx.drawImage(image, 0, 0, canvas.width, canvas.height)
|
22
|
+
resolve([indexValue, canvas.toDataURL('image/png'), 'image'])
|
23
|
+
} else {
|
24
|
+
ctx.filter =
|
25
|
+
filters.getAttribute('data-filter') +
|
26
|
+
'(' +
|
27
|
+
filters.value +
|
28
|
+
filters.getAttribute('data-scale') +
|
29
|
+
') '
|
30
|
+
ctx.drawImage(image, 0, 0, canvas.width, canvas.height)
|
31
|
+
resolve([indexValue, canvas.toDataURL('image/png'), 'image'])
|
30
32
|
}
|
33
|
+
}
|
34
|
+
image.src = e.target.result
|
31
35
|
}
|
32
|
-
|
36
|
+
}
|
37
|
+
}
|
38
|
+
})
|
33
39
|
}
|
34
|
-
|
35
|
-
|
36
|
-
|