appscms-tools-theme 4.5.9 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/_data/about/en/about.json +16 -16
  3. data/_data/blog/nav.json +14 -14
  4. data/_data/feature/en/batch-conversion.json +192 -192
  5. data/_data/feature/en/compress-pdf.json +305 -305
  6. data/_data/feature/en/devtools.json +321 -321
  7. data/_data/feature/en/face-detection.json +156 -156
  8. data/_data/feature/en/split-pdf.json +221 -221
  9. data/_data/feature/en/theframe.json +160 -160
  10. data/_data/footer/en/data.json +2 -2
  11. data/_data/header/en/data.json +412 -412
  12. data/_data/home/en/en.json +324 -324
  13. data/_data/home/en/posters.json +322 -322
  14. data/_includes/alternates/alternates.html +46 -43
  15. data/_includes/appscms/customblog/contenttool-recent-posts.html +94 -94
  16. data/_includes/appscms/customblog/pageRelatedPosts.html +62 -62
  17. data/_includes/appscms/customblog/recentposts.html +67 -67
  18. data/_includes/appscms/customblog/relatedBlogs.html +82 -82
  19. data/_includes/appscms/customblog/relatedposts.html +193 -193
  20. data/_includes/appscms/extras/appscms-postbox.html +57 -57
  21. data/_includes/appscms/featurePageAuthors/featurePageAuthors.html +85 -85
  22. data/_includes/appscms/head/bloghead.html +128 -128
  23. data/_includes/appscms/head/head.html +3 -2
  24. data/_includes/appscms/headings/contenttool-headings.html +33 -33
  25. data/_includes/appscms/headings/devtool-headings.html +38 -38
  26. data/_includes/appscms/home/contenttool-feature-boxes.html +19 -19
  27. data/_includes/appscms/home/devtool-feature-boxes.html +70 -70
  28. data/_includes/appscms/infographics/infographics.html +166 -166
  29. data/_includes/appscms/loaders/loader.html +4 -4
  30. data/_includes/appscms/navbars/devtool-navbar.html +50 -50
  31. data/_includes/appscms/navbars/devtool-toolbar.html +100 -100
  32. data/_includes/appscms/recent-posts/recent_posts.html +90 -90
  33. data/_includes/appscms/recent-posts/related_categories_post.html +194 -194
  34. data/_includes/appscms/searchbar/devtool-searchbar.html +63 -63
  35. data/_includes/appscms/usp/usp.html +90 -90
  36. data/_includes/author_bio.html +41 -41
  37. data/_includes/authorpagehead/index.html +47 -47
  38. data/_includes/authors/authors.html +39 -39
  39. data/_includes/batch-conversion.html +141 -141
  40. data/_includes/bookmark.html +6 -6
  41. data/_includes/cssfile/links.html +54 -54
  42. data/_includes/custom-head.html +138 -138
  43. data/_includes/customCode.html +1 -1
  44. data/_includes/customScripts.html +1 -1
  45. data/_includes/customblog/pageRelatedPosts.html +87 -87
  46. data/_includes/customblog/recentposts.html +67 -67
  47. data/_includes/customblog/relatedBlogs.html +86 -86
  48. data/_includes/customblog/relatedposts.html +201 -201
  49. data/_includes/dropdown/langdropdown.html +32 -32
  50. data/_includes/feature.html +39 -39
  51. data/_includes/featurePageAuthors/featurePageAuthors.html +101 -101
  52. data/_includes/footer/index.html +537 -537
  53. data/_includes/google-analytics.html +32 -32
  54. data/_includes/head/index.html +623 -623
  55. data/_includes/header/blogHeader.html +34 -34
  56. data/_includes/header/index.html +192 -192
  57. data/_includes/infographics/infographics.html +241 -241
  58. data/_includes/paginationBlogPage.html +70 -70
  59. data/_includes/postbox.html +65 -65
  60. data/_includes/script.html +493 -493
  61. data/_includes/section/count.html +32 -32
  62. data/_includes/section/recent_posts.html +94 -94
  63. data/_includes/section/related_categories_post.html +196 -196
  64. data/_includes/share/socialshare.html +21 -21
  65. data/_includes/userTracking.html +14 -14
  66. data/_layouts/aboutUs.html +175 -175
  67. data/_layouts/allAuthors.html +131 -131
  68. data/_layouts/appscms-about.html +163 -163
  69. data/_layouts/appscms-audio.html +33 -33
  70. data/_layouts/appscms-author.html +436 -436
  71. data/_layouts/appscms-authors.html +145 -145
  72. data/_layouts/appscms-batch.html +141 -141
  73. data/_layouts/appscms-calculator.html +93 -93
  74. data/_layouts/appscms-categories.html +26 -26
  75. data/_layouts/appscms-contact.html +132 -132
  76. data/_layouts/appscms-disclaimer.html +124 -124
  77. data/_layouts/appscms-download.html +289 -289
  78. data/_layouts/appscms-feature-result.html +96 -96
  79. data/_layouts/appscms-help.html +25 -25
  80. data/_layouts/appscms-imagekit.html +96 -96
  81. data/_layouts/appscms-post.html +243 -243
  82. data/_layouts/appscms-privacy-policy.html +781 -781
  83. data/_layouts/appscms-terms-and-conditions.html +646 -646
  84. data/_layouts/appscms-video.html +33 -33
  85. data/_layouts/audio.html +33 -33
  86. data/_layouts/author.html +409 -409
  87. data/_layouts/batch.html +177 -177
  88. data/_layouts/blog-1.html +116 -116
  89. data/_layouts/blog.html +131 -131
  90. data/_layouts/calculator.html +99 -99
  91. data/_layouts/contenttool-feature.html +45 -45
  92. data/_layouts/contenttool-home.html +53 -53
  93. data/_layouts/devtool-blog.html +132 -132
  94. data/_layouts/devtool-feature.html +54 -54
  95. data/_layouts/devtool-home.html +53 -53
  96. data/_layouts/devtools.html +57 -57
  97. data/_layouts/feature-1.html +406 -406
  98. data/_layouts/feature.html +351 -351
  99. data/_layouts/featureResultPage.html +82 -82
  100. data/_layouts/frame.html +222 -222
  101. data/_layouts/home.html +281 -281
  102. data/_layouts/homeResultPage.html +32 -32
  103. data/_layouts/imagekit.html +308 -308
  104. data/_layouts/photo-effects-home.html +190 -190
  105. data/_layouts/post.html +233 -233
  106. data/assets/app.js +75 -75
  107. data/assets/css/appscms-blog.css +505 -505
  108. data/assets/css/appscms-contenttool.css +1384 -1384
  109. data/assets/css/appscms-home.css +5 -5
  110. data/assets/css/appscms-imagekit.css +855 -855
  111. data/assets/css/appscms-variables.css +19 -19
  112. data/assets/css/blog.css +510 -510
  113. data/assets/css/calculators.css +46 -46
  114. data/assets/css/devtool-main.css +1350 -1350
  115. data/assets/css/devtools.css +105 -105
  116. data/assets/css/feature-1.css +293 -293
  117. data/assets/css/imagekit copy.css +848 -848
  118. data/assets/css/imagekit.css +848 -848
  119. data/assets/css/tools.css +1847 -1847
  120. data/assets/images/close-button.svg +31 -31
  121. data/assets/images/digipaint.svg +6 -6
  122. data/assets/images/logo.svg +2 -2
  123. data/assets/images/manthink.svg +3552 -3552
  124. data/assets/images/search-icon.svg +2 -2
  125. data/assets/js/batch.js +219 -219
  126. data/assets/js/devtools.js +81 -81
  127. data/assets/js/sharePage.js +65 -65
  128. data/assets/js/usageTracking.js +143 -143
  129. data/assets/js/usageTrackingEvents.js +6 -6
  130. data/assets/js/webvitals.js +4 -4
  131. metadata +3 -3
