From 0012831da9698fbb7dd5035603752e0234f05800 Mon Sep 17 00:00:00 2001 From: "stirlingbot[bot]" <195170888+stirlingbot[bot]@users.noreply.github.com> Date: Mon, 24 Mar 2025 10:38:59 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20format=20everything=20with=20pre?= =?UTF-8?q?-commit=20by=20=20(#3220)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Auto-generated by [create-pull-request][1] with **stirlingbot** [1]: https://github.com/peter-evans/create-pull-request Signed-off-by: stirlingbot[bot] <195170888+stirlingbot[bot]@users.noreply.github.com> Co-authored-by: stirlingbot[bot] <195170888+stirlingbot[bot]@users.noreply.github.com> --- .../api/misc/CompressController.java | 2 +- src/main/resources/static/js/DecryptFiles.js | 6 ++--- src/main/resources/static/js/fileInput.js | 24 +++++++++---------- src/main/resources/static/js/search.js | 8 +++---- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/CompressController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/CompressController.java index ade1b306c..79d46cc45 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/CompressController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/CompressController.java @@ -864,4 +864,4 @@ public class CompressController { } return Math.min(9, currentLevel + 1); } -} \ No newline at end of file +} diff --git a/src/main/resources/static/js/DecryptFiles.js b/src/main/resources/static/js/DecryptFiles.js index 8c5b8a50e..6701649c3 100644 --- a/src/main/resources/static/js/DecryptFiles.js +++ b/src/main/resources/static/js/DecryptFiles.js @@ -3,7 +3,7 @@ export class DecryptFile { constructor(){ this.decryptWorker = null } - + async decryptFile(file, requiresPassword) { try { @@ -87,7 +87,7 @@ export class DecryptFile { } pdfjsLib.GlobalWorkerOptions.workerSrc = './pdfjs-legacy/pdf.worker.mjs'; - + const arrayBuffer = await file.arrayBuffer(); const arrayBufferForPdfLib = arrayBuffer.slice(0); var loadingTask; @@ -98,7 +98,7 @@ export class DecryptFile { }); this.decryptWorker = loadingTask._worker - }else { + }else { loadingTask = pdfjsLib.getDocument({ data: arrayBuffer, worker: this.decryptWorker diff --git a/src/main/resources/static/js/fileInput.js b/src/main/resources/static/js/fileInput.js index e9cdfca46..7e89e6cc3 100644 --- a/src/main/resources/static/js/fileInput.js +++ b/src/main/resources/static/js/fileInput.js @@ -144,10 +144,10 @@ function setupFileInput(chooser) { const originalText = inputContainer.querySelector('#fileInputText').innerHTML; inputContainer.querySelector('#fileInputText').innerHTML = window.fileInput.loading; - + async function checkZipFile() { const hasZipFiles = allFiles.some(file => zipTypes.includes(file.type)); - + // Only change to extractPDF message if we actually have zip files if (hasZipFiles) { inputContainer.querySelector('#fileInputText').innerHTML = window.fileInput.extractPDF; @@ -167,7 +167,7 @@ function setupFileInput(chooser) { await Promise.all(promises); } - + const decryptFile = new DecryptFile(); await checkZipFile(); @@ -184,7 +184,7 @@ function setupFileInput(chooser) { } decryptedFile.uniqueId = UUID.uuidv4(); return decryptedFile; - + } catch (error) { console.error(`Error decrypting file: ${file.name}`, error); if (!file.uniqueId) file.uniqueId = UUID.uuidv4(); @@ -214,9 +214,9 @@ function setupFileInput(chooser) { var counter = 0; // do an overall count, then proceed to make the pdf files - await jszip.loadAsync(zipFile) + await jszip.loadAsync(zipFile) .then(function (zip) { - + zip.forEach(function (relativePath, zipEntry) { counter+=1; }) @@ -237,11 +237,11 @@ function setupFileInput(chooser) { if (content.size > 0) { const extension = zipEntry.name.split('.').pop().toLowerCase(); const mimeType = mimeTypes[extension] || 'application/octet-stream'; - + // Check if we're accepting ONLY ZIP files (in which case extract everything) // or if the file type matches the accepted type - if (zipTypes.includes(acceptedFileType) || - acceptedFileType === '*/*' || + if (zipTypes.includes(acceptedFileType) || + acceptedFileType === '*/*' || (mimeType && (mimeType.startsWith(acceptedFileType.split('/')[0]) || acceptedFileType === mimeType))) { var file = new File([content], zipEntry.name, { type: mimeType }); file.uniqueId = UUID.uuidv4(); @@ -251,10 +251,10 @@ function setupFileInput(chooser) { } } }); - + extractionPromises.push(promise); }); - + return Promise.all(extractionPromises); }) .catch(function (err) { @@ -262,7 +262,7 @@ function setupFileInput(chooser) { throw err; }); } - + function handleFileInputChange(inputElement) { const files = allFiles; diff --git a/src/main/resources/static/js/search.js b/src/main/resources/static/js/search.js index 58e3ae9c3..c7932965c 100644 --- a/src/main/resources/static/js/search.js +++ b/src/main/resources/static/js/search.js @@ -34,7 +34,7 @@ document.querySelector("#navbarSearchInput").addEventListener("input", function if (searchText !== "") { var addedResults = new Set(); - + items.forEach(function (item) { var titleElement = item.querySelector(".icon-text"); var iconElement = item.querySelector(".material-symbols-rounded, .icon"); @@ -50,15 +50,15 @@ document.querySelector("#navbarSearchInput").addEventListener("input", function ) { var dropdownItem = document.createElement("div"); dropdownItem.className = "dropdown-item d-flex justify-content-between align-items-center"; - + var contentWrapper = document.createElement("div"); contentWrapper.className = "d-flex align-items-center flex-grow-1"; contentWrapper.style.textDecoration = "none"; contentWrapper.style.color = "inherit"; - + var originalContent = item.querySelector("div").cloneNode(true); contentWrapper.appendChild(originalContent); - + contentWrapper.onclick = function () { window.location.href = itemHref; };