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);