-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudent-notes.js
More file actions
36 lines (32 loc) · 1.4 KB
/
Copy pathstudent-notes.js
File metadata and controls
36 lines (32 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
document.addEventListener('DOMContentLoaded', function() {
loadStudentNotes();
});
function loadStudentNotes() {
const notes = JSON.parse(localStorage.getItem('teacherNotes') || '[]');
const container = document.getElementById('studentNotesList');
const searchVal = document.getElementById('noteSearch')?.value.toLowerCase() || '';
const filtered = notes.filter(n =>
n.title.toLowerCase().includes(searchVal) ||
n.subject.toLowerCase().includes(searchVal)
);
if (filtered.length === 0) {
container.innerHTML = '<div class="empty-state"><p>No notes available yet.</p></div>';
return;
}
container.innerHTML = filtered.map(note => `
<div class="note-card">
<div class="note-info">
<h3>${note.title}</h3>
<p>${note.subject} · ${note.teacher} · ${note.time}</p>
${note.content ? `<p class="note-content">${note.content}</p>` : ''}
</div>
<div style="display:flex;flex-direction:column;gap:8px;align-items:flex-end;">
${note.fileData ? `
<a href="${note.fileData}" download="${note.fileName}" class="btn-outline"
style="padding:6px 14px;font-size:12px;text-decoration:none;white-space:nowrap;">
⬇️ Download
</a>` : ''}
</div>
</div>
`).join('');
}