GIF to DOC Converter
Drop your GIF files here or click to browse
Support up to 20 files at once. Maximum file size: 50MB per file
Selected files: 0
Conversion Progress
0 / 0 completedDownload Converted Files
Conversion Errors
${file.name}
Waiting...
`;
this.progressList.appendChild(progressItem);
});
}updateProgressItem(index, status) {
const progressItem = document.getElementById(`progress-${index}`);
if (!progressItem) return;
const statusElement = progressItem.querySelector('.progress-status');
statusElement.className = `progress-status ${status}`;
switch (status) {
case 'processing':
statusElement.textContent = 'Converting...';
break;
case 'completed':
statusElement.textContent = 'Completed';
break;
case 'error':
statusElement.textContent = 'Error';
break;
}
}updateProgressStats(completed, total) {
this.progressStats.textContent = `${completed} / ${total} completed`;
}showDownloadSection() {
this.downloadSection.style.display = 'block';
this.updateDownloadList();
}hideDownloadSection() {
this.downloadSection.style.display = 'none';
}updateDownloadList() {
this.downloadList.innerHTML = '';
this.convertedFiles.forEach((file, index) => {
const downloadItem = document.createElement('div');
downloadItem.className = 'download-item';
downloadItem.innerHTML = `${file.name}
`;
this.downloadList.appendChild(downloadItem);
});
}downloadFile(index) {
const file = this.convertedFiles[index];
if (!file) return;
const url = URL.createObjectURL(file.blob);
const a = document.createElement('a');
a.href = url;
a.download = file.name;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}async downloadAllAsZip() {
if (this.convertedFiles.length === 0) return;
try {
const zip = new JSZip();
for (const file of this.convertedFiles) {
zip.file(file.name, file.blob);
}
const zipBlob = await zip.generateAsync({ type: 'blob' });
const url = URL.createObjectURL(zipBlob);
const a = document.createElement('a');
a.href = url;
a.download = 'converted-docs.zip';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
} catch (error) {
console.error('Error creating ZIP file:', error);
alert('Error creating ZIP file. Please try downloading files individually.');
}
}showErrorSection() {
this.errorSection.style.display = 'block';
this.updateErrorList();
}hideErrorSection() {
this.errorSection.style.display = 'none';
}updateErrorList() {
this.errorList.innerHTML = '';
this.errors.forEach(error => {
const errorItem = document.createElement('div');
errorItem.className = 'error-item';
errorItem.innerHTML = `${error.fileName}
${error.error}
`;
this.errorList.appendChild(errorItem);
});
}
}// Initialize the converter when the page loads
let converter;
document.addEventListener('DOMContentLoaded', function() {
converter = new GIFToDOCConverter();
});