Online Flashcard Spaced Repetition Tool

Online Flashcard Spaced Repetition Tool

Add a New Card

Current Deck

You've reviewed all due cards for today. Come back tomorrow for more!

`; studyControls.style.display = 'none'; } } window.flipCard = function() { document.getElementById('current-flashcard').classList.add('is-flipped'); document.getElementById('flip-button').style.display = 'none'; document.getElementById('recall-buttons').classList.remove('hidden'); }; window.handleRecall = function(rating) { // rating: 0=Hard, 1=Good, 2=Easy if (!currentCard) return; if (rating === 0) { // Hard currentCard.level = 0; } else { currentCard.level++; } let intervalDays; if (rating === 0) { // Hard, review again in 10 minutes (for simplicity, we'll make it due tomorrow) intervalDays = 1; } else if (rating === 1) { // Good intervalDays = Math.pow(2, currentCard.level); } else { // Easy intervalDays = Math.pow(2, currentCard.level + 1); } const newDueDate = new Date(); newDueDate.setDate(newDueDate.getDate() + intervalDays); currentCard.dueDate = newDueDate.toISOString(); saveDeck(); showNextCard(); }; // --- Tab Logic --- window.changeTab = function(tabIndex) { const tabs = document.querySelectorAll('.tab'); const tabContents = document.querySelectorAll('.tab-content'); tabs[currentTabIndex].classList.remove('active'); tabContents[currentTabIndex].classList.remove('active'); currentTabIndex = tabIndex; tabs[currentTabIndex].classList.add('active'); tabContents[currentTabIndex].classList.add('active'); if (tabIndex === 0) { // Study Session startStudySession(); } else { // Manage Deck renderCardList(); } }; // --- PDF Download --- window.downloadPDF = function() { if (deck.length === 0) { alert("Your deck is empty. Add some cards before downloading."); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF({ unit: 'pt', format: 'a4' }); let yPosition = 40; const leftMargin = 40; const usableWidth = doc.internal.pageSize.getWidth() - (2 * leftMargin); doc.setFontSize(18); doc.setFont('helvetica', 'bold'); doc.text("Flashcard Deck", doc.internal.pageSize.getWidth() / 2, yPosition, { align: 'center' }); yPosition += 40; deck.forEach((card, index) => { if (yPosition > doc.internal.pageSize.getHeight() - 100) { doc.addPage(); yPosition = 40; } // Card Front doc.setFontSize(12); doc.setFont('helvetica', 'bold'); let frontText = doc.splitTextToSize(`Front: ${card.front}`, usableWidth); doc.text(frontText, leftMargin, yPosition); yPosition += frontText.length * 15; // Card Back doc.setFontSize(11); doc.setFont('helvetica', 'normal'); let backText = doc.splitTextToSize(`Back: ${card.back}`, usableWidth); doc.text(backText, leftMargin + 10, yPosition); yPosition += backText.length * 14; // Separator if (index < deck.length - 1) { yPosition += 10; doc.setDrawColor(200); doc.line(leftMargin, yPosition, leftMargin + usableWidth, yPosition); yPosition += 20; } }); doc.save('flashcard_deck.pdf'); }; // Initial Load loadDeck(); startStudySession(); });
Scroll to Top