summaryrefslogtreecommitdiffstats
path: root/dist/js/gsec.js
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2021-05-16 17:05:33 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2021-05-16 17:05:33 +0200
commitf289d32c979cccc6626932575cf15d65c0562885 (patch)
tree297222608598dae2478c79f4e82b655c6c497292 /dist/js/gsec.js
parentMerge pull request '1.0.16.4-beta' (#2) from dev into master (diff)
parent1.0.17.0-beta (diff)
downloadbeziapp-f289d32c979cccc6626932575cf15d65c0562885.tar
beziapp-f289d32c979cccc6626932575cf15d65c0562885.tar.gz
beziapp-f289d32c979cccc6626932575cf15d65c0562885.tar.bz2
beziapp-f289d32c979cccc6626932575cf15d65c0562885.tar.lz
beziapp-f289d32c979cccc6626932575cf15d65c0562885.tar.xz
beziapp-f289d32c979cccc6626932575cf15d65c0562885.tar.zst
beziapp-f289d32c979cccc6626932575cf15d65c0562885.zip
Diffstat (limited to 'dist/js/gsec.js')
-rwxr-xr-xdist/js/gsec.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/dist/js/gsec.js b/dist/js/gsec.js
index be98853..ab60875 100755
--- a/dist/js/gsec.js
+++ b/dist/js/gsec.js
@@ -15,7 +15,7 @@ login(usernameToLogin,passwordToLogin){return new Promise((resolve,reject)=>{var
fetchSessionData(){return new Promise((resolve,reject)=>{$.ajax({xhrFields:{withCredentials:true},crossDomain:true,url:GSE_URL+"WS_Gim/wsGimSisUtils.asmx/GetSessionData",type:"POST",dataType:"json",cache:false,contentType:"application/json",data:"{}",processData:false,success:(data,textStatus,xhr)=>{var podatki={};podatki[0]=data.d.split(", ")[0];podatki[1]=data.d.split(", ")[1];podatki["username"]=data.d.split(", ")[1];podatki[2]=data.d.split(", ")[2];podatki[3]=data.d.split(", ")[3];podatki["sessionCookie"]=data.d.split(", ")[3];podatki[4]=data.d.split(", ")[4];resolve({"data":podatki,"textStatus":textStatus,"code":xhr.status});},error:()=>{reject(new Error(false));}});});}
fetchTeachersDirectory(){return new Promise((resolve,reject)=>{var currentDate=new Date();var letnica=currentDate.getFullYear();if(currentDate.getMonth()<7){letnica--;}
$.ajax({xhrFields:{withCredentials:true},crossDomain:true,url:GSE_URL+"Page_Gim/Uporabnik/modSporociloPrejemniki.aspx/NajdiOsebePrejemniki",type:"POST",dataType:"json",contentType:"application/json",cache:false,data:JSON.stringify({"aIdOsebeRe":"","aIdSolskoLeto":Number(letnica).toString(),"aMsgType":"null","aIdType":"null","aIdUcitelj":"","aFilter":null}),processData:false,success:(data)=>{var teachersDirectory=data.d.split(";");teachersDirectory.pop();var formatted={};teachersDirectory.forEach((v)=>{formatted[v.split("=")[1].split(" (")[0]]=v.split("=")[0];});resolve(formatted);},error:()=>{reject(new Error(false));}});});}
-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};}
+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];var nadomescanje=urnikElement.parentElement.classList.contains("flagS");urnik[day][period]={"subject":subject,"acronym":abkurzung,"class":razred,"teacher":teacher,"place":place,"substitution":nadomescanje};}
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);if(subject==null){continue;}