@@ -1,3 +1,3 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M4 11C4 7.13401 7.13401 4 11 4C14.866 4 18 7.13401 18 11C18 14.866 14.866 18 11 18C7.13401 18 4 14.866 4 11ZM11 2C6.02944 2 2 6.02944 2 11C2 15.9706 6.02944 20 11 20C13.125 20 15.078 19.2635 16.6177 18.0319L20.2929 21.7071C20.6834 22.0976 21.3166 22.0976 21.7071 21.7071C22.0976 21.3166 22.0976 20.6834 21.7071 20.2929L18.0319 16.6177C19.2635 15.078 20 13.125 20 11C20 6.02944 15.9706 2 11 2Z" fill="#000000"/>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M4 11C4 7.13401 7.13401 4 11 4C14.866 4 18 7.13401 18 11C18 14.866 14.866 18 11 18C7.13401 18 4 14.866 4 11ZM11 2C6.02944 2 2 6.02944 2 11C2 15.9706 6.02944 20 11 20C13.125 20 15.078 19.2635 16.6177 18.0319L20.2929 21.7071C20.6834 22.0976 21.3166 22.0976 21.7071 21.7071C22.0976 21.3166 22.0976 20.6834 21.7071 20.2929L18.0319 16.6177C19.2635 15.078 20 13.125 20 11C20 6.02944 15.9706 2 11 2Z" fill="#000000"/>
3
3
  </svg>
