From 58ab0d4c8a33919740a35d1223f31c12d783f599 Mon Sep 17 00:00:00 2001 From: rstular Date: Mon, 1 Jun 2020 20:14:59 +0200 Subject: gsec bug fix - regex may return null --- assets/js/gsec.js | 8 +++++--- dist/js/app.js | 2 +- dist/js/gsec.js | 3 ++- dist/pages/about.html | 2 +- dist/sw.js | 4 ++-- 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 40c5cf2..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 = "c40b1bd1b0c465663eef509464e3807019727caf"; +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("
");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 c1e9dfb..b8788ee 100755 --- a/dist/pages/about.html +++ b/dist/pages/about.html @@ -142,7 +142,7 @@

- ^HEAD c40b1bd1b0c465663eef509464e3807019727caf + ^HEAD a8cffc9c334e02ca962f615cc28c66634bea06aa

diff --git a/dist/sw.js b/dist/sw.js index d0b5964..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-c40b1bd"; -// commit before the latest is c40b1bd1b0c465663eef509464e3807019727caf +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! -- cgit v1.2.3 From 4c43b6c615e18ec3f59c9b886775e6603a0f119f Mon Sep 17 00:00:00 2001 From: rstular Date: Mon, 1 Jun 2020 20:27:31 +0200 Subject: gsec bug fix (subject must not be null), UI fix --- assets/js/gradings.js | 18 ++++++++++++++---- assets/js/gsec.js | 13 +++++++++---- dist/js/app.js | 2 +- dist/js/gradings.js | 4 +++- dist/js/gsec.js | 6 +++--- dist/pages/about.html | 2 +- dist/sw.js | 4 ++-- 7 files changed, 33 insertions(+), 16 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; diff --git a/dist/js/app.js b/dist/js/app.js index d551d22..6daa06c 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 = "a8cffc9c334e02ca962f615cc28c66634bea06aa"; +const previous_commit = "aebac8bcd0e946f1e7283d8e280e301d52b8d64b"; if ("serviceWorker" in navigator) { navigator.serviceWorker.register("/sw.js") diff --git a/dist/js/gradings.js b/dist/js/gradings.js index 172858c..017e4e6 100644 --- a/dist/js/gradings.js +++ b/dist/js/gradings.js @@ -11,4 +11,6 @@ month_str=month_str.toString().padStart(2,"0");let day_str=date.getDate();day_st async function loadGradings(force_refresh=false){setLoading(true);let promises_to_run=[localforage.getItem("username").then((value)=>{username=value;}),localforage.getItem("password").then((value)=>{password=value;}),localforage.getItem("gradings").then((value)=>{gradings=value;})];await Promise.all(promises_to_run);if(gradings==null||gradings==[]||gradings==-1||force_refresh){try{let gsecInstance=new gsec();await gsecInstance.login(username,password);gsecInstance.fetchGradings().then((value)=>{gradings=value;localforage.setItem("gradings",value).then(()=>{displayData();setLoading(false);});setLoading(false);}).catch((err)=>{gsecErrorHandlerUI(err);setLoading(false);});}catch(err){gsecErrorHandlerUI(err);setLoading(false);}}else{displayData();setLoading(false);}} function displayData(){let transformed_gradings=[];gradings.forEach((element,index)=>{let bg_color=getHexColorFromString(element["acronym"]);let fg_color=getForegroundFromBackground(bg_color);let grading_object={start:element["date"].toISOString().substring(0,10),title:element["acronym"],id:index.toString(),backgroundColor:bg_color,textColor:fg_color};transformed_gradings.push(grading_object);});calendar_obj.removeAllEvents();calendar_obj.addEventSource(transformed_gradings);} function gradingClickHandler(eventClickInfo){let grading_id=parseInt(eventClickInfo.event.id);let grading_subject=gradings[grading_id]["subject"];let grading_date_obj=gradings[grading_id]["date"];let grading_date=dateString.longFormatted(grading_date_obj);let grading_description=gradings[grading_id]["description"];$("#grading-subject").text(grading_subject);$("#grading-date").text(grading_date);$("#grading-description").text(grading_description);const modal=document.querySelectorAll(".side-modal")[0];M.Sidenav.getInstance(modal).open();} -document.addEventListener("DOMContentLoaded",()=>{checkLogin();var calendarEl=document.getElementById("calendar");calendar_obj=new FullCalendar.Calendar(calendarEl,{firstDay:1,plugins:["dayGrid"],defaultDate:getDateString(),navLinks:false,editable:false,events:[],eventClick:gradingClickHandler,height:"parent"});calendar_obj.render();loadGradings(true);$("#refresh-icon").click(()=>{loadGradings(true);});const menus=document.querySelectorAll(".side-menu");M.Sidenav.init(menus,{edge:"right",draggable:true});const modals=document.querySelectorAll('.side-modal');M.Sidenav.init(modals,{edge:'left',draggable:false});}); \ No newline at end of file +function setupPickers(){var date_object=new Date();let elems=document.querySelectorAll('#datepicker-add');let options={autoClose:true,format:"dd.mm.yyyy",defaultDate:date_object,setDefaultDate:true,firstDay:1} +instances=M.Datepicker.init(elems,options);} +document.addEventListener("DOMContentLoaded",()=>{checkLogin();var calendarEl=document.getElementById("calendar");calendar_obj=new FullCalendar.Calendar(calendarEl,{firstDay:1,plugins:["dayGrid"],defaultDate:getDateString(),navLinks:false,editable:false,events:[],eventClick:gradingClickHandler,height:"parent"});calendar_obj.render();setupPickers();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);$("#refresh-icon").click(()=>{loadGradings(true);});const menus=document.querySelectorAll(".side-menu");M.Sidenav.init(menus,{edge:"right",draggable:true});const modals=document.querySelectorAll('.side-modal');M.Sidenav.init(modals,{edge:'left',draggable:false});}); \ No newline at end of file diff --git a/dist/js/gsec.js b/dist/js/gsec.js index 8736eaf..7925d00 100644 --- a/dist/js/gsec.js +++ b/dist/js/gsec.js @@ -18,8 +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) -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});} +rowSpan.remove();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,"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("
");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;}} @@ -45,7 +45,7 @@ resolve(currentPage);});});} fetchMessagesList(category=GSEC_MSGTYPE_RECEIVED,pageNumber=1,outputResponse=false){const DATE_REGEX=/(\d+?).(\d+?).(\d+?) /;var msgCategory=GSEC_MSGTYPES[category];var messages=[];var requestURI=GSE_URL+"Page_Gim/Uporabnik/Sporocila.aspx";return new Promise((resolve)=>{var dataToBeSent={"ctl00$ContentPlaceHolder1$ddlPrikaz":msgCategory,"__EVENTARGUMENT":"Page$"+pageNumber,"__EVENTTARGET":"ctl00$ContentPlaceHolder1$gvwSporocila"};this.postback(requestURI,dataToBeSent,null,true).then((response)=>{if(outputResponse===true){response.url=requestURI;resolve(response);} let parser=new DOMParser();let parsed=parser.parseFromString(response.data,"text/html");let messageElements=parsed.getElementById("ctl00_ContentPlaceHolder1_gvwSporocila").getElementsByTagName("tbody")[0].getElementsByTagName("td");for(const messageElement of messageElements){let msgId=messageElement.getElementsByTagName("input")[0].value;var date=DATE_REGEX.exec(messageElement.getElementsByClassName("msgSubDate")[0].innerHTML);var today=new Date();if(date[3]==undefined||date[2].length<1){date[3]=today.getFullYear();} if(date[2]==undefined||date[2].length<1){date[2]=today.getMonth()+1;date[1]=today.getDate();} -var tume=messageElement.getElementsByClassName("msgSubDate")[0].innerHTML.split(" ")[1];if(tume==null||tume.length<1){tume=messageElement.getElementsByClassName("msgSubDate")[0].innerHTML;} +var tume=messageElement.getElementsByClassName("msgSubDate")[0].innerHTML.split(" ")[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));var person=messageElement.getElementsByClassName("msgDir")[0].innerHTML;var subject=messageElement.getElementsByClassName("msgSubject")[0].innerHTML;messages.push({"date":dateObj,"sender":person,"subject":subject,"msgId":msgId});} resolve(messages);});});} fetchMessage(category=GSEC_MSGTYPE_RECEIVED,pageNumber=1,messageNumberOnPage=0){const TIME_REGEX=/ \(.+ (.+?)\)/;const DATE_REGEX=/ \((\d+?).(\d+?).(\d+?) /;const SENDER_REGEX=/^(.+?) \(/;return new Promise((resolve)=>{this.fetchMessagesList(category,pageNumber,true).then((value)=>{this.parseAndPost(value.data,{"__EVENTTARGET":"ctl00$ContentPlaceHolder1$gvwSporocila","__EVENTARGUMENT":"Select$"+messageNumberOnPage},null,value.url).then((response)=>{let parser=new DOMParser();let parsed=parser.parseFromString(response.data,"text/html");let subject=parsed.getElementsByClassName("msgSubjectS")[0].innerHTML.trim();let body=parsed.getElementsByClassName("gCursorAuto")[0].innerHTML.trim();let sender=SENDER_REGEX.exec(parsed.querySelectorAll("[id$=Label7]")[0].innerHTML)[1];let recipient=parsed.querySelectorAll("[id$=Label8]")[0].innerHTML;var date=DATE_REGEX.exec(parsed.querySelectorAll("[id$=Label7]")[0].innerHTML);var tume=TIME_REGEX.exec(parsed.querySelectorAll("[id$=Label7]")[0].innerHTML)[1];var dateObj=new Date(Date.parse(`${date[3]}-${date[2]}-${date[1]} ${tume}`));var msgId=parsed.getElementById("ctl00_ContentPlaceHolder1_hfIdSporocilo").getAttribute("value");var message={"subject":subject,"body":body,"sender":sender,"recipient":recipient,"date":dateObj,"msgId":msgId};resolve(message);});});});}} \ No newline at end of file diff --git a/dist/pages/about.html b/dist/pages/about.html index b8788ee..af98a69 100755 --- a/dist/pages/about.html +++ b/dist/pages/about.html @@ -142,7 +142,7 @@

- ^HEAD a8cffc9c334e02ca962f615cc28c66634bea06aa + ^HEAD aebac8bcd0e946f1e7283d8e280e301d52b8d64b

diff --git a/dist/sw.js b/dist/sw.js index 99f2269..bcbefa9 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-a8cffc9"; -// commit before the latest is a8cffc9c334e02ca962f615cc28c66634bea06aa +const static_cache_name = "site-static-1.0.14-beta-aebac8b"; +// commit before the latest is aebac8bcd0e946f1e7283d8e280e301d52b8d64b // Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js // sw.js NE SME BITI CACHAN, ker vsebuje verzijo! -- cgit v1.2.3 From 57c561748c06b3351031137e9e36595738c2073f Mon Sep 17 00:00:00 2001 From: rstular Date: Tue, 2 Jun 2020 16:01:05 +0200 Subject: Github actions fix --- .github/workflows/ci-deploy.yml | 4 ++-- dist/js/app.js | 4 ++++ dist/pages/about.html | 2 +- dist/sw.js | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-deploy.yml b/.github/workflows/ci-deploy.yml index 505cf14..b36be84 100644 --- a/.github/workflows/ci-deploy.yml +++ b/.github/workflows/ci-deploy.yml @@ -22,8 +22,8 @@ jobs: ref: master - name: Replace files run: | - rm -r * - mv /tmp/dist/* . + rm -r .[!.]* + mv /tmp/dist/.[!.]* . - name: Commit files run: | git config --local user.email "action@github.com" diff --git a/dist/js/app.js b/dist/js/app.js index 6daa06c..339215b 100755 --- a/dist/js/app.js +++ b/dist/js/app.js @@ -3,7 +3,11 @@ const app_version = "1.0.14-beta"; +<<<<<<< HEAD const previous_commit = "aebac8bcd0e946f1e7283d8e280e301d52b8d64b"; +======= +const previous_commit = "35b595f806f99ca18365d511ab820ab818da348d"; +>>>>>>> f06c121... Github actions fix if ("serviceWorker" in navigator) { navigator.serviceWorker.register("/sw.js") diff --git a/dist/pages/about.html b/dist/pages/about.html index af98a69..6405a1d 100755 --- a/dist/pages/about.html +++ b/dist/pages/about.html @@ -142,7 +142,7 @@

- ^HEAD aebac8bcd0e946f1e7283d8e280e301d52b8d64b + ^HEAD 35b595f806f99ca18365d511ab820ab818da348d

diff --git a/dist/sw.js b/dist/sw.js index bcbefa9..9c15e74 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-aebac8b"; -// commit before the latest is aebac8bcd0e946f1e7283d8e280e301d52b8d64b +const static_cache_name = "site-static-1.0.14-beta-35b595f"; +// commit before the latest is 35b595f806f99ca18365d511ab820ab818da348d // Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js // sw.js NE SME BITI CACHAN, ker vsebuje verzijo! -- cgit v1.2.3 From d766f5af2b59ede34479dcce54b368c3bf816d2b Mon Sep 17 00:00:00 2001 From: rstular Date: Tue, 2 Jun 2020 16:07:57 +0200 Subject: Preparing to merge --- assets/js/gradings.js | 18 +++++++++--------- dist/js/app.js | 6 +----- dist/js/gradings.js | 2 +- dist/pages/about.html | 2 +- dist/sw.js | 4 ++-- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/assets/js/gradings.js b/assets/js/gradings.js index a852337..f884bf2 100644 --- a/assets/js/gradings.js +++ b/assets/js/gradings.js @@ -176,15 +176,15 @@ document.addEventListener("DOMContentLoaded", () => { 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); + // 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 diff --git a/dist/js/app.js b/dist/js/app.js index 339215b..623d86d 100755 --- a/dist/js/app.js +++ b/dist/js/app.js @@ -3,11 +3,7 @@ const app_version = "1.0.14-beta"; -<<<<<<< HEAD -const previous_commit = "aebac8bcd0e946f1e7283d8e280e301d52b8d64b"; -======= -const previous_commit = "35b595f806f99ca18365d511ab820ab818da348d"; ->>>>>>> f06c121... Github actions fix +const previous_commit = "f06c1210549f0e6c81b72c6f51b811304e8cd7c4"; if ("serviceWorker" in navigator) { navigator.serviceWorker.register("/sw.js") diff --git a/dist/js/gradings.js b/dist/js/gradings.js index 017e4e6..b9b3d5c 100644 --- a/dist/js/gradings.js +++ b/dist/js/gradings.js @@ -13,4 +13,4 @@ function displayData(){let transformed_gradings=[];gradings.forEach((element,ind function gradingClickHandler(eventClickInfo){let grading_id=parseInt(eventClickInfo.event.id);let grading_subject=gradings[grading_id]["subject"];let grading_date_obj=gradings[grading_id]["date"];let grading_date=dateString.longFormatted(grading_date_obj);let grading_description=gradings[grading_id]["description"];$("#grading-subject").text(grading_subject);$("#grading-date").text(grading_date);$("#grading-description").text(grading_description);const modal=document.querySelectorAll(".side-modal")[0];M.Sidenav.getInstance(modal).open();} function setupPickers(){var date_object=new Date();let elems=document.querySelectorAll('#datepicker-add');let options={autoClose:true,format:"dd.mm.yyyy",defaultDate:date_object,setDefaultDate:true,firstDay:1} instances=M.Datepicker.init(elems,options);} -document.addEventListener("DOMContentLoaded",()=>{checkLogin();var calendarEl=document.getElementById("calendar");calendar_obj=new FullCalendar.Calendar(calendarEl,{firstDay:1,plugins:["dayGrid"],defaultDate:getDateString(),navLinks:false,editable:false,events:[],eventClick:gradingClickHandler,height:"parent"});calendar_obj.render();setupPickers();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);$("#refresh-icon").click(()=>{loadGradings(true);});const menus=document.querySelectorAll(".side-menu");M.Sidenav.init(menus,{edge:"right",draggable:true});const modals=document.querySelectorAll('.side-modal');M.Sidenav.init(modals,{edge:'left',draggable:false});}); \ No newline at end of file +document.addEventListener("DOMContentLoaded",()=>{checkLogin();var calendarEl=document.getElementById("calendar");calendar_obj=new FullCalendar.Calendar(calendarEl,{firstDay:1,plugins:["dayGrid"],defaultDate:getDateString(),navLinks:false,editable:false,events:[],eventClick:gradingClickHandler,height:"parent"});calendar_obj.render();loadGradings(true);$("#refresh-icon").click(()=>{loadGradings(true);});const menus=document.querySelectorAll(".side-menu");M.Sidenav.init(menus,{edge:"right",draggable:true});const modals=document.querySelectorAll('.side-modal');M.Sidenav.init(modals,{edge:'left',draggable:false});}); \ No newline at end of file diff --git a/dist/pages/about.html b/dist/pages/about.html index 6405a1d..f1785c7 100755 --- a/dist/pages/about.html +++ b/dist/pages/about.html @@ -142,7 +142,7 @@

- ^HEAD 35b595f806f99ca18365d511ab820ab818da348d + ^HEAD f06c1210549f0e6c81b72c6f51b811304e8cd7c4

diff --git a/dist/sw.js b/dist/sw.js index 9c15e74..55c43c0 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-35b595f"; -// commit before the latest is 35b595f806f99ca18365d511ab820ab818da348d +const static_cache_name = "site-static-1.0.14-beta-f06c121"; +// commit before the latest is f06c1210549f0e6c81b72c6f51b811304e8cd7c4 // Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js // sw.js NE SME BITI CACHAN, ker vsebuje verzijo! -- cgit v1.2.3 From cf67b4d0f30509d854545accac830928fd825a8a Mon Sep 17 00:00:00 2001 From: rstular Date: Tue, 2 Jun 2020 16:21:34 +0200 Subject: Pipeline bug fix --- .github/workflows/ci-deploy.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-deploy.yml b/.github/workflows/ci-deploy.yml index b36be84..cee1ed9 100644 --- a/.github/workflows/ci-deploy.yml +++ b/.github/workflows/ci-deploy.yml @@ -22,12 +22,12 @@ jobs: ref: master - name: Replace files run: | - rm -r .[!.]* + rm -r * mv /tmp/dist/.[!.]* . - name: Commit files run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub CI Action" + git config --global user.email "action@github.com" + git config --global user.name "GitHub CI Action" git add -A git commit -m "Mirror change from release" - name: Push changes -- cgit v1.2.3 From dcfb7ed020a43224d77db61604a087aa441d5e52 Mon Sep 17 00:00:00 2001 From: rstular Date: Tue, 2 Jun 2020 16:25:38 +0200 Subject: Another pipeline bug fix --- .github/workflows/ci-deploy.yml | 1 + dist/js/app.js | 2 +- dist/pages/about.html | 2 +- dist/sw.js | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-deploy.yml b/.github/workflows/ci-deploy.yml index cee1ed9..69ab464 100644 --- a/.github/workflows/ci-deploy.yml +++ b/.github/workflows/ci-deploy.yml @@ -24,6 +24,7 @@ jobs: run: | rm -r * mv /tmp/dist/.[!.]* . + mv /tmp/dist/* . - name: Commit files run: | git config --global user.email "action@github.com" diff --git a/dist/js/app.js b/dist/js/app.js index 623d86d..53115c0 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 = "f06c1210549f0e6c81b72c6f51b811304e8cd7c4"; +const previous_commit = "ab8e40cac16a1146fab72dffb8922165b097f730"; if ("serviceWorker" in navigator) { navigator.serviceWorker.register("/sw.js") diff --git a/dist/pages/about.html b/dist/pages/about.html index f1785c7..748d16c 100755 --- a/dist/pages/about.html +++ b/dist/pages/about.html @@ -142,7 +142,7 @@

- ^HEAD f06c1210549f0e6c81b72c6f51b811304e8cd7c4 + ^HEAD ab8e40cac16a1146fab72dffb8922165b097f730

diff --git a/dist/sw.js b/dist/sw.js index 55c43c0..c3e0111 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-f06c121"; -// commit before the latest is f06c1210549f0e6c81b72c6f51b811304e8cd7c4 +const static_cache_name = "site-static-1.0.14-beta-ab8e40c"; +// commit before the latest is ab8e40cac16a1146fab72dffb8922165b097f730 // Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js // sw.js NE SME BITI CACHAN, ker vsebuje verzijo! -- cgit v1.2.3 From c076c0a44d25ec99f6c3081fe96205399f1be653 Mon Sep 17 00:00:00 2001 From: rstular Date: Tue, 2 Jun 2020 16:32:25 +0200 Subject: Pipeline fix #3 --- .github/workflows/ci-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-deploy.yml b/.github/workflows/ci-deploy.yml index 69ab464..9dbb540 100644 --- a/.github/workflows/ci-deploy.yml +++ b/.github/workflows/ci-deploy.yml @@ -22,7 +22,7 @@ jobs: ref: master - name: Replace files run: | - rm -r * + rm -r * || true mv /tmp/dist/.[!.]* . mv /tmp/dist/* . - name: Commit files -- cgit v1.2.3 From aea3a2b4f7f57ad3e6d8e22989ad454c97c0e91c Mon Sep 17 00:00:00 2001 From: rstular Date: Tue, 2 Jun 2020 16:42:29 +0200 Subject: Pipeline bug fix no. 4 --- .github/workflows/ci-deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-deploy.yml b/.github/workflows/ci-deploy.yml index 9dbb540..6a160b4 100644 --- a/.github/workflows/ci-deploy.yml +++ b/.github/workflows/ci-deploy.yml @@ -23,6 +23,7 @@ jobs: - name: Replace files run: | rm -r * || true + find . ! -name '.git' -type d -exec rm -rf {} + mv /tmp/dist/.[!.]* . mv /tmp/dist/* . - name: Commit files -- cgit v1.2.3 From 10fc59b75214844921f99d59ba1d3c258e40df39 Mon Sep 17 00:00:00 2001 From: rstular Date: Tue, 2 Jun 2020 16:48:15 +0200 Subject: Fix #5 --- .github/workflows/ci-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-deploy.yml b/.github/workflows/ci-deploy.yml index 6a160b4..5b3ec96 100644 --- a/.github/workflows/ci-deploy.yml +++ b/.github/workflows/ci-deploy.yml @@ -23,7 +23,7 @@ jobs: - name: Replace files run: | rm -r * || true - find . ! -name '.git' -type d -exec rm -rf {} + + find . -not -name '.git' -a -not -name '.' -type d -exec rm -rf {} + mv /tmp/dist/.[!.]* . mv /tmp/dist/* . - name: Commit files -- cgit v1.2.3 From 928369f645fbcff3e4f9aaa4bd40f25f5a5d7115 Mon Sep 17 00:00:00 2001 From: rstular Date: Tue, 2 Jun 2020 16:56:13 +0200 Subject: Please work (pipeline) --- .github/workflows/ci-deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-deploy.yml b/.github/workflows/ci-deploy.yml index 5b3ec96..76bdcfd 100644 --- a/.github/workflows/ci-deploy.yml +++ b/.github/workflows/ci-deploy.yml @@ -23,8 +23,8 @@ jobs: - name: Replace files run: | rm -r * || true - find . -not -name '.git' -a -not -name '.' -type d -exec rm -rf {} + - mv /tmp/dist/.[!.]* . + rm -r .well-known + mv /tmp/dist/.well-known . mv /tmp/dist/* . - name: Commit files run: | -- cgit v1.2.3 From bff3ef59c266e27fd5d8cdf37ecd916b8ef2d5ae Mon Sep 17 00:00:00 2001 From: rstular Date: Tue, 2 Jun 2020 17:05:09 +0200 Subject: Add .well-known to GH pages --- assets/root/_config.yml | 1 + dist/_config.yml | 1 + dist/js/app.js | 2 +- dist/pages/about.html | 2 +- dist/sw.js | 4 ++-- 5 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 assets/root/_config.yml create mode 100644 dist/_config.yml diff --git a/assets/root/_config.yml b/assets/root/_config.yml new file mode 100644 index 0000000..68730c9 --- /dev/null +++ b/assets/root/_config.yml @@ -0,0 +1 @@ +include: [".well-known"] diff --git a/dist/_config.yml b/dist/_config.yml new file mode 100644 index 0000000..68730c9 --- /dev/null +++ b/dist/_config.yml @@ -0,0 +1 @@ +include: [".well-known"] diff --git a/dist/js/app.js b/dist/js/app.js index 53115c0..053135a 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 = "ab8e40cac16a1146fab72dffb8922165b097f730"; +const previous_commit = "20505fc48713c600c345814d4a9c2e0747c77152"; if ("serviceWorker" in navigator) { navigator.serviceWorker.register("/sw.js") diff --git a/dist/pages/about.html b/dist/pages/about.html index 748d16c..ebbcfeb 100755 --- a/dist/pages/about.html +++ b/dist/pages/about.html @@ -142,7 +142,7 @@

- ^HEAD ab8e40cac16a1146fab72dffb8922165b097f730 + ^HEAD 20505fc48713c600c345814d4a9c2e0747c77152

diff --git a/dist/sw.js b/dist/sw.js index c3e0111..4c1211f 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-ab8e40c"; -// commit before the latest is ab8e40cac16a1146fab72dffb8922165b097f730 +const static_cache_name = "site-static-1.0.14-beta-20505fc"; +// commit before the latest is 20505fc48713c600c345814d4a9c2e0747c77152 // Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js // sw.js NE SME BITI CACHAN, ker vsebuje verzijo! -- cgit v1.2.3