summaryrefslogtreecommitdiffstats
path: root/assets
diff options
context:
space:
mode:
authorrstular <rok@stular.eu>2020-05-17 16:14:07 +0200
committerrstular <rok@stular.eu>2020-05-17 16:29:20 +0200
commit831563c8ecb2854ceba73c284719b7579c0a3bbc (patch)
tree597d4f2d8a184c13e05027c9ce877d203686c015 /assets
parentMerge branch 'dev' of github.com:beziapp/beziapp.github.io into dev (diff)
downloadbeziapp-831563c8ecb2854ceba73c284719b7579c0a3bbc.tar
beziapp-831563c8ecb2854ceba73c284719b7579c0a3bbc.tar.gz
beziapp-831563c8ecb2854ceba73c284719b7579c0a3bbc.tar.bz2
beziapp-831563c8ecb2854ceba73c284719b7579c0a3bbc.tar.lz
beziapp-831563c8ecb2854ceba73c284719b7579c0a3bbc.tar.xz
beziapp-831563c8ecb2854ceba73c284719b7579c0a3bbc.tar.zst
beziapp-831563c8ecb2854ceba73c284719b7579c0a3bbc.zip
Diffstat (limited to '')
-rw-r--r--assets/css/styles.css4
-rw-r--r--assets/js/lang/bundle.js12
-rw-r--r--assets/js/lib/themes.js37
-rw-r--r--assets/js/settings.js17
-rw-r--r--assets/js/setup-storage.js4
-rw-r--r--assets/pages-src/about.bvr1
-rw-r--r--assets/pages-src/absences.bvr1
-rw-r--r--assets/pages-src/changelog.bvr1
-rw-r--r--assets/pages-src/chats.bvr8
-rw-r--r--assets/pages-src/grades.bvr1
-rw-r--r--assets/pages-src/gradings.bvr1
-rw-r--r--assets/pages-src/jitsi.bvr7
-rw-r--r--assets/pages-src/meals.bvr1
-rw-r--r--assets/pages-src/messaging.bvr1
-rw-r--r--assets/pages-src/privacypolicy.bvr1
-rw-r--r--assets/pages-src/settings.bvr63
-rw-r--r--assets/pages-src/teachers.bvr1
-rw-r--r--assets/pages-src/timetable.bvr1
-rw-r--r--assets/pages-src/tos.bvr1
-rw-r--r--assets/root/login.html1
20 files changed, 111 insertions, 53 deletions
diff --git a/assets/css/styles.css b/assets/css/styles.css
index cd800f3..5144bda 100644
--- a/assets/css/styles.css
+++ b/assets/css/styles.css
@@ -87,7 +87,7 @@ a.collection-item {
.datepicker-table td.is-selected.is-today {
background-color: var(--color-primary);
- color: white;
+ color: var(--background-color);
}
.datepicker-cancel {
@@ -159,7 +159,7 @@ a.collection-item {
left: 0;
bottom: 0;
width: 100%;
- background-color: white;
+ background-color: var(--background-color);
text-align: center;
z-index: 60;
}
diff --git a/assets/js/lang/bundle.js b/assets/js/lang/bundle.js
index b025486..8d0d6b9 100644
--- a/assets/js/lang/bundle.js
+++ b/assets/js/lang/bundle.js
@@ -285,6 +285,11 @@ var langstrings = {
language: "language",
selectLanguage: "select desired language",
languageSet: "language set, open another page for the changes to take effect",
+ theme: "theme",
+ themeLight: "Light theme",
+ themeDark: "Dark theme",
+ selectTheme: "Select a theme",
+ themeSet: "theme set, open another page for the changes to take effect",
// gsec
gsecErrNet: "GimSIS connection error",
gsecErrLogin: "GimSIS login error (bad password?), try logging out",
@@ -466,8 +471,13 @@ var langstrings = {
privacyAcceptWithUse: "your continued use of our website will be regarded as acceptance of our practices around privacy and personal information. If you have any questions about how we handle user data and personal information, feel free to contact us.",
privacyEffectiveAsOf: "this policy is effective as of",
language: "jezik",
- selectLanguage: "izberi željen jezik",
+ selectLanguage: "izberite željen jezik",
languageSet: "jezik nastavljen, odprite neko drugo stran da se pokažejo spremembe",
+ theme: "izgled",
+ themeLight: "svetel izgled",
+ themeDark: "temen izgled",
+ themeSet: "izgled nastavljen, odprite neko drugo stran da se spremembe uveljavijo",
+ selectTheme: "izberite željen izgled",
// gsec
gsecErrNet: "napaka povezave na GimSIS",
gsecErrLogin: "prijava v GimSIS ni uspela (napačno geslo?), poskusite se odjaviti",
diff --git a/assets/js/lib/themes.js b/assets/js/lib/themes.js
new file mode 100644
index 0000000..d8a7ca1
--- /dev/null
+++ b/assets/js/lib/themes.js
@@ -0,0 +1,37 @@
+const THEME_COLOR_SCHEMES = {
+ light: {
+ "color-primary": "rgba(0, 128, 83, 1)",
+ "color-secondary": "rgba(0, 77, 50, 1)",
+ "color-accent": "rgba(0, 156, 101, 1)",
+ "color-primary-light": "rgba(230, 250, 231, 1)",
+ "color-invalid": "rgba(192, 0, 0, 1)",
+ "background-color": "rgba(255, 255, 255, 1)",
+ "background-accent": "rgba(0, 156, 101, 0.2)"
+ },
+ dark: {
+ "color-primary": "rgba(0, 128, 83, 1)",
+ "color-secondary": "rgba(0, 94, 61, 1)",
+ "color-accent": "rgba(20, 117, 83, 1)",
+ "color-primary-light": "rgba(230, 250, 231, 1)",
+ "color-invalid": "rgba(192, 0, 0, 1)",
+ "background-color": "rgba(31, 31, 31, 1)",
+ "background-accent": "rgba(0, 92, 44, 0.2)"
+ }
+}
+
+function applyTheme(themeName) {
+ for (const [property, value] of Object.entries(THEME_COLOR_SCHEMES[themeName])) {
+ document.documentElement.style.setProperty(`--${property}`, value);
+ }
+}
+
+document.addEventListener("DOMContentLoaded", () => {
+ localforage.getItem("theme").then((selectedTheme) => {
+ if (selectedTheme == null) {
+ let isOsDarkTheme = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
+ applyTheme(isOsDarkTheme ? "dark" : "light");
+ } else {
+ applyTheme(selectedTheme);
+ }
+ });
+}); \ No newline at end of file
diff --git a/assets/js/settings.js b/assets/js/settings.js
index 0410aeb..411a38e 100644
--- a/assets/js/settings.js
+++ b/assets/js/settings.js
@@ -7,6 +7,13 @@ async function setLanguage(langCode) {
});
}
+async function setTheme(targetTheme) {
+ localforage.setItem("targetTheme", targetTheme).then((value) => {
+ console.log("Theme set: " + value);
+ UIAlert(D("themeSet"), "setTheme(): themeSet");
+ });
+}
+
document.addEventListener("DOMContentLoaded", async () => {
$("#select-language").on("change", () => {
@@ -14,11 +21,21 @@ document.addEventListener("DOMContentLoaded", async () => {
setLanguage(languageToSet);
});
+ $("#select-theme").on("change", () => {
+ let themeToSet = $(this).find(":selected").data("theme");
+ setTheme(themeToSet);
+ });
+
localforage.getItem("chosenLang").then((value) => {
let selectedLanguage = value ?? "sl";
$(`#option-${selectedLanguage}`).attr("selected", true);
}).catch(() => {});
+ localforage.getItem("theme").then((value) => {
+ let selectedTheme = value ?? "sl";
+ $(`#option-${selectedTheme}`).attr("selected", true);
+ }).catch(() => {});
+
// Setup side menu
const menus = document.querySelectorAll(".side-menu");
M.Sidenav.init(menus, { edge: "right", draggable: true });
diff --git a/assets/js/setup-storage.js b/assets/js/setup-storage.js
index a37fc8f..ad45ec7 100644
--- a/assets/js/setup-storage.js
+++ b/assets/js/setup-storage.js
@@ -17,13 +17,15 @@ async function setupStorage(force = false) {
localforage.setItem("absences", {}),
localforage.setItem("messages", { "0": [], "1": [], "2": []}), // see messages.js:129, commit 8eb9ca9caca30fbbe023243657535ab4088be377
localforage.setItem("directory", {}), //\\ well I could remember my own code but I didn't.
- localforage.setItem("meals", {})
+ localforage.setItem("meals", {}),
+ localforage.setItem("chosenLang", "en")
];
if (logged_in && force == false) { // torej, če je že bila prijava narejena, ne posodobi backwards-compatible vrednosti (username, password,...)
await Promise.all(promises_update);
console.log("[setupStorage] user logged in: only updated");
} else {
+
let promises_first_install = [
localforage.setItem("logged_in", false),
localforage.setItem("username", ""),
diff --git a/assets/pages-src/about.bvr b/assets/pages-src/about.bvr
index 8e658a5..56fa810 100644
--- a/assets/pages-src/about.bvr
+++ b/assets/pages-src/about.bvr
@@ -22,6 +22,7 @@
<link rel="manifest" href="/manifest.json">
<script src="/js/app.js"></script>
+ <script src="/js/lib/themes.js"></script>
<script src="/js/lang/bundle.js"></script>
<link rel="shortcut icon" type="image/png" href="/favicon.png" />
diff --git a/assets/pages-src/absences.bvr b/assets/pages-src/absences.bvr
index 60ee008..0561a3b 100644
--- a/assets/pages-src/absences.bvr
+++ b/assets/pages-src/absences.bvr
@@ -21,6 +21,7 @@
<link rel="manifest" href="/manifest.json">
<script src="/js/app.js"></script>
+ <script src="/js/lib/themes.js"></script>
<script src="/js/gsec.js"></script> <!-- gimsisextclient -->
<script src="/js/lang/bundle.js"></script>
<link rel="shortcut icon" type="image/png" href="/favicon.png" />
diff --git a/assets/pages-src/changelog.bvr b/assets/pages-src/changelog.bvr
index 4be0f75..63504cc 100644
--- a/assets/pages-src/changelog.bvr
+++ b/assets/pages-src/changelog.bvr
@@ -22,6 +22,7 @@
<link rel="manifest" href="/manifest.json">
<script src="/js/app.js"></script>
+ <script src="/js/lib/themes.js"></script>
<script src="/js/lang/bundle.js"></script>
<link rel="shortcut icon" type="image/png" href="/favicon.png" />
diff --git a/assets/pages-src/chats.bvr b/assets/pages-src/chats.bvr
index 9e3e619..d454c14 100644
--- a/assets/pages-src/chats.bvr
+++ b/assets/pages-src/chats.bvr
@@ -7,22 +7,30 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="google" content="notranslate">
<title>Chats &laquo; BežiApp</title>
+
<!-- Materialize -->
<link type="text/css" href="/css/materialize.min.css" rel="stylesheet">
<link href="/css/materialicons.css" rel="stylesheet">
<script type="text/javascript" src="/js/lib/materialize.min.js"></script>
+
<script src="/js/lib/jquery.min.js"></script>
<script type="text/javascript" src="/js/lib/localforage.min.js"></script>
+
<link type="text/css" href="/css/styles.css" rel="stylesheet">
<link type="text/css" href="/css/bubbles.css" rel="stylesheet">
+
<script type="text/javascript" src="/js/lib/he.js" ></script>
<script type="text/javascript" src="/js/gsec.js" ></script>
<script type="text/javascript" src="/js/chats.js"></script>
+
<link rel="manifest" href="/manifest.json">
+
<script src="/js/app.js"></script>
+ <script src="/js/lib/themes.js"></script>
<script src="/js/lang/bundle.js"></script>
<script src="/js/lib/xss.js"></script>
<script src="/js/lib/sjcl.js"></script>
+
<link rel="shortcut icon" type="image/png" href="/favicon.png" />
<!-- iOS support -->
<link rel="apple-touch-icon" href="/img/icons/icon_96.png">
diff --git a/assets/pages-src/grades.bvr b/assets/pages-src/grades.bvr
index 7615e65..0c28f15 100644
--- a/assets/pages-src/grades.bvr
+++ b/assets/pages-src/grades.bvr
@@ -22,6 +22,7 @@
<link rel="manifest" href="/manifest.json">
<script src="/js/app.js"></script>
+ <script src="/js/lib/themes.js"></script>
<script src="/js/lang/bundle.js"></script>
<link rel="shortcut icon" type="image/png" href="/favicon.png" />
diff --git a/assets/pages-src/gradings.bvr b/assets/pages-src/gradings.bvr
index 3239e68..0f693e2 100644
--- a/assets/pages-src/gradings.bvr
+++ b/assets/pages-src/gradings.bvr
@@ -29,6 +29,7 @@
<link rel="manifest" href="/manifest.json">
<script src="/js/app.js"></script>
+ <script src="/js/lib/themes.js"></script>
<script src="/js/lang/bundle.js"></script>
<link rel="shortcut icon" type="image/png" href="/favicon.png" />
diff --git a/assets/pages-src/jitsi.bvr b/assets/pages-src/jitsi.bvr
index a67e4ef..bf0a656 100644
--- a/assets/pages-src/jitsi.bvr
+++ b/assets/pages-src/jitsi.bvr
@@ -7,19 +7,26 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="google" content="notranslate">
<title>GimB Meet &laquo; BežiApp</title>
+
<!-- Materialize -->
<link type="text/css" href="/css/materialize.min.css" rel="stylesheet">
<link href="/css/materialicons.css" rel="stylesheet">
<link href="/css/fontawesome.min.css" rel="stylesheet">
<script type="text/javascript" src="/js/lib/materialize.min.js"></script>
+
<script src="/js/lib/jquery.min.js"></script>
<script type="text/javascript" src="/js/lib/localforage.min.js"></script>
+
<link type="text/css" href="/css/styles.css" rel="stylesheet">
<link rel="manifest" href="/manifest.json">
+
<script src="/js/app.js"></script>
+ <script src="/js/lib/themes.js"></script>
<script src="/js/lang/bundle.js"></script>
<script src="/js/jitsi.js"></script>
+
<link rel="shortcut icon" type="image/png" href="/favicon.png" />
+
<!-- iOS support -->
<link rel="apple-touch-icon" href="/img/icons/icon_96.png">
<link rel="apple-touch-icon" href="/img/icons/icon_512.png">
diff --git a/assets/pages-src/meals.bvr b/assets/pages-src/meals.bvr
index 38f8371..47ef8a5 100644
--- a/assets/pages-src/meals.bvr
+++ b/assets/pages-src/meals.bvr
@@ -22,6 +22,7 @@
<link rel="manifest" href="/manifest.json">
<script src="/js/app.js"></script>
+ <script src="/js/lib/themes.js"></script>
<script src="/js/lang/bundle.js"></script>
<link rel="shortcut icon" type="image/png" href="/favicon.png" />
diff --git a/assets/pages-src/messaging.bvr b/assets/pages-src/messaging.bvr
index f6e561b..d302ae6 100644
--- a/assets/pages-src/messaging.bvr
+++ b/assets/pages-src/messaging.bvr
@@ -21,6 +21,7 @@
<link rel="manifest" href="/manifest.json">
<script src="/js/app.js"></script>
+ <script src="/js/lib/themes.js"></script>
<script src="/js/lang/bundle.js"></script>
<script src="/js/lib/xss.js"></script>
<script src="/js/lib/sjcl.js"></script>
diff --git a/assets/pages-src/privacypolicy.bvr b/assets/pages-src/privacypolicy.bvr
index fc52475..4e13e67 100644
--- a/assets/pages-src/privacypolicy.bvr
+++ b/assets/pages-src/privacypolicy.bvr
@@ -22,6 +22,7 @@
<link rel="manifest" href="/manifest.json">
<script src="/js/app.js"></script>
+ <script src="/js/lib/themes.js"></script>
<script src="/js/lang/bundle.js"></script>
<link rel="shortcut icon" type="image/png" href="/favicon.png" />
diff --git a/assets/pages-src/settings.bvr b/assets/pages-src/settings.bvr
index 135ca91..8d5193c 100644
--- a/assets/pages-src/settings.bvr
+++ b/assets/pages-src/settings.bvr
@@ -22,6 +22,7 @@
<link rel="manifest" href="/manifest.json">
<script src="/js/app.js"></script>
+ <script src="/js/lib/themes.js"></script>
<script src="/js/lang/bundle.js"></script>
<link rel="shortcut icon" type="image/png" href="/favicon.png" />
@@ -56,61 +57,25 @@
<div class="row">
<h5><x-su>language</x-su></h5>
<div class="input-field col s12">
+ <i class="material-icons prefix">translate</i>
<select class="icons" id="select-language">
<option value="" id="option-sl" data-language="sl" data-icon="/img/flags/sl.svg" selected>Slovenščina</option>
<option value="" id="option-en" data-language="en" data-icon="/img/flags/en.svg">English</option>
</select>
<label><x-su>selectLanguage</x-su></label>
</div>
- <!-- <div class="col s12">
- <div class="collection">
- <a data-language="sl" class="collection-item settings-language-selector" href="#">
- <div>
- Slovenščina
- <div class="secondary-content">
- <img class="flag-icon" src="/img/flags/sl.svg" />
- </div>
- </div>
- </a>
- <a data-language="en" class="collection-item settings-language-selector" href="#">
- <div>
- English
- <div class="secondary-content">
- <img class="flag-icon" src="/img/flags/en.svg" />
- </div>
- </div>
- </a>
- <!--
- <li class="collection-item waves-effect">
- <span class="title about-text">Srpskohrvatski</span>
- </li>
- <li class="collection-item waves-effect">
- <span class="title about-text">Македонски</span>
- </li>
- <li class="collection-item waves-effect">
- <span class="title about-text">Français</span>
- </li>
- <li class="collection-item waves-effect">
- <span class="title about-text">Deutsch</span>
- </li>
- <li class="collection-item waves-effect">
- <span class="title about-text">Español</span>
- </li>
- <li class="collection-item waves-effect">
- <span class="title about-text">Русский</span>
- </li>
- <li class="collection-item waves-effect">
- <span class="title about-text">汉语</span>
- </li>
- <li class="collection-item waves-effect">
- <span class="title about-text">日本語</span>
- </li>
- <li class="collection-item waves-effect">
- <span class="title about-text">Lingua latīna</span>
- </li>
- -->
- </div>
- </div> -->
+ </div>
+
+ <div class="row">
+ <h5><x-su>theme</x-su></h5>
+ <div class="input-field col s12">
+ <i class="material-icons prefix">palette</i>
+ <select class="icons" id="select-theme">
+ <option value="" id="option-light" data-theme="light" selected><x-su>themeLight</x-su></option>
+ <option value="" id="option-dark" data-theme="dark"><x-su>themeDark</x-su></option>
+ </select>
+ <label><x-su>selectTheme</x-su></label>
+ </div>
</div>
</div>
</body>
diff --git a/assets/pages-src/teachers.bvr b/assets/pages-src/teachers.bvr
index 37ff3e2..e3993b3 100644
--- a/assets/pages-src/teachers.bvr
+++ b/assets/pages-src/teachers.bvr
@@ -22,6 +22,7 @@
<link rel="manifest" href="/manifest.json">
<script src="/js/app.js"></script>
+ <script src="/js/lib/themes.js"></script>
<script src="/js/lang/bundle.js"></script>
<link rel="shortcut icon" type="image/png" href="/favicon.png" />
diff --git a/assets/pages-src/timetable.bvr b/assets/pages-src/timetable.bvr
index 0d8363c..b8c6b06 100644
--- a/assets/pages-src/timetable.bvr
+++ b/assets/pages-src/timetable.bvr
@@ -31,6 +31,7 @@
<link rel="manifest" href="/manifest.json">
<script src="/js/app.js"></script>
+ <script src="/js/lib/themes.js"></script>
<script src="/js/lang/bundle.js"></script>
<link rel="shortcut icon" type="image/png" href="/favicon.png" />
diff --git a/assets/pages-src/tos.bvr b/assets/pages-src/tos.bvr
index b96eccc..5deea14 100644
--- a/assets/pages-src/tos.bvr
+++ b/assets/pages-src/tos.bvr
@@ -22,6 +22,7 @@
<link rel="manifest" href="/manifest.json">
<script src="/js/app.js"></script>
+ <script src="/js/lib/themes.js"></script>
<script src="/js/lang/bundle.js"></script>
<link rel="shortcut icon" type="image/png" href="/favicon.png" />
diff --git a/assets/root/login.html b/assets/root/login.html
index bbacb7d..542b157 100644
--- a/assets/root/login.html
+++ b/assets/root/login.html
@@ -21,6 +21,7 @@
<link rel="manifest" href="/manifest.json">
<script src="/js/app.js"></script>
+ <script src="/js/lib/themes.js"></script>
<script src="/js/lang/bundle.js"></script>
<link rel="shortcut icon" type="image/png" href="/favicon.png" />