summaryrefslogtreecommitdiffstats
path: root/assets/js
diff options
context:
space:
mode:
authorrstular <rok@stular.eu>2020-06-02 16:16:45 +0200
committerGitHub <noreply@github.com>2020-06-02 16:16:45 +0200
commitfe798bd10110471806592e7d587412c6b703e4f1 (patch)
tree4c993a985eaa072eda88e33a7647ad3600a12dc4 /assets/js
parentMerge pull request #13 from beziapp/dev (diff)
parentPreparing to merge (diff)
downloadbeziapp-fe798bd10110471806592e7d587412c6b703e4f1.tar
beziapp-fe798bd10110471806592e7d587412c6b703e4f1.tar.gz
beziapp-fe798bd10110471806592e7d587412c6b703e4f1.tar.bz2
beziapp-fe798bd10110471806592e7d587412c6b703e4f1.tar.lz
beziapp-fe798bd10110471806592e7d587412c6b703e4f1.tar.xz
beziapp-fe798bd10110471806592e7d587412c6b703e4f1.tar.zst
beziapp-fe798bd10110471806592e7d587412c6b703e4f1.zip
Diffstat (limited to 'assets/js')
-rw-r--r--assets/js/gradings.js16
-rw-r--r--assets/js/gsec.js17
2 files changed, 25 insertions, 8 deletions
diff --git a/assets/js/gradings.js b/assets/js/gradings.js
index b5bf7b5..f884bf2 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();
+
+ // 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 19e190f..96ea624 100644
--- a/assets/js/gsec.js
+++ b/assets/js/gsec.js
@@ -273,8 +273,15 @@ class gsec {
}
rowSpan.remove(); // magic
- var subject = SUBJECT_REGEX.exec(subFields[1].innerHTML)[1].trim();
- var desc = DESC_REGEX.exec(subFields[1].innerHTML)[1];
+
+ 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];
gradings.push({
"date": dateObj,
@@ -529,7 +536,7 @@ class gsec {
"__EVENTARGUMENT": "Select$" + selectId
};
- this.postback(GSE_URL+"Page_Gim/Uporabnik/Sporocila.aspx", dataToBeSent, null, true).then((response) => {
+ this.postback(GSE_URL + "Page_Gim/Uporabnik/Sporocila.aspx", dataToBeSent, null, true).then((response) => {
let parser = new DOMParser();
let parsed = parser.parseFromString(response.data, "text/html");
let subject = parsed.getElementsByClassName("msgSubjectS")[0].innerHTML.trim();
@@ -612,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;