Finished Excel Password Remover, Added downloading functionality

Update excel-password-remover.css, excel-password-remover.mjs, and excel-password-remover.jinja
This commit is contained in:
2025-03-02 21:38:56 +01:00
parent b2064cbbaf
commit e1597ad2a2
3 changed files with 36 additions and 7 deletions

View File

@@ -0,0 +1,3 @@
.cursor-pointer {
cursor: pointer;
}

View File

@@ -108,11 +108,19 @@ export function isExcelExtension(fileName) {
).then(eFragment => {
console.debug(eFragment);
const uuid = crypto.randomUUID();
console.debug(eFragment.children);
eFragment.children.id = uuid;
const eFileOutput = eFragment.firstChild;
eFileOutput.addEventListener("click", function() {
console.debug(123);
//processedZipFile
downloadProcessedFile(excelFile);
});
eResultContainer.appendChild(eFileOutput);
//const uuid = crypto.randomUUID();
//console.debug(eFragment.firstChild);
//eFragment.firstChild.id = uuid;
//eResultContainer.appendChild(eFragment);
eResultContainer.appendChild(eFragment);
onFileAddedToDom();
});
}
@@ -180,10 +188,28 @@ export function isExcelExtension(fileName) {
});
}
/**
* @param excelFile {ExcelFileData}
*/
function downloadProcessedFile(excelFile) {
excelFile.processedZipFile.generateAsync({type:"base64"}).then(function(b64Data) {
const eLink = document.createElement('a');
eLink.download = excelFile.getOutputName();
//console.debug(b64Data);
eLink.href = 'data:application/zip;base64,' + b64Data;
eLink.click();
}, function(err) {
console.error(err);
//handleError("An error has occured while generating your file, please check the console for more info !");
});
}
window.onload = function () {
eFileDownloadAllButton.addEventListener("click", function() {
eResultContainer.childNodes.forEach(eResultLine => {
//console.debug(eResultLine);
eResultLine.click();
})
});
eFileClearButton.addEventListener("click", function() {