| 1051 | |
| 1052 | // Initialize data in localStorage if not exists |
| 1053 | function initializeData() { |
| 1054 | if (!localStorage.getItem("studentsData")) { |
| 1055 | localStorage.setItem("studentsData", JSON.stringify(sampleData.students)) |
| 1056 | } |
| 1057 | if (!localStorage.getItem("teachersData")) { |
| 1058 | localStorage.setItem("teachersData", JSON.stringify(sampleData.teachers)) |
| 1059 | } |
| 1060 | if (!localStorage.getItem("newsData")) { |
| 1061 | localStorage.setItem("newsData", JSON.stringify(sampleData.news)) |
| 1062 | } |
| 1063 | } |
| 1064 | |
| 1065 | // Load data from localStorage |
| 1066 | function loadDataFromStorage() { |