Virtual Classroom Assistant

Virtual Classroom Assistant

Your all-in-one toolkit for managing classroom activities.

Manage Student Roster

Enter one student name per line. This list will be used for the random picker and group generator.

0 students

Random Student Picker

...

Group Generator

Groups will appear here...

Export Activity

Download a summary of the generated groups and selected students.

Classroom Timer

00:00

No students were randomly selected in this session.

'; } pdfTemplate.innerHTML = `

Classroom Activity Report

Date: ${new Date().toLocaleDateString('en-US')}

Generated Groups

${groupsHtml}

Randomly Selected Students

${pickedHtml}
`; } async function generatePdf() { preparePdfContent(); const downloadBtn = document.getElementById('download-pdf-btn'); if (!downloadBtn) return; downloadBtn.innerText = 'Generating PDF...'; downloadBtn.disabled = true; const element = document.getElementById('pdf-template'); element.classList.remove('invisible', 'absolute', '-left-full'); element.style.position = 'absolute'; element.style.left = '-9999px'; try { const { jsPDF } = window.jspdf; const canvas = await html2canvas(element.querySelector('.classroom-report'), { scale: 3, backgroundColor: '#ffffff' }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save('Classroom-Activity-Report.pdf'); } catch(err) { console.error("PDF generation failed:", err); alert("Sorry, an error occurred while creating the PDF."); } finally { element.classList.add('invisible', 'absolute', '-left-full'); element.style.position = ''; element.style.left = ''; downloadBtn.innerText = 'Download Report'; downloadBtn.disabled = false; } } // --- Timer Functions --- function setTimer() { const minutes = parseInt(minutesInput.value, 10) || 0; const seconds = parseInt(secondsInput.value, 10) || 0; timerSeconds = (minutes * 60) + seconds; updateTimerDisplay(); } function updateTimerDisplay() { const min = Math.floor(timerSeconds / 60); const sec = timerSeconds % 60; timerDisplay.textContent = `${String(min).padStart(2, '0')}:${String(sec).padStart(2, '0')}`; } function toggleTimer() { if (isTimerRunning) { clearInterval(timerInterval); startPauseBtn.textContent = 'Resume'; } else { if (timerSeconds <= 0) return; timerInterval = setInterval(() => { timerSeconds--; updateTimerDisplay(); if (timerSeconds <= 0) { clearInterval(timerInterval); isTimerRunning = false; startPauseBtn.textContent = 'Start'; alert('Time is up!'); } }, 1000); startPauseBtn.textContent = 'Pause'; } isTimerRunning = !isTimerRunning; } function resetTimer() { clearInterval(timerInterval); isTimerRunning = false; timerSeconds = 0; updateTimerDisplay(); startPauseBtn.textContent = 'Start'; minutesInput.value = ''; secondsInput.value = ''; } });
Scroll to Top