Reading Strategy Sheet Generator

Reading Strategy Sheet Generator

Why are you reading this text?

Steps Before You Read

Steps While You Read

Steps After You Finish Reading

Review your generated reading strategy sheet below.

Click "Next" or "Previous" to refresh this preview.

Reader: ${escapeHTML(data.reader)}

Goal: ${escapeHTML(data.goal)}

Phase 1: Before Reading

    ${strategies.pre.length > 0 ? strategies.pre.map(s => `
  • ${escapeHTML(s)}
  • `).join('') : '
  • No specific pre-reading steps selected.
  • '}

Phase 2: During Reading

    ${strategies.during.length > 0 ? strategies.during.map(s => `
  • ${escapeHTML(s)}
  • `).join('') : '
  • No specific during-reading steps selected.
  • '}

Phase 3: After Reading

    ${strategies.after.length > 0 ? strategies.after.map(s => `
  • ${escapeHTML(s)}
  • `).join('') : '
  • No specific after-reading steps selected.
  • '}
`; summaryPreview.innerHTML = html; }; const getTxtContent = () => { const strategies = getSelectedStrategies(); const data = { title: inputs.title.value || "Untitled Document", goal: inputs.goal.value || "No goal defined.", reader: inputs.reader.value || "Reader/Class" }; let content = "READING STRATEGY SHEET\n"; content += "========================================\n\n"; content += `DOCUMENT: ${data.title}\n`; content += `READER: ${data.reader}\n`; content += `GOAL: ${data.goal}\n\n`; content += "PHASE 1: BEFORE READING\n"; content += "---------------------------\n"; if (strategies.pre.length > 0) { strategies.pre.forEach((s, index) => { content += `${index + 1}. ${s}\n`; }); } else { content += "No steps selected.\n"; } content += "\n"; content += "PHASE 2: DURING READING\n"; content += "---------------------------\n"; if (strategies.during.length > 0) { strategies.during.forEach((s, index) => { content += `${index + 1}. ${s}\n`; }); } else { content += "No steps selected.\n"; } content += "\n"; content += "PHASE 3: AFTER READING\n"; content += "---------------------------\n"; if (strategies.after.length > 0) { strategies.after.forEach((s, index) => { content += `${index + 1}. ${s}\n`; }); } else { content += "No steps selected.\n"; } return content; }; const downloadTxt = () => { const txtContent = getTxtContent(); const blob = new Blob([txtContent], { type: 'text/plain;charset=utf-8' }); const a = document.createElement('a'); a.href = URL.createObjectURL(blob); a.download = `reading_strategy_${inputs.title.value.substring(0, 20) || 'sheet'}.txt`; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(a.href); }; const downloadPDF = () => { if (typeof window.jspdf === 'undefined' || typeof window.jspdf.jsPDF === 'undefined') { alert('Error: jsPDF library not loaded.'); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF('p', 'mm', 'a4'); const data = { title: inputs.title.value || "Untitled Document", goal: inputs.goal.value || "No goal defined.", reader: inputs.reader.value || "Reader/Class" }; const strategies = getSelectedStrategies(); const margin = 20; const pageWidth = doc.internal.pageSize.getWidth(); const usableWidth = pageWidth - (margin * 2); let yPos = 25; const addTitle = (text, size, style, color, align = 'left') => { doc.setFontSize(size); doc.setFont(undefined, style); doc.setTextColor(color[0], color[1], color[2]); doc.text(text, pageWidth / 2, yPos, { align: 'center' }); yPos += size / 2 + 5; }; const addSectionTitle = (text) => { doc.setFontSize(14); doc.setFont(undefined, 'bold'); doc.setTextColor(22, 160, 133); // Teal doc.text(text, margin, yPos); doc.setDrawColor(26, 188, 156); doc.setLineWidth(0.5); doc.line(margin, yPos + 1, pageWidth - margin, yPos + 1); yPos += 8; }; const addList = (items) => { if (items.length === 0) { doc.setFontSize(11); doc.setFont(undefined, 'italic'); doc.setTextColor(108, 117, 125); doc.text('No steps selected for this phase.', margin + 5, yPos); yPos += 5; return; } items.forEach((item, index) => { if (yPos > 280) { // Check for page break doc.addPage(); yPos = 20; } doc.setFontSize(11); doc.setFont(undefined, 'normal'); doc.setTextColor(52, 73, 94); const prefix = `${index + 1}. `; const itemText = prefix + item; const splitText = doc.splitTextToSize(itemText, usableWidth); doc.text(splitText, margin, yPos); yPos += (splitText.length * 5) + 3; }); yPos += 5; }; // --- Build PDF Document --- addTitle("Reading Strategy Sheet", 18, 'bold', [44, 62, 80]); // Context doc.setFontSize(11); doc.setFont(undefined, 'normal'); doc.setTextColor(52, 73, 94); doc.text(`Document: ${data.title}`, margin, yPos); doc.text(`Reader/Class: ${data.reader}`, margin + (usableWidth / 2) + 5, yPos); yPos += 5; doc.text(`Goal: ${data.goal}`, margin, yPos); yPos += 10; // Phases addSectionTitle("Phase 1: Before Reading"); addList(strategies.pre); addSectionTitle("Phase 2: During Reading"); addList(strategies.during); addSectionTitle("Phase 3: After Reading"); addList(strategies.after); doc.save(`reading_strategy_sheet.pdf`); }; // --- Event Listeners --- // Tab Buttons tabButtons.forEach((btn, index) => { btn.addEventListener('click', () => showTab(index + 1)); }); // Next/Prev Navigation nextBtn.addEventListener('click', () => showTab(currentTab + 1)); prevBtn.addEventListener('click', () => showTab(currentTab - 1)); // Tab 5 Actions downloadPdfBtn.addEventListener('click', downloadPDF); downloadTxtBtn.addEventListener('click', downloadTxt); // --- Initialization --- showTab(1); // Set initial state });
Scroll to Top