Online Multi-Tab Research Organizer

Online Multi-Tab Research Organizer

Organize your research topics and notes in one place. Your data is saved locally.

No topics yet. Click the '+' button to add a new research topic.

`; return; } researchData.forEach((tabData, index) => { // Create Tab Button const tabBtn = document.createElement('button'); tabBtn.type = 'button'; tabBtn.className = `tab-btn text-sm sm:text-base font-medium text-center border rounded-t-lg py-2 px-4 ml-1 ${index === activeTabIndex ? 'active' : ''}`; tabBtn.innerHTML = ` ${tabData.title}
`; tabBtn.onclick = () => changeTab(index); tabsContainer.appendChild(tabBtn); // Create Tab Content const tabContent = document.createElement('div'); tabContent.className = `tab-content ${index === activeTabIndex ? 'active' : ''}`; tabContent.innerHTML = ``; tabContentsContainer.appendChild(tabContent); }); // Add event listener for textarea changes document.querySelectorAll('.form-textarea').forEach(textarea => { textarea.addEventListener('input', (e) => { const index = e.target.dataset.index; researchData[index].content = e.target.value; saveData(); }); }); }; window.changeTab = (index) => { if (index >= 0 && index < researchData.length) { activeTabIndex = index; render(); } }; window.addTab = () => { const newTitle = `Topic ${researchData.length + 1}`; if (researchData.some(tab => tab.title === newTitle)) { errorMessage.textContent = "A topic with this name already exists."; return; } researchData.push({ title: newTitle, content: "" }); activeTabIndex = researchData.length - 1; saveData(); render(); }; window.deleteTab = (index) => { if (confirm(`Are you sure you want to delete the topic "${researchData[index].title}"?`)) { researchData.splice(index, 1); if (activeTabIndex >= index && activeTabIndex > 0) { activeTabIndex--; } saveData(); render(); } }; window.renameTab = (index) => { const oldTitle = researchData[index].title; const newTitle = prompt("Enter a new name for this topic:", oldTitle); if (newTitle && newTitle.trim() !== "" && newTitle !== oldTitle) { if (researchData.some((tab, i) => i !== index && tab.title === newTitle)) { errorMessage.textContent = "A topic with this name already exists."; return; } researchData[index].title = newTitle.trim(); saveData(); render(); } }; const generatePdf = () => { if (researchData.length === 0) { alert("There is no content to download."); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF({ unit: 'pt', format: 'a4' }); doc.setFontSize(22); doc.text("Research Notes", 105, 40, { align: 'center' }); doc.setFontSize(12); doc.text(`Generated on: ${new Date().toLocaleDateString()}`, 105, 55, { align: 'center' }); let currentY = 80; researchData.forEach((tab, index) => { if (index > 0) { doc.addPage(); currentY = 40; } doc.setFontSize(16); doc.setFont('helvetica', 'bold'); doc.text(tab.title, 40, currentY); doc.setFontSize(11); doc.setFont('helvetica', 'normal'); const lines = doc.splitTextToSize(tab.content || "No content for this topic.", 515); // A4 width (595pt) - margins doc.text(lines, 40, currentY + 20); }); doc.save('Research_Organizer_Notes.pdf'); }; // --- EVENT LISTENERS --- addTabBtn.addEventListener('click', addTab); downloadPdfBtn.addEventListener('click', generatePdf); // --- INITIALIZATION --- loadData(); });
Scroll to Top