From 98688c884e754fcc239c0983fa373b37d067505f Mon Sep 17 00:00:00 2001 From: rstular Date: Thu, 30 Jan 2020 00:14:02 +0100 Subject: Temporary inclusion/exclusion option, fixed zoom --- index.html | 2 +- js/grades.js | 21 ++++++++++++++++----- login.html | 2 +- logout.html | 2 +- pages/about.html | 8 +++++--- pages/absences.html | 2 +- pages/grades.html | 21 ++++++++++++++++++++- pages/gradings.html | 2 +- pages/privacypolicy.html | 2 +- pages/teachers.html | 2 +- pages/timetable.html | 2 +- pages/tos.html | 2 +- sw.js | 2 +- 13 files changed, 51 insertions(+), 19 deletions(-) diff --git a/index.html b/index.html index 17c56a0..4c27e9a 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - + BežiApp diff --git a/js/grades.js b/js/grades.js index 1768fb0..5c544fb 100644 --- a/js/grades.js +++ b/js/grades.js @@ -1,6 +1,8 @@ const API_ENDPOINT = "https://gimb.tk/test.php"; // const API_ENDPOINT = "http://localhost:5000/test.php"; +let checkbox_state = false; + async function checkLogin() { localforage.getItem("logged_in").then((value) => { // This code runs once the value has been loaded @@ -167,8 +169,8 @@ function displayGrades() { grade_node.appendChild(grade_node_div); - // Count the grade only if it's not temprary - if (!grade["temporary"]) { + // Count the grade only if it's not temporary or explicitly enabled + if (!grade["temporary"] || !checkbox_state) { grade_sum += grade["grade"]; grade_tot += 1; } @@ -205,9 +207,9 @@ function clearGrades() { } } -function refreshGrades() { +function refreshGrades(force) { clearGrades(); - loadGrades(true); + loadGrades(force); } function refreshClickHandlers() { @@ -252,9 +254,18 @@ document.addEventListener("DOMContentLoaded", async () => { // Setup refresh handler $("#refresh-icon").click(function () { - refreshGrades(); + refreshGrades(true); + }); + + // Setup checkbox handler + $("#permanent-grades-checkbox").change(function () { + checkbox_state = this.checked; + refreshGrades(false); }); + let elems = document.querySelectorAll('.modal'); + let instances = M.Modal.init(elems, {}); + // Setup side menu const menus = document.querySelectorAll('.side-menu'); M.Sidenav.init(menus, { edge: 'right', draggable: true }); diff --git a/login.html b/login.html index 6fe37b0..b43949d 100644 --- a/login.html +++ b/login.html @@ -2,7 +2,7 @@ - + BežiApp diff --git a/logout.html b/logout.html index bfdabcf..cf53cdd 100644 --- a/logout.html +++ b/logout.html @@ -2,7 +2,7 @@ - + BežiApp diff --git a/pages/about.html b/pages/about.html index d9e052e..f31292f 100644 --- a/pages/about.html +++ b/pages/about.html @@ -2,7 +2,7 @@ - + About @@ -71,7 +71,7 @@

BežiApp

-
Version 1.0.3-beta
+
Version 1.0.4-beta
@@ -101,9 +101,11 @@ diff --git a/pages/absences.html b/pages/absences.html index 78bfd79..ae7a23b 100644 --- a/pages/absences.html +++ b/pages/absences.html @@ -2,7 +2,7 @@ - + Absences diff --git a/pages/grades.html b/pages/grades.html index 95acd22..6332d59 100644 --- a/pages/grades.html +++ b/pages/grades.html @@ -2,7 +2,7 @@ - + Grades @@ -88,8 +88,27 @@
  • + +
    +

    +

      diff --git a/pages/gradings.html b/pages/gradings.html index 14f0694..676b5ad 100644 --- a/pages/gradings.html +++ b/pages/gradings.html @@ -2,7 +2,7 @@ - + Gradings diff --git a/pages/privacypolicy.html b/pages/privacypolicy.html index 72e0c2c..8daa469 100644 --- a/pages/privacypolicy.html +++ b/pages/privacypolicy.html @@ -2,7 +2,7 @@ - + Privacy policy diff --git a/pages/teachers.html b/pages/teachers.html index 7e869ca..6c4bc19 100644 --- a/pages/teachers.html +++ b/pages/teachers.html @@ -2,7 +2,7 @@ - + Teachers diff --git a/pages/timetable.html b/pages/timetable.html index 9d6922e..f3426f1 100644 --- a/pages/timetable.html +++ b/pages/timetable.html @@ -2,7 +2,7 @@ - + Timetable diff --git a/pages/tos.html b/pages/tos.html index e25a022..2f0304c 100644 --- a/pages/tos.html +++ b/pages/tos.html @@ -2,7 +2,7 @@ - + Terms and Conditions diff --git a/sw.js b/sw.js index 0e5ef4e..af54e19 100644 --- a/sw.js +++ b/sw.js @@ -1,5 +1,5 @@ // Change version to cause cache refresh -const static_cache_name = "site-static-v1.0.3"; +const static_cache_name = "site-static-v1.0.4"; // Got them with du -a and minor cleaning up const assets = [ "/img/avatars/asijanec.png", -- cgit v1.2.3