summaryrefslogtreecommitdiffstats
path: root/assets
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--assets/js/gradings.js18
-rw-r--r--assets/js/gsec.js13
2 files changed, 23 insertions, 8 deletions
diff --git a/assets/js/gradings.js b/assets/js/gradings.js
index b5bf7b5..a852337 100644
--- a/assets/js/gradings.js
+++ b/assets/js/gradings.js
@@ -143,7 +143,7 @@ function gradingClickHandler(eventClickInfo) {
const modal = document.querySelectorAll(".side-modal")[0];
M.Sidenav.getInstance(modal).open();
}
-/*
+
function setupPickers() {
// Setup pickers, todo (adding an event), to be stored in messages
var date_object = new Date();
@@ -155,10 +155,9 @@ function gradingClickHandler(eventClickInfo) {
setDefaultDate: true,
firstDay: 1
}
- let instances = M.Datepicker.init(elems, options);
instances = M.Datepicker.init(elems, options);
}
-*/
+
document.addEventListener("DOMContentLoaded", () => {
checkLogin();
@@ -175,7 +174,18 @@ document.addEventListener("DOMContentLoaded", () => {
height: "parent"
});
calendar_obj.render();
- // setupPickers(); // todo (adding an event), to be stored in messages
+
+ // Modal for adding gradings
+ setupPickers(); // todo (adding an event), to be stored in messages
+ // Setup modals
+ const modal_elems = document.querySelectorAll('.modal');
+ const modal_options = {
+ onOpenStart: () => { $("#fab-new").hide() },
+ onCloseEnd: () => { $("#fab-new").show() },
+ dismissible: false
+ };
+ M.Modal.init(modal_elems, modal_options);
+
loadGradings(true);
// Setup refresh handler
$("#refresh-icon").click(() => {
diff --git a/assets/js/gsec.js b/assets/js/gsec.js
index 5632949..96ea624 100644
--- a/assets/js/gsec.js
+++ b/assets/js/gsec.js
@@ -273,8 +273,13 @@ class gsec {
}
rowSpan.remove(); // magic
- var subject = SUBJECT_REGEX.exec(subFields[1].innerHTML)
- subject = subject == null ? "" : subject[1].trim();
+
+ var subject = SUBJECT_REGEX.exec(subFields[1].innerHTML);
+ if (subject == null) {
+ continue;
+ }
+ subject = subject[1].trim();
+
var desc = DESC_REGEX.exec(subFields[1].innerHTML);
desc = desc == null ? "" : desc[1];
@@ -614,9 +619,9 @@ class gsec {
}
var tume = messageElement.getElementsByClassName("msgSubDate")[0].innerHTML.split(" ")[1];
- if(tume == null || tume.length < 1) {
+ if (tume == null || tume.length === 0) {
tume = messageElement.getElementsByClassName("msgSubDate")[0].innerHTML;
- }
+ }
var dateStringToParse = `${date[2]}-${date[1]}-${date[0]} ${tume}`;
var dateObj = new Date(Date.parse(dateStringToParse)); // "tume"!
var person = messageElement.getElementsByClassName("msgDir")[0].innerHTML;