summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/gradings.js1
-rw-r--r--js/lang/bundle.js17
-rw-r--r--js/meals.js5
-rw-r--r--js/teachers.js14
4 files changed, 18 insertions, 19 deletions
diff --git a/js/gradings.js b/js/gradings.js
index 2398c03..285f48b 100644
--- a/js/gradings.js
+++ b/js/gradings.js
@@ -200,6 +200,7 @@ document.addEventListener("DOMContentLoaded", () => {
// Calendar setup
var calendarEl = document.getElementById("calendar");
calendar_obj = new FullCalendar.Calendar(calendarEl, {
+ firstDay: 1,
plugins: ["dayGrid"],
defaultDate: getDateString(),
navLinks: false,
diff --git a/js/lang/bundle.js b/js/lang/bundle.js
index b68c22a..1cd8f95 100644
--- a/js/lang/bundle.js
+++ b/js/lang/bundle.js
@@ -1,5 +1,15 @@
// there's an DoS backdoor in BežiApp because of this (-:<
var chosenLang;
+var dateString = {
+ day: (danv) => {
+ let dnevitedna = [S("sunday"), S("monday"), S("tuesday"), S("wednesday"), S("thursday"), S("friday"), S("saturday")];
+ return dnevitedna[danv];
+ },
+ month: (mesl) => {
+ let mesecileta = [S("january"), S("february"), S("march"), S("april"), S("may"), S("june"), S("july"), S("august"), S("september"), S("october"), S("november"), S("december")];
+ return mesecileta[mesl];
+ }
+};
async function refreshLangDOM() {
let promises_to_runn = [
localforage.getItem("chosenLang").then( (value) => {
@@ -45,13 +55,14 @@ async function setLangConfigAndReload() {
window.location.reload();
}
window.addEventListener('DOMContentLoaded', (event) => {
- refreshLangDOM();
localforage.getItem("chosenLang").then( (value) => {
if(value == null) {
setLangConfigAndReload();
+ } else {
+ chosenLang = value;
}
- }
- );
+ });
+ refreshLangDOM();
});
const capitalize = (s) => {
if (typeof s !== 'string') return ''
diff --git a/js/meals.js b/js/meals.js
index f5c9575..1ce08f5 100644
--- a/js/meals.js
+++ b/js/meals.js
@@ -1,6 +1,4 @@
const API_ENDPOINT = "https://lopolis-api.gimb.tk/";
-const jsDateDayString = [S("sunday"), S("monday"), S("tuesday"), S("wednesday"), S("thursday"), S("friday"), S("saturday")];
-const jsDateMonthString = [S("january"), S("february"), S("march"), S("april"), S("may"), S("june"), S("july"), S("august"), S("october"), S("november"), S("december")];
async function checkLogin() {
localforage.getItem("logged_in_lopolis").then((value) => {
if (value != true) {
@@ -139,7 +137,7 @@ function displayMeals(meals) {
if(mealzz.readonly) {
unabletochoosequestionmark = "*" + S("readOnly") + "*";
}
- subject_header_text.innerText = jsDateDayString[datum.getDay()]+", "+datum.getDate()+". "+jsDateMonthString[datum.getMonth()]+" "+datum.getFullYear()+" ("+mealzz.meal+"@"
+ subject_header_text.innerText = dateString.day(datum.getDay())+", "+datum.getDate()+". "+dateString.month(datum.getMonth())+" "+datum.getFullYear()+" ("+mealzz.meal+"@"
+mealzz.location+") "+unabletochoosequestionmark;
// Create collection for displaying individuals meals
let subject_body = document.createElement("div");
@@ -328,4 +326,5 @@ document.addEventListener("DOMContentLoaded", async () => {
showClearBtn: true,
format: "dddd, dd. mmmm yyyy"
});
+ refreshMeals();
});
diff --git a/js/teachers.js b/js/teachers.js
index 9634c06..bb5137b 100644
--- a/js/teachers.js
+++ b/js/teachers.js
@@ -3,18 +3,6 @@ const API_ENDPOINT = "https://gimb.tk/test.php";
var teachers = null;
-
-/**
-* Converts a day number to a string.
-*
-* @param {Number} dayIndex
-* @return {String} Returns day as string
-*/
-function dayOfWeekAsString(dayIndex) {
- var daysToReturn = [S("monday"), S("tuesday"), S("wednesday"), S("thursday"), S("friday"), S("saturday"), S("sunday")];
- return daysToReturn[dayIndex];
-}
-
// Set loading bar visibility
function setLoading(state) {
if (state) {
@@ -145,7 +133,7 @@ function teacherInfo(teacher_id) {
let name = teacher_object["ime"];
let subject = teacher_object["predmeti"][0]["ime"];
- let office_day = dayOfWeekAsString(teacher_object["govorilneure"]["dan"]);
+ let office_day = dateString.day(teacher_object["govorilneure"]["dan"]);
let office_lesson = teacher_object["govorilneure"]["solskaura"];
document.getElementById("teacher-name").innerText = name;