summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrstular <rok@stular.eu>2020-06-01 20:14:59 +0200
committerrstular <rok@stular.eu>2020-06-01 20:14:59 +0200
commitaebac8bcd0e946f1e7283d8e280e301d52b8d64b (patch)
treed4b07b3b6de14695a0b3d9cb83f8abe4fe5f1c54
parentAdded UI for user-defined gradings (diff)
downloadbeziapp-aebac8bcd0e946f1e7283d8e280e301d52b8d64b.tar
beziapp-aebac8bcd0e946f1e7283d8e280e301d52b8d64b.tar.gz
beziapp-aebac8bcd0e946f1e7283d8e280e301d52b8d64b.tar.bz2
beziapp-aebac8bcd0e946f1e7283d8e280e301d52b8d64b.tar.lz
beziapp-aebac8bcd0e946f1e7283d8e280e301d52b8d64b.tar.xz
beziapp-aebac8bcd0e946f1e7283d8e280e301d52b8d64b.tar.zst
beziapp-aebac8bcd0e946f1e7283d8e280e301d52b8d64b.zip
-rw-r--r--assets/js/gsec.js8
-rwxr-xr-xdist/js/app.js2
-rw-r--r--dist/js/gsec.js3
-rwxr-xr-xdist/pages/about.html2
-rwxr-xr-xdist/sw.js4
5 files changed, 11 insertions, 8 deletions
diff --git a/assets/js/gsec.js b/assets/js/gsec.js
index 19e190f..5632949 100644
--- a/assets/js/gsec.js
+++ b/assets/js/gsec.js
@@ -273,8 +273,10 @@ 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)
+ subject = subject == null ? "" : subject[1].trim();
+ var desc = DESC_REGEX.exec(subFields[1].innerHTML);
+ desc = desc == null ? "" : desc[1];
gradings.push({
"date": dateObj,
@@ -529,7 +531,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();
diff --git a/dist/js/app.js b/dist/js/app.js
index d6f25c5..d551d22 100755
--- a/dist/js/app.js
+++ b/dist/js/app.js
@@ -3,7 +3,7 @@
const app_version = "1.0.14-beta";
-const previous_commit = "125e0a8894bcfe1b39ec6e88fbcdd2f655525650";
+const previous_commit = "a8cffc9c334e02ca962f615cc28c66634bea06aa";
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("/sw.js")
diff --git a/dist/js/gsec.js b/dist/js/gsec.js
index 8a5eff0..8736eaf 100644
--- a/dist/js/gsec.js
+++ b/dist/js/gsec.js
@@ -18,7 +18,8 @@ $.ajax({xhrFields:{withCredentials:true},crossDomain:true,url:GSE_URL+"Page_Gim/
fetchTimetable(datum=null){const SUBJECT_REGEX=/\((.+?)\)/;const ABKURZUNG_REGEX=/^(.+?) \(/;var dataToSend=datum==null?{}:{"ctl00$ContentPlaceHolder1$wkgDnevnik_edtGridSelectDate":`${datum.getDate()}.${Number(datum.getMonth()+1)}.${datum.getFullYear()}`};return new Promise((resolve)=>{var urnik={0:{},1:{},2:{},3:{},4:{},5:{},6:{}};this.postback(GSE_URL+"Page_Gim/Ucenec/DnevnikUcenec.aspx",dataToSend,null,true).then((response)=>{let parser=new DOMParser();let parsed=parser.parseFromString(response.data,"text/html");for(const urnikElement of parsed.querySelectorAll('*[id^="ctl00_ContentPlaceHolder1_wkgDnevnik_btnCell_"]')){var subFields=urnikElement.id.split("_");var period=subFields[4];var day=subFields[5];var desc=$(urnikElement).attr("title").split("\n");var subject=SUBJECT_REGEX.exec(desc[1])[1];var abkurzung=ABKURZUNG_REGEX.exec(desc[1])[1];var razred=desc[2];var teacher=desc[3];var place=desc[4];urnik[day][period]={"subject":subject,"acronym":abkurzung,"class":razred,"teacher":teacher,"place":place};}
resolve(urnik);});});}
fetchGradings(){const DESC_REGEX=/\((.+?)\)/m;const SUBJECT_REGEX=/^(.+?) \(/m;return new Promise((resolve)=>{var gradings=[];this.postback(GSE_URL+"Page_Gim/Ucenec/IzpitiUcenec.aspx",{},null,true).then((response)=>{let parser=new DOMParser();let parsed=parser.parseFromString(response.data,"text/html");var rowElements=parsed.getElementsByTagName("table")[0].getElementsByTagName("tbody")[0].getElementsByTagName("tr");for(const row of rowElements){var subFields=row.getElementsByTagName("td");var date=subFields[0].innerHTML.trim().split(".");var dateObj=new Date(date[2]+"-"+date[1]+"-"+date[0]);var rowSpan=subFields[1].getElementsByTagName("span")[0];var abkurzung="";if(rowSpan){abkurzung=rowSpan.innerHTML.trim();}
-rowSpan.remove();var subject=SUBJECT_REGEX.exec(subFields[1].innerHTML)[1].trim();var desc=DESC_REGEX.exec(subFields[1].innerHTML)[1];gradings.push({"date":dateObj,"acronym":abkurzung,"subject":subject,"description":desc});}
+rowSpan.remove();var subject=SUBJECT_REGEX.exec(subFields[1].innerHTML)
+subject=subject==null?"":subject[1].trim();var desc=DESC_REGEX.exec(subFields[1].innerHTML);desc=desc==null?"":desc[1];gradings.push({"date":dateObj,"acronym":abkurzung,"subject":subject,"description":desc});}
resolve(gradings);});});}
fetchTeachers(){const SUBJECT_REGEX=/^(.+?(?= \()|.+(?! \())/;const ABKURZUNG_REGEX=/\((.+)\)/;const DAY_REGEX=/^(.+?), /m;const PERIOD_REGEX=/, (\d+?)\. ura/;const TIME_RANGE_REGEX=/\((.+?) - (.+?)\)/;return new Promise((resolve)=>{var Teachers={};this.postback(GSE_URL+"Page_Gim/Ucenec/UciteljskiZbor.aspx",{},null,true).then((response)=>{let parser=new DOMParser();let parsed=parser.parseFromString(response.data,"text/html");var rowElements=parsed.getElementsByTagName("table")[0].getElementsByTagName("tbody")[0].getElementsByTagName("tr");for(const row of rowElements){var subFields=row.getElementsByTagName("td");var name=stripHtml(subFields[0].innerHTML);var subjectStrings=subFields[2].innerHTML.split("<br>");var subjects={};for(const subjectString of subjectStrings){var subjectName=SUBJECT_REGEX.exec(stripHtml(subjectString))[1];var abkurzung=ABKURZUNG_REGEX.exec(stripHtml(subjectString));abkurzung=abkurzung==null?subjectName:abkurzung[1];subjects[abkurzung]=subjectName;}
try{var TP={};TP.day=slDayToInt(DAY_REGEX.exec(subFields[3].innerHTML)[1]);TP.period=Number(PERIOD_REGEX.exec(subFields[3].innerHTML)[1]);var time_range_matches=TIME_RANGE_REGEX.exec(subFields[3].innerHTML);TP.from=time_range_matches[1];TP.till=time_range_matches[2];if(TP.day<0){TP=false;}}catch(error){var TP={};TP.day=slDayToInt(subFields[3].innerHTML.split(", ")[0]);TP.period=Number(subFields[3].innerHTML.split(", ").pop().split(". ura")[0]);TP.from=subFields[3].innerHTML.split("(").pop().split(")")[0].split(" - ")[0];TP.till=subFields[3].innerHTML.split("(").pop().split(")")[0].split(" - ")[1];if(TP.day<0){TP=false;}}
diff --git a/dist/pages/about.html b/dist/pages/about.html
index af5d651..b8788ee 100755
--- a/dist/pages/about.html
+++ b/dist/pages/about.html
@@ -142,7 +142,7 @@
<div class="row">
<p>
<small>
- ^HEAD 125e0a8894bcfe1b39ec6e88fbcdd2f655525650
+ ^HEAD a8cffc9c334e02ca962f615cc28c66634bea06aa
</small>
</p>
</div>
diff --git a/dist/sw.js b/dist/sw.js
index 539464c..99f2269 100755
--- a/dist/sw.js
+++ b/dist/sw.js
@@ -3,8 +3,8 @@
// Change version to cause cache refresh
-const static_cache_name = "site-static-1.0.14-beta-125e0a8";
-// commit before the latest is 125e0a8894bcfe1b39ec6e88fbcdd2f655525650
+const static_cache_name = "site-static-1.0.14-beta-a8cffc9";
+// commit before the latest is a8cffc9c334e02ca962f615cc28c66634bea06aa
// Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js
// sw.js NE SME BITI CACHAN, ker vsebuje verzijo!