diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/app.js | 2 | ||||
-rw-r--r-- | js/lang/.bundle.js.swp | bin | 0 -> 1024 bytes | |||
-rw-r--r-- | js/lang/bundle.js | 4 | ||||
-rw-r--r-- | js/meals.js | 8 | ||||
-rw-r--r-- | js/teachers.js | 13 | ||||
-rw-r--r-- | js/timetable.js | 6 |
6 files changed, 14 insertions, 19 deletions
@@ -15,7 +15,7 @@ if (navigator.serviceWorker) { if (location.protocol != 'https:') { location.href = 'https:' + window.location.href.substring(window.location.protocol.length); } -function UIAlert(usermsg, devmsg) { +async function UIAlert(usermsg, devmsg) { if(true) { // če bo kakšen dev switch? M.toast( { html: usermsg } ); console.log("[BežiApp UIAlert] "+usermsg+" "+devmsg); diff --git a/js/lang/.bundle.js.swp b/js/lang/.bundle.js.swp Binary files differnew file mode 100644 index 0000000..ff341e2 --- /dev/null +++ b/js/lang/.bundle.js.swp diff --git a/js/lang/bundle.js b/js/lang/bundle.js index eb9aa2d..b68c22a 100644 --- a/js/lang/bundle.js +++ b/js/lang/bundle.js @@ -136,6 +136,8 @@ var langstrings = { meals: "meals", about: "about", logout: "logout", + // timetable + noPeriods: "no periods in selected week", // gradings requestFailed: "request failed", noInternetConnection: "no internet connection", @@ -280,6 +282,8 @@ var langstrings = { and: "in", thePrivacyPolicy: "politika zasebnosti (v angleščini)", loginFailed: "prijava je spodletela", + // timetable + noPeriods: "ni ur v izbranem tednu", // index timetable: "urnik", gradings: "ocenjevanja", diff --git a/js/meals.js b/js/meals.js index 26b7f0b..f5c9575 100644 --- a/js/meals.js +++ b/js/meals.js @@ -22,14 +22,6 @@ function setLoading(state) { $("#loading-bar").addClass("hidden"); } } -function UIAlert(usermsg, devmsg) { - if(true) { // če bo kakšen dev switch? - M.toast( { html: usermsg } ); - console.log("[BežiApp UIAlert] "+usermsg+" "+devmsg); - } else { - M.toast( { html: usermsg+" "+devmsg } ); - } -} async function getToken(callback, callbackparams = []) { setLoading(true); let promises_to_run = [ diff --git a/js/teachers.js b/js/teachers.js index 39232b5..9634c06 100644 --- a/js/teachers.js +++ b/js/teachers.js @@ -11,7 +11,8 @@ var teachers = null; * @return {String} Returns day as string */ function dayOfWeekAsString(dayIndex) { - return ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"][dayIndex]; + var daysToReturn = [S("monday"), S("tuesday"), S("wednesday"), S("thursday"), S("friday"), S("saturday"), S("sunday")]; + return daysToReturn[dayIndex]; } // Set loading bar visibility @@ -61,7 +62,7 @@ async function loadTeachers(force_refresh = false) { success: (data) => { // If data is null, the request failed if (data === null) { - M.toast({ html: "Request failed!" }); + UIAlert(D("requestFailed")); setLoading(false); } else { // Save teachers & populate table @@ -74,7 +75,7 @@ async function loadTeachers(force_refresh = false) { }, error: () => { - M.toast({ html: "No internet connection!" }); + UIAlert(D("noInternetConnection")); setLoading(false); } @@ -148,9 +149,9 @@ function teacherInfo(teacher_id) { let office_lesson = teacher_object["govorilneure"]["solskaura"]; document.getElementById("teacher-name").innerText = name; - document.getElementById("teacher-subject").innerText = "Subject: " + subject; + document.getElementById("teacher-subject").innerText = S("schoolSubject") + ": " + subject; - document.getElementById("teacher-office").innerText = office_day + ", lesson " + office_lesson; + document.getElementById("teacher-office").innerText = office_day + ", " + S("lesson") + " " + office_lesson; const modal = document.querySelectorAll('.side-modal')[0]; M.Sidenav.getInstance(modal).open(); @@ -176,4 +177,4 @@ document.addEventListener("DOMContentLoaded", () => { // Setup side modal const modals = document.querySelectorAll('.side-modal'); M.Sidenav.init(modals, { edge: 'left', draggable: false }); -});
\ No newline at end of file +}); diff --git a/js/timetable.js b/js/timetable.js index c144ecf..740731a 100644 --- a/js/timetable.js +++ b/js/timetable.js @@ -128,7 +128,7 @@ async function loadTimetable(date_object, force_refresh = false) { success: (data) => { // Check if operation was successful if (data === null) { - M.toast({ html: "No periods in selected week." }); + UIAlert( D("noPeriods") ); setLoading(false); } else { @@ -142,13 +142,11 @@ async function loadTimetable(date_object, force_refresh = false) { displayTimetable(data, date_monday); setLoading(false); }); - - } }, error: () => { - M.toast({ html: "No internet connection!" }); + UIAlert( D( "noInternetConnection" ) ); setLoading(false); } |