diff options
Diffstat (limited to '')
-rw-r--r-- | js/about.js | 20 | ||||
-rw-r--r-- | js/app.js | 2 | ||||
-rw-r--r-- | js/gradings.js | 2 | ||||
-rw-r--r-- | js/login.js | 2 | ||||
-rw-r--r-- | js/logout.js | 3 | ||||
-rw-r--r-- | js/privacypolicy.js | 5 | ||||
-rw-r--r-- | js/tos.js | 5 |
7 files changed, 36 insertions, 3 deletions
diff --git a/js/about.js b/js/about.js new file mode 100644 index 0000000..836ffaf --- /dev/null +++ b/js/about.js @@ -0,0 +1,20 @@ +async function checkLogin() { + localforage.getItem("logged_in").then(function (value) { + // This code runs once the value has been loaded + // from the offline store. + if (value !== true) { + window.location.replace("/index.html"); + } + }).catch(function (err) { + // This code runs if there were any errors + console.log(err); + }); +} + +document.addEventListener("DOMContentLoaded", () => { + checkLogin(); + + // Setup side menu + const menus = document.querySelectorAll(".side-menu"); + M.Sidenav.init(menus, { edge: "right", draggable: true }); +});
\ No newline at end of file @@ -1,5 +1,5 @@ if ("serviceWorker" in navigator) { navigator.serviceWorker.register("/sw.js") - .then(() => console.log("Service worker registered")) + .then(() => {}) .catch((err) => console.log("Service worker registration failed", err)); }
\ No newline at end of file diff --git a/js/gradings.js b/js/gradings.js index dde8900..8902a5d 100644 --- a/js/gradings.js +++ b/js/gradings.js @@ -192,7 +192,7 @@ document.addEventListener("DOMContentLoaded", () => { }); calendar_obj.render(); - loadGradings(true); + loadGradings(); // Setup refresh handler $("#refresh-icon").click(() => { diff --git a/js/login.js b/js/login.js index 4cbd57c..ff8d4ed 100644 --- a/js/login.js +++ b/js/login.js @@ -49,7 +49,7 @@ function login() { Promise.all(promises_to_run).then(function () { window.location.replace("/pages/teachers.html"); }); - + } }, diff --git a/js/logout.js b/js/logout.js new file mode 100644 index 0000000..8d2df62 --- /dev/null +++ b/js/logout.js @@ -0,0 +1,3 @@ +localforage.clear().then(() => { + window.location.replace("/index.html"); +});
\ No newline at end of file diff --git a/js/privacypolicy.js b/js/privacypolicy.js new file mode 100644 index 0000000..9955abf --- /dev/null +++ b/js/privacypolicy.js @@ -0,0 +1,5 @@ +document.addEventListener("DOMContentLoaded", () => { + $("#nav-home-button").click(() => { + window.location.replace("/index.html"); + }); +});
\ No newline at end of file diff --git a/js/tos.js b/js/tos.js new file mode 100644 index 0000000..9955abf --- /dev/null +++ b/js/tos.js @@ -0,0 +1,5 @@ +document.addEventListener("DOMContentLoaded", () => { + $("#nav-home-button").click(() => { + window.location.replace("/index.html"); + }); +});
\ No newline at end of file |