data/assets/js/batch.js CHANGED
@@ -1,219 +1,219 @@
1
- const getScript = document.currentScript;
2
- const pageTool = getScript.dataset.tool;
3
- const lang = getScript.dataset.lang;
4
- const inputBox = document.querySelector(".upload-btn");
5
- const addFiles = document.querySelector(".add-more-files");
6
- const fileDropBox = document.querySelector(".box");
7
- const workspace = document.querySelector(".workspace");
8
- const selectedFilesList = document.querySelector(".selectedFilesList");
9
- const downloadButton = document.querySelector("#download-button");
10
- const submitButton = document.querySelector("#submit-button");
11
- const showProcessingFiles = document.querySelector(".files-processing-list");
12
- let zipFileType = null;
13
- let renderFileTypes = null;
14
-
15
- const showLoader = () => {
16
- showLoading();
17
- };
18
- const closeLoader = () => {};
19
-
20
- fileDropBox.addEventListener("dragover", (e) => {
21
- e.preventDefault();
22
- });
23
- fileDropBox.addEventListener("drop", (e) => {
24
- e.preventDefault();
25
- handleFile(e.dataTransfer.files[0]);
26
- });
27
- const fileOnChange = () => {
28
- handleFile(file.files);
29
- };
30
- inputBox.onclick = function () {
31
- document.querySelector("#file").click();
32
- };
33
- const fileOnChange2 = () => {
34
- addMoreFiles(document.querySelector("#file2").files);
35
- };
36
- addFiles.onclick = function () {
37
- document.querySelector("#file2").click();
38
- };
39
- let files = [];
40
- let fileName = "";
41
- let blobList = [];
42
- const addMoreFiles = (addFiles) => {
43
- handleFile(addFiles);
44
- };
45
- const onSubmit = (files) => {
46
- blobList = [];
47
- Promise.all(
48
- files.map((item, index) => {
49
- document.querySelector(
50
- `#loader-${index}`
51
- ).innerHTML = `<span class="processing">processing</span>
52
- <div class="spinner-border" role="status"><span class="sr-only">Loading...</span></div>`;
53
- return new Promise((resolve, reject) => {
54
- batchConversion(item, index).then(([indexValue, blob, type]) => {
55
- blobList.push({ blob: blob, fileName: item });
56
- document.querySelector(
57
- `#loader-${indexValue}`
58
- ).innerHTML = `<span class="done">finished</span>`;
59
- document.querySelector(`#download-${indexValue}`).style.display =
60
- "inline-block";
61
- resolve();
62
- });
63
- }).catch((error) => {
64
- console.log(error);
65
- });
66
- })
67
- ).then(() => {
68
- document.querySelector(".bottom-section-container").style.display = "flex";
69
- document.querySelector(".bottom-section-container").style.padding =
70
- "20px .75rem";
71
- document.querySelector("#download-zip").style.display = "block";
72
- let zip = new JSZip();
73
- let zipFiles = zip.folder(`safeimagekit-batch-images`);
74
- blobList.map((item) => {
75
- zipFiles.file(
76
- `safeimagekit-batch-${item.fileName.name.split(".")[0]}.${
77
- zipFileType ? zipFileType : "png"
78
- }`,
79
- getBase64String(item.blob),
80
- { base64: true }
81
- );
82
- });
83
-
84
- document.querySelector("#download-zip").addEventListener("click", () => {
85
- zip.generateAsync({ type: "blob" }).then(function (content) {
86
- saveAs(content, `safeimagekit-batch-conversion.zip`);
87
- if (lang === "en") {
88
- window.location.href = `/download?tool=${pageTool}`;
89
- } else {
90
- window.location.href = `/${lang}/download?tool=${pageTool}`;
91
- }
92
- });
93
- });
94
- });
95
- };
96
- let renderFileTypesHtml = ` <option value="png">png</option>
97
- <option value="jpg">jpg</option>
98
- <option value="jpeg">jpeg</option>
99
- <option value="webp">webp</option>
100
- `;
101
-
102
- const renderFiles = (files) => {
103
- if (renderFileTypes !== null) {
104
- renderFileTypesHtml = "";
105
- renderFileTypes.map((i) => {
106
- renderFileTypesHtml += `<option value="${i}">${i}</option>`;
107
- });
108
- }
109
- files.map((file, index) => {
110
- if (file) {
111
- let filename = file.name;
112
- if (file.name.split(".")[0].length > 10) {
113
- let fName = file.name.split(".")[0];
114
- let fExtention = file.name.split(".")[1];
115
- filename =
116
- fName.substr(0, 9) + "..." + fName.substr(-3) + "." + fExtention;
117
- }
118
- let loader = "Ready";
119
- showProcessingFiles.innerHTML += `
120
- <tr>
121
- <th scope="row" class="file-icon-row">
122
- <img src="/assets/images/file.png" alt="file" class="file-icon">
123
- </th>
124
- <td class="fileName">${filename}</td>
125
- <td id=loader-${index} class="file-processing"><span class="ready">${loader}</span></td>
126
- <td>
127
- <div class="download-format ">
128
- <select name="image-format" id="image-format">
129
- ${renderFileTypesHtml}
130
- </select>
131
- </div>
132
-
133
- </td>
134
- <td class="file-download-button text-right">
135
- <button style="display:none;" id=download-${index} data-type="image" onclick="handleDownload(this)" class="btn download-file-btn">
136
- <svg class="download-icon" width="16px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"
137
- fill="currentColor">
138
- <path
139
- d="M18 20H5V15H6V19H17V15H18V20ZM12 4V15.19L14.3 13L15 13.6667L11.5 17L8 13.6667L8.7 13L11 15.19V4H12Z">
140
- </path>
141
- </svg> Download
142
- </button>
143
- </td>
144
- </tr>
145
- `;
146
- }
147
- });
148
- };
149
-
150
- const handleFile = (file) => {
151
- showProcessingFiles.innerHTML = "";
152
- if (file) {
153
- for (let i = 0; i < file.length; i++) {
154
- files.push(file[i]);
155
- stopLoading();
156
- workspace.style.display = "block";
157
- document.querySelector("#file").style.display = "block";
158
- let listItem = document.createElement("li");
159
- listItem.style.listStyle = "none";
160
- let getFileSize = formatBytes(file[i].size);
161
- listItem.innerHTML = `${file[i].name} (${getFileSize})`;
162
- // selectedFilesList.appendChild(listItem)
163
- }
164
- }
165
- renderFiles(files);
166
- submitButton.addEventListener("click", () => onSubmit(files));
167
- };
168
- const formatBytes = (bytes, decimals = 2) => {
169
- if (bytes === 0) return "0 Bytes";
170
-
171
- const k = 1024;
172
- const dm = decimals < 0 ? 0 : decimals;
173
- const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
174
-
175
- const i = Math.floor(Math.log(bytes) / Math.log(k));
176
-
177
- return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
178
- };
179
- const handleDownload = (e) => {
180
- let find = blobList[Number(e.id.replace(/^\D+/g, ""))].blob;
181
- let fileName = blobList[Number(e.id.replace(/^\D+/g, ""))].fileName.name;
182
-
183
- let format = document.querySelector("#image-format").value;
184
-
185
- switch (e.dataset.type) {
186
- case "image":
187
- let a = document.createElement("a");
188
- a.href = find;
189
- a.download = `safeimagekit-batch-${fileName.split(".")[0]}.${format}`;
190
- document.body.appendChild(a);
191
- a.click();
192
- break;
193
- default:
194
- break;
195
- }
196
- };
197
- const showLoading = () => {
198
- document.querySelector("#file-loader").style.display = "flex";
199
- document.querySelector(".file-input").style.display = "none";
200
- };
201
- const stopLoading = () => {
202
- fileDropBox.style.display = "none";
203
- };
204
-
205
- const getBase64String = (dataURL) => {
206
- const idx = dataURL.indexOf("base64,") + "base64,".length;
207
- return dataURL.substring(idx);
208
- };
209
- const dataURLtoBlob = (dataurl) => {
210
- let arr = dataurl.split(","),
211
- mime = arr[0].match(/:(.*?);/)[1],
212
- bstr = atob(arr[1]),
213
- n = bstr.length,
214
- u8arr = new Uint8Array(n);
215
- while (n--) {
216
- u8arr[n] = bstr.charCodeAt(n);
217
- }
218
- return new Blob([u8arr], { type: mime });
219
- };
1
+ const getScript = document.currentScript;
2
+ const pageTool = getScript.dataset.tool;
3
+ const lang = getScript.dataset.lang;
4
+ const inputBox = document.querySelector(".upload-btn");
5
+ const addFiles = document.querySelector(".add-more-files");
6
+ const fileDropBox = document.querySelector(".box");
7
+ const workspace = document.querySelector(".workspace");
8
+ const selectedFilesList = document.querySelector(".selectedFilesList");
9
+ const downloadButton = document.querySelector("#download-button");
10
+ const submitButton = document.querySelector("#submit-button");
11
+ const showProcessingFiles = document.querySelector(".files-processing-list");
12
+ let zipFileType = null;
13
+ let renderFileTypes = null;
14
+
15
+ const showLoader = () => {
16
+ showLoading();
17
+ };
18
+ const closeLoader = () => {};
19
+
20
+ fileDropBox.addEventListener("dragover", (e) => {
21
+ e.preventDefault();
22
+ });
23
+ fileDropBox.addEventListener("drop", (e) => {
24
+ e.preventDefault();
25
+ handleFile(e.dataTransfer.files[0]);
26
+ });
27
+ const fileOnChange = () => {
28
+ handleFile(file.files);
29
+ };
30
+ inputBox.onclick = function () {
31
+ document.querySelector("#file").click();
32
+ };
33
+ const fileOnChange2 = () => {
34
+ addMoreFiles(document.querySelector("#file2").files);
35
+ };
36
+ addFiles.onclick = function () {
37
+ document.querySelector("#file2").click();
38
+ };
39
+ let files = [];
40
+ let fileName = "";
41
+ let blobList = [];
42
+ const addMoreFiles = (addFiles) => {
43
+ handleFile(addFiles);
44
+ };
45
+ const onSubmit = (files) => {
46
+ blobList = [];
47
+ Promise.all(
48
+ files.map((item, index) => {
49
+ document.querySelector(
50
+ `#loader-${index}`
51
+ ).innerHTML = `<span class="processing">processing</span>
52
+ <div class="spinner-border" role="status"><span class="sr-only">Loading...</span></div>`;
53
+ return new Promise((resolve, reject) => {
54
+ batchConversion(item, index).then(([indexValue, blob, type]) => {
55
+ blobList.push({ blob: blob, fileName: item });
56
+ document.querySelector(
57
+ `#loader-${indexValue}`
58
+ ).innerHTML = `<span class="done">finished</span>`;
59
+ document.querySelector(`#download-${indexValue}`).style.display =
60
+ "inline-block";
61
+ resolve();
62
+ });
63
+ }).catch((error) => {
64
+ console.log(error);
65
+ });
66
+ })
67
+ ).then(() => {
68
+ document.querySelector(".bottom-section-container").style.display = "flex";
69
+ document.querySelector(".bottom-section-container").style.padding =
70
+ "20px .75rem";
71
+ document.querySelector("#download-zip").style.display = "block";
72
+ let zip = new JSZip();
73
+ let zipFiles = zip.folder(`safeimagekit-batch-images`);
74
+ blobList.map((item) => {
75
+ zipFiles.file(
76
+ `safeimagekit-batch-${item.fileName.name.split(".")[0]}.${
77
+ zipFileType ? zipFileType : "png"
78
+ }`,
79
+ getBase64String(item.blob),
80
+ { base64: true }
81
+ );
82
+ });
83
+
84
+ document.querySelector("#download-zip").addEventListener("click", () => {
85
+ zip.generateAsync({ type: "blob" }).then(function (content) {
86
+ saveAs(content, `safeimagekit-batch-conversion.zip`);
87
+ if (lang === "en") {
88
+ window.location.href = `/download?tool=${pageTool}`;
89
+ } else {
90
+ window.location.href = `/${lang}/download?tool=${pageTool}`;
91
+ }
92
+ });
93
+ });
94
+ });
95
+ };
96
+ let renderFileTypesHtml = ` <option value="png">png</option>
97
+ <option value="jpg">jpg</option>
98
+ <option value="jpeg">jpeg</option>
99
+ <option value="webp">webp</option>
100
+ `;
101
+
102
+ const renderFiles = (files) => {
103
+ if (renderFileTypes !== null) {
104
+ renderFileTypesHtml = "";
105
+ renderFileTypes.map((i) => {
106
+ renderFileTypesHtml += `<option value="${i}">${i}</option>`;
107
+ });
108
+ }
109
+ files.map((file, index) => {
110
+ if (file) {
111
+ let filename = file.name;
112
+ if (file.name.split(".")[0].length > 10) {
113
+ let fName = file.name.split(".")[0];
114
+ let fExtention = file.name.split(".")[1];
115
+ filename =
116
+ fName.substr(0, 9) + "..." + fName.substr(-3) + "." + fExtention;
117
+ }
118
+ let loader = "Ready";
119
+ showProcessingFiles.innerHTML += `
120
+ <tr>
121
+ <th scope="row" class="file-icon-row">
122
+ <img src="/assets/images/file.png" alt="file" class="file-icon">
123
+ </th>
124
+ <td class="fileName">${filename}</td>
125
+ <td id=loader-${index} class="file-processing"><span class="ready">${loader}</span></td>
126
+ <td>
127
+ <div class="download-format ">
128
+ <select name="image-format" id="image-format">
129
+ ${renderFileTypesHtml}
130
+ </select>
131
+ </div>
132
+
133
+ </td>
134
+ <td class="file-download-button text-right">
135
+ <button style="display:none;" id=download-${index} data-type="image" onclick="handleDownload(this)" class="btn download-file-btn">
136
+ <svg class="download-icon" width="16px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"
137
+ fill="currentColor">
138
+ <path
139
+ d="M18 20H5V15H6V19H17V15H18V20ZM12 4V15.19L14.3 13L15 13.6667L11.5 17L8 13.6667L8.7 13L11 15.19V4H12Z">
140
+ </path>
141
+ </svg> Download
142
+ </button>
143
+ </td>
144
+ </tr>
145
+ `;
146
+ }
147
+ });
148
+ };
149
+
150
+ const handleFile = (file) => {
151
+ showProcessingFiles.innerHTML = "";
152
+ if (file) {
153
+ for (let i = 0; i < file.length; i++) {
154
+ files.push(file[i]);
155
+ stopLoading();
156
+ workspace.style.display = "block";
157
+ document.querySelector("#file").style.display = "block";
158
+ let listItem = document.createElement("li");
159
+ listItem.style.listStyle = "none";
160
+ let getFileSize = formatBytes(file[i].size);
161
+ listItem.innerHTML = `${file[i].name} (${getFileSize})`;
162
+ // selectedFilesList.appendChild(listItem)
163
+ }
164
+ }
165
+ renderFiles(files);
166
+ submitButton.addEventListener("click", () => onSubmit(files));
167
+ };
168
+ const formatBytes = (bytes, decimals = 2) => {
169
+ if (bytes === 0) return "0 Bytes";
170
+
171
+ const k = 1024;
172
+ const dm = decimals < 0 ? 0 : decimals;
173
+ const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
174
+
175
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
176
+
177
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
178
+ };
179
+ const handleDownload = (e) => {
180
+ let find = blobList[Number(e.id.replace(/^\D+/g, ""))].blob;
181
+ let fileName = blobList[Number(e.id.replace(/^\D+/g, ""))].fileName.name;
182
+
183
+ let format = document.querySelector("#image-format").value;
184
+
185
+ switch (e.dataset.type) {
186
+ case "image":
187
+ let a = document.createElement("a");
188
+ a.href = find;
189
+ a.download = `safeimagekit-batch-${fileName.split(".")[0]}.${format}`;
190
+ document.body.appendChild(a);
191
+ a.click();
192
+ break;
193
+ default:
194
+ break;
195
+ }
196
+ };
197
+ const showLoading = () => {
198
+ document.querySelector("#file-loader").style.display = "flex";
199
+ document.querySelector(".file-input").style.display = "none";
200
+ };
201
+ const stopLoading = () => {
202
+ fileDropBox.style.display = "none";
203
+ };
204
+
205
+ const getBase64String = (dataURL) => {
206
+ const idx = dataURL.indexOf("base64,") + "base64,".length;
207
+ return dataURL.substring(idx);
208
+ };
209
+ const dataURLtoBlob = (dataurl) => {
210
+ let arr = dataurl.split(","),
211
+ mime = arr[0].match(/:(.*?);/)[1],
212
+ bstr = atob(arr[1]),
213
+ n = bstr.length,
214
+ u8arr = new Uint8Array(n);
215
+ while (n--) {
216
+ u8arr[n] = bstr.charCodeAt(n);
217
+ }
218
+ return new Blob([u8arr], { type: mime });
219
+ };
@@ -1,82 +1,82 @@
1
- let input_editor, output_editor, data;
2
- output_editor = ace.edit("output_editor");
3
- output_editor.setReadOnly(true)
4
- output_editor.session.setMode("ace/mode/json");
5
- input_editor = ace.edit("input_editor");
6
- input_editor.session.setMode("ace/mode/json");
7
- let upload_div_inner = document.getElementById("upload_div_inner")
8
- let file_upload = document.getElementById("file_upload")
9
- let format_btn = document.getElementById("format_btn")
10
- let inputcopyButton = document.querySelector("#inputcopy");
11
- let outputcopyButton = document.querySelector("#outputcopy");
12
- let deleteEditorInputTxt = document.querySelector(".input_editor_bar .cross_icon");
13
- let deleteEditorOuputTxt = document.querySelector(".output_editor_bar .cross_icon");
14
- const siteName = file_upload.dataset.sitename
15
- let selectedFile
16
-
17
- upload_div_inner.onclick = function () {
18
- document.querySelector("#file_upload").click();
19
- };
20
- file_upload.onchange = function (e) {
21
- var input = e.target.files[0];
22
- selectedFile = input
23
- input_editor = ace.edit("input_editor");
24
- input_editor.session.setMode("ace/mode/json");
25
- var reader = new FileReader();
26
- reader.onload = function () {
27
- input_editor.setValue(reader.result);
28
- }
29
- reader.readAsText(input);
30
- };
31
- document.querySelector("#input_editor_bar .save_icon").onclick = function () {
32
- file_saving_decision(1);
33
- };
34
- editorActions();
35
- function editorActions() {
36
- deleteEditorInputTxt.onclick = function () {
37
- input_editor.setValue("");
38
- }
39
- deleteEditorOuputTxt.onclick = function () {
40
- output_editor.setValue("");
41
- }
42
- inputcopyButton.addEventListener("click", (e) => {
43
- const el = document.createElement("textarea");
44
- el.value = input_editor.getValue();
45
- document.body.appendChild(el);
46
- el.select();
47
- document.execCommand("copy");
48
- e.target.setAttribute('data-original-title', 'Copied !')
49
- })
50
- outputcopyButton.addEventListener("click", (e) => {
51
- const el = document.createElement("textarea");
52
- el.value = output_editor.getValue();
53
- document.body.appendChild(el);
54
- el.select();
55
- document.execCommand("copy");
56
- e.target.setAttribute('data-original-title', 'Copied !')
57
- })
58
- }
59
- function file_saving_decision(flag) {
60
- if (flag == 1) {
61
- if (input_editor.getValue == "" || input_editor.getValue == undefined) {
62
- return false;
63
- } else {
64
- file_download(input_editor.getValue(), "application/json", "json");
65
- }
66
- } else if (flag == 0) {
67
- if (output_editor.getValue == "" || output_editor.getValue == undefined) {
68
- return false;
69
- } else {
70
- file_download(output_editor.getValue(), "text/plain", "txt");
71
- }
72
- }
73
- }
74
- function file_download(code, mimetype, extension) {
75
- var a = document.createElement("a");
76
- var data = new Blob([code], {
77
- type: mimetype,
78
- });
79
- a.href = window.URL.createObjectURL(data);
80
- a.download = `${siteName}.` + extension;
81
- a.click();
1
+ let input_editor, output_editor, data;
2
+ output_editor = ace.edit("output_editor");
3
+ output_editor.setReadOnly(true)
4
+ output_editor.session.setMode("ace/mode/json");
5
+ input_editor = ace.edit("input_editor");
6
+ input_editor.session.setMode("ace/mode/json");
7
+ let upload_div_inner = document.getElementById("upload_div_inner")
8
+ let file_upload = document.getElementById("file_upload")
9
+ let format_btn = document.getElementById("format_btn")
10
+ let inputcopyButton = document.querySelector("#inputcopy");
11
+ let outputcopyButton = document.querySelector("#outputcopy");
12
+ let deleteEditorInputTxt = document.querySelector(".input_editor_bar .cross_icon");
13
+ let deleteEditorOuputTxt = document.querySelector(".output_editor_bar .cross_icon");
14
+ const siteName = file_upload.dataset.sitename
15
+ let selectedFile
16
+
17
+ upload_div_inner.onclick = function () {
18
+ document.querySelector("#file_upload").click();
19
+ };
20
+ file_upload.onchange = function (e) {
21
+ var input = e.target.files[0];
22
+ selectedFile = input
23
+ input_editor = ace.edit("input_editor");
24
+ input_editor.session.setMode("ace/mode/json");
25
+ var reader = new FileReader();
26
+ reader.onload = function () {
27
+ input_editor.setValue(reader.result);
28
+ }
29
+ reader.readAsText(input);
30
+ };
31
+ document.querySelector("#input_editor_bar .save_icon").onclick = function () {
32
+ file_saving_decision(1);
33
+ };
34
+ editorActions();
35
+ function editorActions() {
36
+ deleteEditorInputTxt.onclick = function () {
37
+ input_editor.setValue("");
38
+ }
39
+ deleteEditorOuputTxt.onclick = function () {
40
+ output_editor.setValue("");
41
+ }
42
+ inputcopyButton.addEventListener("click", (e) => {
43
+ const el = document.createElement("textarea");
44
+ el.value = input_editor.getValue();
45
+ document.body.appendChild(el);
46
+ el.select();
47
+ document.execCommand("copy");
48
+ e.target.setAttribute('data-original-title', 'Copied !')
49
+ })
50
+ outputcopyButton.addEventListener("click", (e) => {
51
+ const el = document.createElement("textarea");
52
+ el.value = output_editor.getValue();
53
+ document.body.appendChild(el);
54
+ el.select();
55
+ document.execCommand("copy");
56
+ e.target.setAttribute('data-original-title', 'Copied !')
57
+ })
58
+ }
59
+ function file_saving_decision(flag) {
60
+ if (flag == 1) {
61
+ if (input_editor.getValue == "" || input_editor.getValue == undefined) {
62
+ return false;
63
+ } else {
64
+ file_download(input_editor.getValue(), "application/json", "json");
65
+ }
66
+ } else if (flag == 0) {
67
+ if (output_editor.getValue == "" || output_editor.getValue == undefined) {
68
+ return false;
69
+ } else {
70
+ file_download(output_editor.getValue(), "text/plain", "txt");
71
+ }
72
+ }
73
+ }
74
+ function file_download(code, mimetype, extension) {
75
+ var a = document.createElement("a");
76
+ var data = new Blob([code], {
77
+ type: mimetype,
78
+ });
79
+ a.href = window.URL.createObjectURL(data);
80
+ a.download = `${siteName}.` + extension;
81
+ a.click();
82
82
  }