From 4b036b5d8f97b053e7c739180730b9d2d1d13920 Mon Sep 17 00:00:00 2001 From: eclipse Date: Thu, 4 Sep 2025 17:57:45 +0200 Subject: [PATCH] =?UTF-8?q?all=20"Save=20as=20=E2=80=A6"=20dialogs=20for?= =?UTF-8?q?=20files=20after=20the=20first=20now=20appear=20at=20once,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- background.js | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/background.js b/background.js index e4a3615..1396325 100644 --- a/background.js +++ b/background.js @@ -31,22 +31,17 @@ async function downloadAllFiles(urlsAndFilenames) { console.log(`background.js: downloadAllFiles(): started with ${JSON.stringify(urlsAndFilenames)}`); const currentDate = getCurrentDate(); - for (const urlAndFilename of urlsAndFilenames) { - let prefixedFilename = currentDate + " " + urlAndFilename.filename; - await downloadFile(urlAndFilename.url, prefixedFilename, true).then(onSuccess, onFailure); - } -/* + for (let i = 0; i < urlsAndFilenames.length; i++) { // prefix filename let prefixedFilename = currentDate + " " + urlsAndFilenames[i].filename; console.log(`background.js: downloadAllFiles(): i is ${i}`); -// if ( i == 0 ) { + if ( i == 0 ) { await downloadFile(urlsAndFilenames[i].url, prefixedFilename, true).then(onSuccess, onFailure); -// } else { -// downloadFile(urlsAndFilenames[i].url, prefixedFilename).then(onSuccess, onFailure); -// } + } else { + downloadFile(urlsAndFilenames[i].url, prefixedFilename, true).then(onSuccess, onFailure); + } } -*/ } function handlePageactionClick(tab, onClickData) { @@ -86,12 +81,5 @@ function handlePageactionClick(tab, onClickData) { ) } -/* -let gettingAllPermissions = browser.permissions.getAll(); -gettingAllPermissions.then((allPermissions) => { - console.log(JSON.stringify(allPermissions)) -}); -*/ - // add listener for the extension button browser.pageAction.onClicked.addListener(handlePageactionClick);