summaryrefslogtreecommitdiffstats
path: root/assets/js/timetable.js
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 /assets/js/timetable.js
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 'assets/js/timetable.js')
-rw-r--r--assets/js/timetable.js40
1 files changed, 10 insertions, 30 deletions
diff --git a/assets/js/timetable.js b/assets/js/timetable.js
index 85c555a..f4fa01d 100644
--- a/assets/js/timetable.js
+++ b/assets/js/timetable.js
@@ -42,21 +42,6 @@ function hashCode(str) { // java String#hashCode
return hash;
}
-/**
- *
- * Convert last 3 bytes of an integer to RGB color
- * @param {integer} input_integer Integer that will be converted to RGB color
- * @returns {string} Hex color code
- *
- */
-function intToRGB(i) {
- var c = (i & 0x00FFFFFF)
- .toString(16)
- .toUpperCase();
-
- return "00000".substring(0, 6 - c.length) + c;
-}
-
// http://www.w3.org/TR/AERT#color-contrast
/**
*
@@ -78,16 +63,6 @@ function getForegroundFromBackground(background_color) {
return "#ffffff";
}
}
-
-/**
- *
- * Convert a given string to hex color
- * @param {string} input_string Input string
- * @returns {string} Hex RGB color
- */
-function getHexColorFromString(str) {
- return "#" + intToRGB(hashCode(str));
-}
// --------------------------------------------------
// ---------DATE FUNCTION-------------
@@ -214,6 +189,7 @@ function displayTimetable(weekly_timetable, date_object) {
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)
}
@@ -224,9 +200,10 @@ function displayTimetable(weekly_timetable, date_object) {
start: date_string + " " + lesson_times[0],
end: date_string + " " + lesson_times[1],
backgroundColor: bg_color,
- textColor: fg_color
+ textColor: fg_color,
};
-
+ if (lesson["substitution"])
+ lesson_object.borderColor = "red";
transformed_timetable.push(lesson_object);
});
@@ -246,7 +223,7 @@ function eventClickHandler(eventClickInfo) {
let lesson_class = lesson_metadata["class"];
let lesson_duration = lesson_metadata["start"] + " - " + lesson_metadata["end"];
- $("#lesson-subject").text(lesson_subject);
+ $("#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);
@@ -256,10 +233,13 @@ function eventClickHandler(eventClickInfo) {
M.Sidenav.getInstance(modal).open();
}
+var urnikTheme = "privzeta";
-document.addEventListener("DOMContentLoaded", () => {
+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"],