diff options
author | Anton Luka Šijanec <sijanecantonluka@gmail.com> | 2020-03-11 23:16:37 +0100 |
---|---|---|
committer | Anton Luka Šijanec <sijanecantonluka@gmail.com> | 2020-03-11 23:16:37 +0100 |
commit | b4acc53bf7d341debda4105878ee638adc1b3e81 (patch) | |
tree | 91489739cea8263b5afb14ec306d70b5fd1d5996 /js/gsec.js | |
parent | client side gimsisextclient (diff) | |
download | beziapp-b4acc53bf7d341debda4105878ee638adc1b3e81.tar beziapp-b4acc53bf7d341debda4105878ee638adc1b3e81.tar.gz beziapp-b4acc53bf7d341debda4105878ee638adc1b3e81.tar.bz2 beziapp-b4acc53bf7d341debda4105878ee638adc1b3e81.tar.lz beziapp-b4acc53bf7d341debda4105878ee638adc1b3e81.tar.xz beziapp-b4acc53bf7d341debda4105878ee638adc1b3e81.tar.zst beziapp-b4acc53bf7d341debda4105878ee638adc1b3e81.zip |
Diffstat (limited to 'js/gsec.js')
-rw-r--r-- | js/gsec.js | 29 |
1 files changed, 26 insertions, 3 deletions
@@ -1,5 +1,10 @@ // tab = 2 || any spaces; use tabs // not tested yet +function stripHtml(html) { // xss! itaK zaupamo zgimsisext responsem + var tmp = document.createElement("DIV"); + tmp.innerHTML = html; + return tmp.textContent || tmp.innerText || ""; +} const GSE_URL = "https://zgimsis.gimb.tk/gse/"; class gsec { constructor() { @@ -119,7 +124,7 @@ class gsec { this.postback(GSE_URL+"Page_Gim/Ucenec/DnevnikUcenec.aspx", dataToSend).then( (response) => { var parsed = document.createElement("html"); parsed.innerHTML = response.data; - for(urnikElement of $('[id^="ctl00_ContentPlaceHolder1_wkgDnevnik_btnCell_"]')) { + for(const urnikElement of $('[id^="ctl00_ContentPlaceHolder1_wkgDnevnik_btnCell_"]')) { var subFields = urnikElement.id.split("_"); var period = subFields[4]; var day = subFields[5]; @@ -142,7 +147,7 @@ class gsec { var parsed = document.createElement("html"); parsed.innerHTML = response.data; var rowElements = parsed.getElementsByTagName("table")[0].getElementsByTagName("tbody")[0].getElementsByTagName("tr"); - for (row of rowElements) { + 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]); @@ -160,5 +165,23 @@ class gsec { }); }); } - // todo: https://github.com/sijanec/gimsisextclient/blob/master/main.php + fetchTeachers() { + return new Promise((resolve, reject) => { + var Teachers = {}; + this.postback(GSE_URL+"Page_Gim/Ucenec/UciteljskiZbor.aspx").then((response)=>{ + var parsed = document.createElement("html"); + parsed.innerHTML = response.data; + 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); // razrednik je namreč bold tekst! + var subjectStrings = subFields[2].innerHTML.split("<br />"); + for(const subjectString of subjectStrings) { + // todo: https://github.com/sijanec/gimsisextclient/blob/master/main.php#L270 + var subjectName = + } + } + }) + }); + } } |