Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,17 @@ <h2>Online Converter</h2>
let isEngineReady = false;
let selectedFiles = []; // Maintain our own list of files

// Helper for creating download links
function createDownloadLink(url, filename, textContent) {
const dlLink = document.createElement('a');
dlLink.href = url;
dlLink.download = filename;
dlLink.textContent = textContent;
dlLink.style.fontWeight = 'bold';
dlLink.style.color = '#10b981';
downloadsContainer.appendChild(dlLink);
}

// 1. Fetch our comprehensive JSON database to populate dropdown and input filter
async function loadFormats() {
try {
Expand Down Expand Up @@ -323,13 +334,7 @@ <h2>Online Converter</h2>
// Single file, provide direct link
const blob = new Blob([data], { type: 'application/octet-stream' });
const url = URL.createObjectURL(blob);
const dlLink = document.createElement('a');
dlLink.href = url;
dlLink.download = outFileName;
dlLink.textContent = `⬇️ Download ${outFileName}`;
dlLink.style.fontWeight = 'bold';
dlLink.style.color = '#10b981';
downloadsContainer.appendChild(dlLink);
createDownloadLink(url, outFileName, `⬇️ Download ${outFileName}`);
}
successCount++;
});
Expand All @@ -353,13 +358,7 @@ <h2>Online Converter</h2>
try {
const content = await zip.generateAsync({ type: "blob" });
const url = URL.createObjectURL(content);
const dlLink = document.createElement('a');
dlLink.href = url;
dlLink.download = `converted_images.zip`;
dlLink.textContent = `📦 Download All as ZIP (${successCount} files)`;
dlLink.style.fontWeight = 'bold';
dlLink.style.color = '#10b981';
downloadsContainer.appendChild(dlLink);
createDownloadLink(url, 'converted_images.zip', `📦 Download All as ZIP (${successCount} files)`);
} catch (err) {
console.error("ZIP Generation Failed:", err);
failCount += successCount; // Consider it a failure if we can't zip
Expand Down