summaryrefslogtreecommitdiffstats
path: root/dist
diff options
context:
space:
mode:
authorsijanec <anton@sijanec.eu>2021-05-16 16:49:09 +0200
committersijanec <anton@sijanec.eu>2021-05-16 16:49:09 +0200
commitabd9011fa84bdc1f6ee583e387d0ec686c3dc3ab (patch)
tree297222608598dae2478c79f4e82b655c6c497292 /dist
parentMerge branch 'master' into dev (diff)
downloadbeziapp-abd9011fa84bdc1f6ee583e387d0ec686c3dc3ab.tar
beziapp-abd9011fa84bdc1f6ee583e387d0ec686c3dc3ab.tar.gz
beziapp-abd9011fa84bdc1f6ee583e387d0ec686c3dc3ab.tar.bz2
beziapp-abd9011fa84bdc1f6ee583e387d0ec686c3dc3ab.tar.lz
beziapp-abd9011fa84bdc1f6ee583e387d0ec686c3dc3ab.tar.xz
beziapp-abd9011fa84bdc1f6ee583e387d0ec686c3dc3ab.tar.zst
beziapp-abd9011fa84bdc1f6ee583e387d0ec686c3dc3ab.zip
Diffstat (limited to 'dist')
-rwxr-xr-xdist/cache_name.txt2
-rwxr-xr-xdist/js/app.js4
-rwxr-xr-xdist/js/colors.js10
-rwxr-xr-xdist/js/gradings.js5
-rwxr-xr-xdist/js/gsec.js2
-rwxr-xr-xdist/js/lang/bundle.js10
-rwxr-xr-xdist/js/settings.js8
-rwxr-xr-xdist/js/setup-storage.js1
-rwxr-xr-xdist/js/timetable.js12
-rwxr-xr-xdist/pages/about.html4
-rwxr-xr-xdist/pages/changelog.html17
-rwxr-xr-xdist/pages/gradings.html3
-rwxr-xr-xdist/pages/settings.html13
-rwxr-xr-xdist/pages/timetable.html1
-rwxr-xr-xdist/sw.js4
15 files changed, 72 insertions, 24 deletions
diff --git a/dist/cache_name.txt b/dist/cache_name.txt
index 5466678..2cc6cc9 100755
--- a/dist/cache_name.txt
+++ b/dist/cache_name.txt
@@ -3,4 +3,4 @@
-///site-static-1.0.16.4-beta-80550d8|||
+///site-static-1.0.17.0-beta-93d4479|||
diff --git a/dist/js/app.js b/dist/js/app.js
index 623213f..c50b72d 100755
--- a/dist/js/app.js
+++ b/dist/js/app.js
@@ -4,8 +4,8 @@
// @begin=js@
-const app_version = "1.0.16.4-beta";
-const previous_commit = "80550d8cad189982bf607549b6b5d3977602b91b";
+const app_version = "1.0.17.0-beta";
+const previous_commit = "93d44790e9175f898c2f50b5bfe8e1d3a197ee53";
const BEZIAPP_UPDATE_INTERVAL = 300; // update vsakih 300 sekund
if (location.protocol !== 'https:') {
diff --git a/dist/js/colors.js b/dist/js/colors.js
new file mode 100755
index 0000000..057b0c9
--- /dev/null
+++ b/dist/js/colors.js
@@ -0,0 +1,10 @@
+
+function linMap(c,mn,mx){return c*(mx-mn)+mn;}
+function getDecimal(n){return(n-Math.floor(n));}
+function mapColorPalete(c,palete){let poz=c*(palete.length-1);let col1=palete[Math.floor(poz)];let col2=palete[Math.ceil(poz)];return(Math.floor(linMap(getDecimal(poz),col1[0],col2[0])).toString(16).padStart(2,0)+
+Math.floor(linMap(getDecimal(poz),col1[1],col2[1])).toString(16).padStart(2,0)+
+Math.floor(linMap(getDecimal(poz),col1[2],col2[2])).toString(16).padStart(2,0)).toUpperCase();}
+function intToRGB(i,palete=null){if(palete==null){var c=(i&0x00FFFFFF).toString(16).toUpperCase();return"00000".substring(0,6-c.length)+c;}else return mapColorPalete((i&0xFF)/0xFF,palete);}
+function getHexColorFromString(str){if(urnikTheme=="privzeta")
+return"#"+intToRGB(hashCode(str));else
+return"#"+intToRGB(hashCode(str),[[38,70,83],[42,157,143],[233,196,106],[244,162,97],[231,111,81]]);} \ No newline at end of file
diff --git a/dist/js/gradings.js b/dist/js/gradings.js
index 713ea20..1e21acd 100755
--- a/dist/js/gradings.js
+++ b/dist/js/gradings.js
@@ -3,9 +3,7 @@ var calendar_obj=null;var gradings;async function checkLogin(){localforage.getIt
function setLoading(state){if(state){$("#loading-bar").removeClass("hidden");}else{$("#loading-bar").addClass("hidden");}}
function hashCode(str){var hash=0;for(var i=0;i<str.length;i++){hash=str.charCodeAt(i)+((hash<<5)-hash);}
return hash;}
-function intToRGB(i){var c=(i&0x00FFFFFF).toString(16).toUpperCase();return"00000".substring(0,6-c.length)+c;}
function getForegroundFromBackground(background_color){let color_hex=background_color.replace("#","");let rgb=[parseInt(color_hex.substring(0,2),16),parseInt(color_hex.substring(2,4),16),parseInt(color_hex.substring(4,6),16)];let o=Math.round(((parseInt(rgb[0])*299)+(parseInt(rgb[1])*587)+(parseInt(rgb[2])*114))/1000);if(o>180){return"#000000";}else{return"#ffffff";}}
-function getHexColorFromString(str){return"#"+intToRGB(hashCode(str));}
function getDateString(){let date=new Date();let year_str=date.getFullYear();let month_str=date.getMonth()+1
month_str=month_str.toString().padStart(2,"0");let day_str=date.getDate();day_str=day_str.toString().padStart(2,"0");let date_string=year_str+"-"+month_str+"-"+day_str;return date_string;}
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);}}
@@ -14,4 +12,5 @@ async function validateInputs(){if($("#input-grading-name").val()!=null&&$("#inp
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();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
+var urnikTheme="privzeta";document.addEventListener("DOMContentLoaded",async function(){urnikTheme=await localforage.getItem("urnikTheme");if(urnikTheme==null||urnikTheme==undefined||urnikTheme==false)
+urnikTheme="privzeta";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/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;}
diff --git a/dist/js/lang/bundle.js b/dist/js/lang/bundle.js
index 41567f3..6b99566 100755
--- a/dist/js/lang/bundle.js
+++ b/dist/js/lang/bundle.js
@@ -163,6 +163,7 @@ var langstrings = {
settings: "settings",
// timetable
noPeriods: "no periods in selected week",
+ substitution: "substitution",
// gradings
date: "date",
description: "description",
@@ -248,7 +249,7 @@ var langstrings = {
mealsUsageNote: "click on a date to open the collapsible menu with choices and click on a specific meal to select it. Reload the meals when you're done and check the entries.",
lunchesNote: "app was not tested with lunches in mind. Meals probably won't work with lunches and having a lunch subscription may even break its functionality.",
mealNotShownNote: "editable meals are highlighted in gold, read-only meals are highlighted in grey and cannot be changed. Meals that provide no options for menus are not shown for clarity, same applies for days where there are no meals",
- mealsContributeNote: "you are welcome to contribute to the LopolisAPI project and add features, such as checkouts.",
+ mealsContributeNote: "you are welcome to contribute to the BežiApp project.",
authenticationError: "authentication error",
lopolisAPIConnectionError: "LopolisAPI server connection error",
errorGettingMenus: "error getting menus",
@@ -319,6 +320,7 @@ var langstrings = {
on: "on",
off: "off",
selectErrorReporting: "should error reports be submitted to the developers?",
+ urnikTheme: "timetable theme",
// gsec
gsecErrNet: "GimSIS connection error",
gsecErrLogin: "GimSIS login error (bad password?), try logging out",
@@ -365,6 +367,7 @@ var langstrings = {
browserNotSupported: "BežiApp ne bo deloval na vaši napravi, če ne posodobite vašega Internetnega brskalnika",
// timetable
noPeriods: "ni ur v izbranem tednu",
+ substitution: "nadomeščanje",
// index
timetable: "urnik",
gradings: "ocenjevanja",
@@ -461,7 +464,7 @@ var langstrings = {
mealsUsageNote: "kliknite na datum za prikaz menijev, nato pa si enega izberite s klikom na ime menija. Po nastavitvi menijev ponovno naložite menije in se prepričajte o pravilnih nastavitvah.",
lunchesNote: "aplikacija ni testirana za naročanje na kosila, zato verjetno to ne deluje. Če ste naročeni na kosila lahko naročanje na menije sploh ne deluje ali pa deluje narobe.",
mealNotShownNote: "obroki, označeni z zlato so nastavljivi, tisti, označeni s sivo, niso, če pa pri kakšnem dnevu obroka ni, pa pomeni, da ga ni moč nastaviti ali pa da ne obrok ne obstaja",
- mealsContributeNote: "vabimo vas k urejanju LopolisAPI programa za upravljanje z meniji.",
+ mealsContributeNote: "vabimo vas k urejanju BežiApp programa.",
authenticationError: "napaka avtentikacije",
lopolisAPIConnectionError: "napaka povezave na LopolisAPI strežnik",
errorGettingMenus: "napaka branja menijev",
@@ -521,7 +524,7 @@ var langstrings = {
themeLight: "svetel izgled (privzeto)",
themeDark: "temen izgled",
themeNight: "nočni izgled",
- themeSet: "izgled nastavljen, odprite neko drugo stran da se spremembe uveljavijo",
+ themeSet: "izgled nastavljen, odprite neko drugo stran, da se spremembe uveljavijo",
selectTheme: "izberite željen izgled",
errorReportingSet: "nastavitev pošiljanja napak izbrana",
errorReporting: "pošiljanje napak",
@@ -532,6 +535,7 @@ var langstrings = {
triggerAgreement: "strinjam se z zgoraj navedenimi pogoji",
triggerWarningSet: "spremenili ste stanje dodatnih nastavitev",
additionalOptions: "dodatne nastavitve",
+ urnikTheme: "izgled urnika",
// gsec
gsecErrNet: "napaka povezave na GimSIS",
gsecErrLogin: "prijava v GimSIS ni uspela (napačno geslo?), poskusite se odjaviti",
diff --git a/dist/js/settings.js b/dist/js/settings.js
index 9e52861..f6cfbe2 100755
--- a/dist/js/settings.js
+++ b/dist/js/settings.js
@@ -1,12 +1,14 @@
async function setLanguage(langCode){localforage.setItem("chosenLang",langCode).then((value)=>{console.log("Language set: "+value);UIAlert(D("languageSet"),"setLanguage(): languageSet");});}
async function setTheme(targetTheme){localforage.setItem("theme",targetTheme).then((value)=>{console.log("Theme set: "+value);UIAlert(D("themeSet"),"setTheme(): themeSet");});}
+async function setUrnikTheme(targetTheme){localforage.setItem("urnikTheme",targetTheme).then((value)=>{console.log("Urnik theme set"+value);UIAlert(D("themeSet"),"setUrnikTheme(): themeSet")});}
async function setErrorReporting(targetE){localforage.setItem("errorReporting",targetE).then((value)=>{console.log("ErrorReporing set: "+value);UIAlert(D("errorReportingSet"),"setErrorReporting(): errorReportingSet");});}
function shuffleArray(array){for(var i=array.length-1;i>0;i--){var j=Math.floor(Math.random()*(i+1));var temp=array[i];array[i]=array[j];array[j]=temp;}}
function setUIAdditionalOptions(state){var SENSITIVE_THEMES={"left":"Left / leva","right":"Right / desna","piratska":"Pirate / piratska"};if(state===true){var theme_keys=Object.keys(SENSITIVE_THEMES);shuffleArray(theme_keys);theme_keys.forEach((item)=>{var option_element=$(`<option value="${item}" id="option-${item}" data-theme="${item}">${SENSITIVE_THEMES[item]}</option>`);$("#select-theme").append(option_element);});}else{Object.keys(SENSITIVE_THEMES).forEach((item)=>{$("#option-"+item).remove();});}
var elems=document.querySelectorAll('#select-theme');M.FormSelect.init(elems,{});}
async function setAdditionalOptions(state){localforage.setItem("triggerWarningAccepted",state).then((value)=>{console.log("TriggerWarning set: "+value);UIAlert(D("triggerWarningSet"),"setAdditionalOptions(): triggerWarningSet");setUIAdditionalOptions(value);});}
-document.addEventListener("DOMContentLoaded",async()=>{$("#triggered-checkbox").change(function(){if(this.checked){setAdditionalOptions(true);}else{setAdditionalOptions(false);}});$("#select-language").on("change",function(){setLanguage($(this).find(":selected").val());});$("#select-theme").on("change",function(){setTheme($(this).find(":selected").val());});$("#select-errorreporting").on("change",function(){setErrorReporting($(this).find(":selected").val());});localforage.getItem("chosenLang").then((value)=>{let selectedLanguage=value;if(value==null||value.length<1){selectedLanguage="sl";}
-$(`#option-${selectedLanguage}`).attr("selected",true);}).catch(()=>{});localforage.getItem("theme").then((value)=>{let selectedTheme=value;if(value==null||value.length<1){selectedTheme="themeLight";}
+document.addEventListener("DOMContentLoaded",async()=>{$("#triggered-checkbox").change(function(){if(this.checked){setAdditionalOptions(true);}else{setAdditionalOptions(false);}});$("#select-language").on("change",function(){setLanguage($(this).find(":selected").val());});$("#select-theme").on("change",function(){setTheme($(this).find(":selected").val());});$("#select-errorreporting").on("change",function(){setErrorReporting($(this).find(":selected").val());});$("#select-urniktheme").on("change",function(){setUrnikTheme($(this).find(":selected").val());});localforage.getItem("chosenLang").then((value)=>{let selectedLanguage=value;if(value==null||value.length<1){selectedLanguage="sl";}
+$(`#option-${selectedLanguage}`).attr("selected",true);}).catch(()=>{});localforage.getItem("urnikTheme").then((value)=>{if(value==null||value.length<1){value="privzeta";}
+$(`#option-${value}`).attr("selected",true);}).catch(()=>{});localforage.getItem("theme").then((value)=>{let selectedTheme=value;if(value==null||value.length<1){selectedTheme="themeLight";}
$(`#option-${selectedTheme}`).attr("selected",true);}).catch(()=>{});localforage.getItem("errorReporting").then((value)=>{let selectedE=value;if(value==null||value.length<1){selectedE="on";}
-$(`#option-${selectedE}`).attr("selected",true);}).catch(()=>{});localforage.getItem("triggerWarningAccepted").then((value)=>{if(value===true){$("#triggered-checkbox").attr("checked",true);setUIAdditionalOptions(true);}}).catch(()=>{});const menus=document.querySelectorAll(".side-menu");M.Sidenav.init(menus,{edge:"right",draggable:true});var elems=document.querySelectorAll(".theme-select");M.FormSelect.init(elems,{});var elems=document.querySelectorAll(".errorreporting-select");M.FormSelect.init(elems,{});var elems=document.querySelectorAll(".lang-select");M.FormSelect.init(elems,{});}); \ No newline at end of file
+$(`#option-${selectedE}`).attr("selected",true);}).catch(()=>{});localforage.getItem("triggerWarningAccepted").then((value)=>{if(value===true){$("#triggered-checkbox").attr("checked",true);setUIAdditionalOptions(true);}}).catch(()=>{});const menus=document.querySelectorAll(".side-menu");M.Sidenav.init(menus,{edge:"right",draggable:true});var elems=document.querySelectorAll(".theme-select");M.FormSelect.init(elems,{});var elems=document.querySelectorAll(".errorreporting-select");M.FormSelect.init(elems,{});var elems=document.querySelectorAll(".urniktheme-select");M.FormSelect.init(elems,{});var elems=document.querySelectorAll(".lang-select");M.FormSelect.init(elems,{});}); \ No newline at end of file
diff --git a/dist/js/setup-storage.js b/dist/js/setup-storage.js
index 74b2909..635253f 100755
--- a/dist/js/setup-storage.js
+++ b/dist/js/setup-storage.js
@@ -25,6 +25,7 @@ async function setupStorage(force = false) {
localforage.setItem("directory", {}), //\\ well I could remember my own code but I didn't.
localforage.setItem("meals", {}),
localforage.setItem("lastUpdate", 0),
+ localforage.setItem("urnikTheme", "privzeta"),
localforage.setItem("triggerWarningAccepted", false)
];
diff --git a/dist/js/timetable.js b/dist/js/timetable.js
index aa73a9a..d74a32f 100755
--- a/dist/js/timetable.js
+++ b/dist/js/timetable.js
@@ -3,9 +3,7 @@ var calendar_obj=null;function checkLogin(){localforage.getItem("logged_in").the
function setLoading(state){if(state){$("#loading-bar").removeClass("hidden");}else{$("#loading-bar").addClass("hidden");}}
function hashCode(str){var hash=0;for(var i=0;i<str.length;i++){hash=str.charCodeAt(i)+((hash<<5)-hash);}
return hash;}
-function intToRGB(i){var c=(i&0x00FFFFFF).toString(16).toUpperCase();return"00000".substring(0,6-c.length)+c;}
function getForegroundFromBackground(background_color){let color_hex=background_color.replace("#","");let rgb=[parseInt(color_hex.substring(0,2),16),parseInt(color_hex.substring(2,4),16),parseInt(color_hex.substring(4,6),16)];let o=Math.round(((parseInt(rgb[0])*299)+(parseInt(rgb[1])*587)+(parseInt(rgb[2])*114))/1000);if(o>180){return"#000000";}else{return"#ffffff";}}
-function getHexColorFromString(str){return"#"+intToRGB(hashCode(str));}
function getDateString(date){let year_str=date.getFullYear();let month_str=date.getMonth()+1
month_str=month_str.toString().padStart(2,"0");let day_str=date.getDate();day_str=day_str.toString().padStart(2,"0");let date_string=year_str+"-"+month_str+"-"+day_str;return date_string;}
function getLastMonday(date_object){if(date_object.getDay()===0){date_object.setDate(date_object.getDate()-6);}else{date_object.setDate(date_object.getDate()-date_object.getDay()+1);}
@@ -14,8 +12,10 @@ async function loadTimetable(date_object,force_refresh=false){setLoading(true);v
if(!containsPeriods){UIAlert(D("noPeriods"));setLoading(false);}else{if(timetable===null){timetable={};}
timetable[date_string]=value;localforage.setItem("timetable",timetable).then(()=>{displayTimetable(value,date_monday);setLoading(false);});}}).catch((err)=>{gsecErrorHandlerUI(err);setLoading(false);});}catch(err){gsecErrorHandlerUI(err);setLoading(false);}}else{displayTimetable(timetable[date_string],date_monday);setLoading(false);}}
function getLessonTimes(lesson_number){const lessonTimes=[["07:10:00","07:55:00"],["08:00:00","08:45:00"],["08:50:00","09:35:00"],["09:40:00","10:25:00"],["10:55:00","11:40:00"],["11:45:00","12:30:00"],["12:35:00","13:20:00"],["13:25:00","14:10:00"],["14:15:00","15:00:00"],["15:05:00","15:50:00"],["15:55:00","16:40:00"],["16:45:00","17:30:00"],["17:35:00","18:20:00"],["18:25:00","19:10:00"]];return lessonTimes[lesson_number];}
-function displayTimetable(weekly_timetable,date_object){let transformed_timetable=[];let num_days=Object.keys(weekly_timetable).length;for(let i=0;i<num_days;i++){let date_string=getDateString(date_object);date_object.setDate(date_object.getDate()+1);let daily_timetable=weekly_timetable[i.toString()];Object.keys(daily_timetable).forEach((lesson_number)=>{let lesson=daily_timetable[lesson_number];let lesson_times=getLessonTimes(parseInt(lesson_number));let bg_color=getHexColorFromString(lesson["acronym"]);let fg_color=getForegroundFromBackground(bg_color);let lesson_metadata={subject:lesson["subject"],class:lesson["class"],teacher:lesson["teacher"],classroom:lesson["place"],start:lesson_times[0].substring(0,5),end:lesson_times[1].substring(0,5)}
-let lesson_object={id:JSON.stringify(lesson_metadata),title:lesson["acronym"],start:date_string+" "+lesson_times[0],end:date_string+" "+lesson_times[1],backgroundColor:bg_color,textColor:fg_color};transformed_timetable.push(lesson_object);});}
+function displayTimetable(weekly_timetable,date_object){let transformed_timetable=[];let num_days=Object.keys(weekly_timetable).length;for(let i=0;i<num_days;i++){let date_string=getDateString(date_object);date_object.setDate(date_object.getDate()+1);let daily_timetable=weekly_timetable[i.toString()];Object.keys(daily_timetable).forEach((lesson_number)=>{let lesson=daily_timetable[lesson_number];let lesson_times=getLessonTimes(parseInt(lesson_number));let bg_color=getHexColorFromString(lesson["acronym"]);let fg_color=getForegroundFromBackground(bg_color);let lesson_metadata={subject:lesson["subject"],class:lesson["class"],teacher:lesson["teacher"],classroom:lesson["place"],substitution:lesson["substitution"],start:lesson_times[0].substring(0,5),end:lesson_times[1].substring(0,5)}
+let lesson_object={id:JSON.stringify(lesson_metadata),title:lesson["acronym"],start:date_string+" "+lesson_times[0],end:date_string+" "+lesson_times[1],backgroundColor:bg_color,textColor:fg_color,};if(lesson["substitution"])
+lesson_object.borderColor="red";transformed_timetable.push(lesson_object);});}
calendar_obj.removeAllEvents();calendar_obj.addEventSource(transformed_timetable);}
-function eventClickHandler(eventClickInfo){let lesson_metadata=JSON.parse(eventClickInfo.event.id);let lesson_subject=lesson_metadata["subject"];let lesson_teacher=lesson_metadata["teacher"];let lesson_classroom=lesson_metadata["classroom"];let lesson_class=lesson_metadata["class"];let lesson_duration=lesson_metadata["start"]+" - "+lesson_metadata["end"];$("#lesson-subject").text(lesson_subject);$("#lesson-teacher").text(lesson_teacher);$("#lesson-class").text(lesson_class);$("#lesson-classroom").text(lesson_classroom);$("#lesson-duration").text(lesson_duration);const modal=document.querySelectorAll(".side-modal")[0];M.Sidenav.getInstance(modal).open();}
-document.addEventListener("DOMContentLoaded",()=>{checkLogin();let calendarEl=document.getElementById("calendar");calendar_obj=new FullCalendar.Calendar(calendarEl,{plugins:["timeGrid"],eventClick:eventClickHandler,defaultView:"timeGridWeek",contentHeight:"auto",height:"auto",width:"auto",timeGridEventMinHeight:35,nowIndicator:true,firstDay:1,weekends:false,timeFormat:'H(:mm)',minTime:"07:10:00",maxTime:"19:10:00"});calendar_obj.render();loadTimetable(new Date());$(".fc-today-button, .fc-prev-button, .fc-next-button").click(()=>{loadTimetable(calendar_obj.getDate());});$("#refresh-icon").click(()=>{loadTimetable(calendar_obj.getDate(),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 eventClickHandler(eventClickInfo){let lesson_metadata=JSON.parse(eventClickInfo.event.id);let lesson_subject=lesson_metadata["subject"];let lesson_teacher=lesson_metadata["teacher"];let lesson_classroom=lesson_metadata["classroom"];let lesson_class=lesson_metadata["class"];let lesson_duration=lesson_metadata["start"]+" - "+lesson_metadata["end"];$("#lesson-subject").text(lesson_subject+(lesson_metadata["substitution"]?(" ("+s("substitution")+")"):""));$("#lesson-teacher").text(lesson_teacher);$("#lesson-class").text(lesson_class);$("#lesson-classroom").text(lesson_classroom);$("#lesson-duration").text(lesson_duration);const modal=document.querySelectorAll(".side-modal")[0];M.Sidenav.getInstance(modal).open();}
+var urnikTheme="privzeta";document.addEventListener("DOMContentLoaded",async function(){urnikTheme=await localforage.getItem("urnikTheme");if(urnikTheme==null||urnikTheme==undefined||urnikTheme==false)
+urnikTheme="privzeta";checkLogin();let calendarEl=document.getElementById("calendar");calendar_obj=new FullCalendar.Calendar(calendarEl,{plugins:["timeGrid"],eventClick:eventClickHandler,defaultView:"timeGridWeek",contentHeight:"auto",height:"auto",width:"auto",timeGridEventMinHeight:35,nowIndicator:true,firstDay:1,weekends:false,timeFormat:'H(:mm)',minTime:"07:10:00",maxTime:"19:10:00"});calendar_obj.render();loadTimetable(new Date());$(".fc-today-button, .fc-prev-button, .fc-next-button").click(()=>{loadTimetable(calendar_obj.getDate());});$("#refresh-icon").click(()=>{loadTimetable(calendar_obj.getDate(),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 989f5e9..d51a448 100755
--- a/dist/pages/about.html
+++ b/dist/pages/about.html
@@ -79,7 +79,7 @@
<!-- One day in the future we may have sw cache version covered by this as well -->
<h5 class="subheader">
<x-su>version</x-su>
- 1.0.16.4-beta
+ 1.0.17.0-beta
</h5>
</div>
</div>
@@ -163,7 +163,7 @@
<div class="row">
<p>
<small>
- ^HEAD 80550d8cad189982bf607549b6b5d3977602b91b
+ ^HEAD 93d44790e9175f898c2f50b5bfe8e1d3a197ee53
</small>
</p>
</div>
diff --git a/dist/pages/changelog.html b/dist/pages/changelog.html
index 45b8c67..4821a2b 100755
--- a/dist/pages/changelog.html
+++ b/dist/pages/changelog.html
@@ -58,6 +58,23 @@
<ul class="collapsible">
<li>
+ <div class="collapsible-header">Version 1.0.17-beta</div>
+ <div class="collapsible-body">
+ <ul class="collection">
+ <li
+ class="collection-item">Added
+ substitutions</li>
+ <li
+ class="collection-item">Added
+ urnik
+ theme
+ selection
+ (Thanks to
+ a dijak from
+ Vegova's G2B)</li>
+ </ul>
+ </div>
+
<div class="collapsible-header">Version 1.0.16-beta</div>
<div class="collapsible-body">
<ul class="collection">
diff --git a/dist/pages/gradings.html b/dist/pages/gradings.html
index 86b047d..12a4091 100755
--- a/dist/pages/gradings.html
+++ b/dist/pages/gradings.html
@@ -30,6 +30,7 @@
<link type="text/css" href="/css/styles.css" rel="stylesheet">
<script type="text/javascript" src="/js/gsec.js"></script> <!-- gimsisextclient -->
+ <script src=/js/colors.js></script>
<script type="text/javascript" src="/js/gradings.js"></script>
<link rel="manifest" href="/manifest.json">
@@ -146,4 +147,4 @@
</body>
- </html
+ </html>
diff --git a/dist/pages/settings.html b/dist/pages/settings.html
index 2d00d2b..03543b2 100755
--- a/dist/pages/settings.html
+++ b/dist/pages/settings.html
@@ -106,6 +106,19 @@
</div>
</div>
+ <div class="row">
+ <div class="col s12">
+ <h5 class="general-text"><x-su>urnikTheme</x-su></h5>
+ </div>
+ <div class="input-field col s12">
+ <i class="material-icons prefix">palette</i>
+ <select class="urniktheme-select input-select" id="select-urniktheme">
+ <option value="privzeta" id="option-privzeta" data-urniktheme="privzeta" selected>GimB</option>
+ <option value="poletna" id="option-poletna" data-urniktheme="poletna">Summer / poletna</option>
+ </select>
+ <label><x-su>selectTheme</x-su></label>
+ </div>
+ </div>
<div class="row">
<div class="col s12">
diff --git a/dist/pages/timetable.html b/dist/pages/timetable.html
index cbdc971..ffd7577 100755
--- a/dist/pages/timetable.html
+++ b/dist/pages/timetable.html
@@ -31,6 +31,7 @@
<link type="text/css" href="/css/styles.css" rel="stylesheet">
<script type="text/javascript" src="/js/gsec.js"></script> <!-- gimsisextclient -->
+ <script src=/js/colors.js></script> <!-- colors by šiška -->
<script type="text/javascript" src="/js/timetable.js"></script>
<link rel="manifest" href="/manifest.json">
diff --git a/dist/sw.js b/dist/sw.js
index cb0428d..fb2e541 100755
--- a/dist/sw.js
+++ b/dist/sw.js
@@ -5,8 +5,8 @@
// @begin=js@
// Change version to cause cache refresh
-const static_cache_name = "site-static-1.0.16.4-beta-80550d8";
-// commit before the latest is 80550d8cad189982bf607549b6b5d3977602b91b
+const static_cache_name = "site-static-1.0.17.0-beta-93d4479";
+// commit before the latest is 93d44790e9175f898c2f50b5bfe8e1d3a197ee53
// Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js
// sw.js NE SME BITI CACHAN, ker vsebuje verzijo!