summaryrefslogtreecommitdiffstats
path: root/dist/js
diff options
context:
space:
mode:
authorsijanec <sijanecantonluka@gmail.com>2020-06-08 15:21:59 +0200
committersijanec <sijanecantonluka@gmail.com>2020-06-08 15:21:59 +0200
commit134d89078f864250abf340713edc1d23d90ede24 (patch)
tree386288c539024d6692c8244e491e1828090dfc91 /dist/js
parentterms of service css fix - who reads those? (diff)
downloadbeziapp-134d89078f864250abf340713edc1d23d90ede24.tar
beziapp-134d89078f864250abf340713edc1d23d90ede24.tar.gz
beziapp-134d89078f864250abf340713edc1d23d90ede24.tar.bz2
beziapp-134d89078f864250abf340713edc1d23d90ede24.tar.lz
beziapp-134d89078f864250abf340713edc1d23d90ede24.tar.xz
beziapp-134d89078f864250abf340713edc1d23d90ede24.tar.zst
beziapp-134d89078f864250abf340713edc1d23d90ede24.zip
Diffstat (limited to 'dist/js')
-rwxr-xr-xdist/js/app.js4
-rw-r--r--dist/js/gsec.js7
-rw-r--r--dist/js/login.js2
3 files changed, 6 insertions, 7 deletions
diff --git a/dist/js/app.js b/dist/js/app.js
index 63ca198..f5c2f1b 100755
--- a/dist/js/app.js
+++ b/dist/js/app.js
@@ -2,8 +2,8 @@
-const app_version = "1.0.14.1-beta";
-const previous_commit = "1f5f25a3ade732d7b5b84db7decbdf3a9059a8c2";
+const app_version = "1.0.14.2-beta";
+const previous_commit = "c28c1c56dd807f620e916f9711d4c969817c6dd0";
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("/sw.js")
diff --git a/dist/js/gsec.js b/dist/js/gsec.js
index 36d49a5..59d95bf 100644
--- a/dist/js/gsec.js
+++ b/dist/js/gsec.js
@@ -32,10 +32,9 @@ var dataToBeSent={"ctl00$ContentPlaceHolder1$edtDatZacetka":`${fromDate.getDay()
var absences=[];for(const izostanek of rowElements){var subFields=izostanek.getElementsByTagName("td");var date=subFields[0].innerHTML.trim().split(".");var dateObj=new Date(Date.parse(`${date[2]}-${date[1]}-${date[0]}`));var subjects=[];subFields[2].innerHTML.match(SUBJECT_LIST_REGEX).forEach((subject)=>{subjects.push(subject);});var absencesBySubject={};for(const subject of subjects){const matched_info=FIELDS_REGEX.exec(subject);var subjectName=matched_info[1];var status=Number(matched_info[2]);var period=matched_info[3];period=period.includes("P")?Number(period.replace("P",""))+7:Number(period);absencesBySubject[period]={status:status,subject:subjectName};}
absences.push({subjects:absencesBySubject,date:dateObj});}
resolve(absences);});});}
-fetchGrades(){var grades=[];return new Promise((resolve,reject)=>{$.ajax({xhrFields:{withCredentials:true},crossDomain:true,url:GSE_URL+"Page_Gim/Ucenec/OceneUcenec.aspx",cache:false,type:"GET",dataType:"html",processData:false,success:(data)=>{let parser=new DOMParser();let parsed=parser.parseFromString(data,"text/html");let gradeSpans=parsed.getElementsByClassName("txtVOcObd");for(const grade of gradeSpans){var ist=grade.getElementsByTagName("span")[0].getAttribute("title").split("\n");if(ist.length==1){var gradeToAdd={"gradeType":GSEC_ZAKLJUCNA_GRADE,"grade":Number(grade.getElementsByTagName("span")[0].innerHTML),"subject":grade.parentElement.parentElement.parentElement.parentElement.getElementsByTagName("th")[0].innerText}
-grades.push(gradeToAdd);}else{var date=ist[0].split(": ")[1].trim().split(".");var dateObj=new Date(Date.parse(`${date[2]}-${date[1]}-${date[0]}`));var teacher=ist[1].split(": ")[1].trim();var subject=ist[2].split(": ")[1].trim();var name=[];name.push(ist[3].split(": ")[1].trim())
-name.push(ist[4].split(": ")[1].trim())
-name.push(ist[5].split(": ")[1].trim())
+fetchGrades(){var grades=[];return new Promise((resolve,reject)=>{$.ajax({xhrFields:{withCredentials:true},crossDomain:true,url:GSE_URL+"Page_Gim/Ucenec/OceneUcenec.aspx",cache:false,type:"GET",dataType:"html",processData:false,success:(data)=>{let parser=new DOMParser();let parsed=parser.parseFromString(data,"text/html");let gradeSpans=parsed.getElementsByClassName("txtVOcObd");for(const grade of gradeSpans){var whatever_ist_meant_in_my_head_back_then_but_as_a_string=grade.getElementsByTagName("span")[0].getAttribute("title");var ist=whatever_ist_meant_in_my_head_back_then_but_as_a_string.split("\n");if(ist.length==1){var gradeToAdd={"gradeType":GSEC_ZAKLJUCNA_GRADE,"grade":Number(grade.getElementsByTagName("span")[0].innerHTML),"subject":grade.parentElement.parentElement.parentElement.parentElement.getElementsByTagName("th")[0].innerText}
+grades.push(gradeToAdd);}else{var date=ist[0].split(": ")[1].trim().split(".");var dateObj=new Date(Date.parse(`${date[2]}-${date[1]}-${date[0]}`));var teacher=ist[1].split(": ")[1].trim();var subject=ist[2].split(": ")[1].trim();var name=[];name.push(whatever_ist_meant_in_my_head_back_then_but_as_a_string.split("Ocenjevanje: ")[1].split("\nVrsta: ")[0].trim());name.push(whatever_ist_meant_in_my_head_back_then_but_as_a_string.split("Vrsta: ")[1].split("\nRok: ")[0].trim())
+name.push(whatever_ist_meant_in_my_head_back_then_but_as_a_string.split("Rok: ")[1].trim())
var gradeNumber=Number(grade.getElementsByTagName("span")[0].innerHTML);var temporary=grade.getElementsByTagName("span")[0].classList.contains("ocVmesna");var gradeToAdd={"gradeType":GSEC_NORMAL_GRADE,"date":dateObj,"teacher":teacher,"subject":subject,"name":name,"temporary":temporary,"grade":gradeNumber};if(grade.getElementsByTagName("span").length>1){if(grade.getElementsByTagName("span")[1].classList.contains("ocVmesna")){gradeToAdd["temporary"]=true;}else{gradeToAdd["temporary"]=false;}
gradeToAdd["grade"]=Number(grade.getElementsByTagName("span")[1].innerHTML);gradeToAdd["oldgrade"]=Number(grade.getElementsByTagName("span")[0].innerHTML);}
grades.push(gradeToAdd);}}
diff --git a/dist/js/login.js b/dist/js/login.js
index 2d79576..88cf081 100644
--- a/dist/js/login.js
+++ b/dist/js/login.js
@@ -2,4 +2,4 @@
document.addEventListener("DOMContentLoaded",()=>{setupEventListeners();})
function setupEventListeners(){$("#login-button").click(()=>{login();});window.addEventListener("keyup",(event)=>{if(event.keyCode===13){event.preventDefault();login();}});}
function login(){let username=$("#username").val();let password=$("#password").val();var gsecInstance;try{gsecInstance=new gsec();}catch(error){$.ajax({url:'js/gsec.js?ajaxload',async:false,dataType:"script",});try{gsecInstance=new gsec();}catch(error){alert(D("browserNotSupported"));}}
-gsecInstance.login(username,password).then((value)=>{if(typeof value=="string"){let promises_to_run=[localforage.setItem("logged_in",true),localforage.setItem("username",username),localforage.setItem("password",password)];read_val(0);Promise.all(promises_to_run).then(function(){window.location.replace("/pages/timetable.html");});}else{UIAlert("loginFailed");$("#password").val("");}}).catch((err)=>{gsecErrorHandlerUI(err);$("#password").val("");});} \ No newline at end of file
+gsecInstance.login(username,password).then((value)=>{if(typeof value=="string"){let promises_to_run=[localforage.setItem("logged_in",true),localforage.setItem("username",username),localforage.setItem("password",password)];Promise.all(promises_to_run).then(function(){window.location.replace("/pages/timetable.html");});}else{UIAlert("loginFailed");$("#password").val("");}}).catch((err)=>{gsecErrorHandlerUI(err);$("#password").val("");});} \ No newline at end of file