File Tagging & Categorization

File Tagging & Categorization

Step 1: Add File Details

Recently Added Files:

  • No files added yet.

No files have been added yet. Please add files in the first tab.

'; return; } sortedCategories.forEach(category => { const categoryDiv = document.createElement('div'); categoryDiv.className = 'p-4 border rounded-md category-card'; let filesHtml = toolState.categories[category].map(file => `
  • ${file.name}
    ${file.tags.map(tag => `${tag}`).join('') || 'No tags'}
  • `).join(''); categoryDiv.innerHTML = `

    ${category}

      ${filesHtml}
    `; organizedViewEl.appendChild(categoryDiv); }); }; const getExportContent = () => { let content = 'File Organization Report\n'; content += `Generated on: ${new Date().toLocaleString('en-US')}\n`; content += '====================================\n\n'; const sortedCategories = Object.keys(toolState.categories).sort(); sortedCategories.forEach(category => { content += `CATEGORY: ${category}\n`; content += '------------------------------------\n'; toolState.categories[category].forEach(file => { content += ` - File: ${file.name}\n`; content += ` Tags: ${file.tags.join(', ') || 'None'}\n\n`; }); }); return content; }; const downloadTxtFile = () => { const content = getExportContent(); const blob = new Blob([content], { type: 'text/plain' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'file-organization-report.txt'; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); }; const downloadPdf = () => { if (typeof window.jspdf === 'undefined') { console.error("jsPDF library is not loaded."); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF(); doc.setFontSize(18); doc.text('File Organization Report', 14, 22); doc.setFontSize(11); doc.setTextColor(100); doc.text(`Generated on: ${new Date().toLocaleString('en-US')}`, 14, 30); const tableBody = []; const sortedCategories = Object.keys(toolState.categories).sort(); sortedCategories.forEach(category => { toolState.categories[category].forEach(file => { tableBody.push([category, file.name, file.tags.join(', ') || '-']); }); }); doc.autoTable({ startY: 40, head: [['Category', 'File Name', 'Tags']], body: tableBody, theme: 'striped', headStyles: { fillColor: [41, 128, 185] }, }); doc.save('file-organization-report.pdf'); }; // --- EVENT LISTENERS --- addFileBtn?.addEventListener('click', addFile); downloadTxtBtn?.addEventListener('click', downloadTxtFile); downloadPdfBtn?.addEventListener('click', downloadPdf); prevBtn?.addEventListener('click', () => changeTab(currentTab - 1)); nextBtn?.addEventListener('click', () => changeTab(currentTab + 1)); // --- INITIALIZATION --- updateNavButtons(); });
    Scroll to Top