summaryrefslogtreecommitdiffstats
path: root/assets
diff options
context:
space:
mode:
authorrstular <rok@stular.eu>2020-06-01 20:27:31 +0200
committerrstular <rok@stular.eu>2020-06-01 20:27:31 +0200
commit578e093077032d6f17abb619a2471c9a4490db79 (patch)
tree695efc6ad02c4bd667661f149ae5189ee0786a9f /assets
parentgsec bug fix - regex may return null (diff)
downloadbeziapp-578e093077032d6f17abb619a2471c9a4490db79.tar
beziapp-578e093077032d6f17abb619a2471c9a4490db79.tar.gz
beziapp-578e093077032d6f17abb619a2471c9a4490db79.tar.bz2
beziapp-578e093077032d6f17abb619a2471c9a4490db79.tar.lz
beziapp-578e093077032d6f17abb619a2471c9a4490db79.tar.xz
beziapp-578e093077032d6f17abb619a2471c9a4490db79.tar.zst
beziapp-578e093077032d6f17abb619a2471c9a4490db79.zip
Diffstat (limited to 'assets')
-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;