summaryrefslogtreecommitdiffstats
path: root/assets/js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/js')
-rw-r--r--assets/js/lang/bundle.js26
-rw-r--r--assets/js/lib/themes.js56
-rw-r--r--assets/js/settings.js45
-rw-r--r--assets/js/setup-storage.js8
4 files changed, 123 insertions, 12 deletions
diff --git a/assets/js/lang/bundle.js b/assets/js/lang/bundle.js
index 75fae14..9545c38 100644
--- a/assets/js/lang/bundle.js
+++ b/assets/js/lang/bundle.js
@@ -292,12 +292,16 @@ var langstrings = {
themeDark: "dark theme",
themeNight: "night theme",
selectTheme: "select a theme",
+ triggerWarning: "the following switch enables additional settings, which some people may: disagree with, find annoying, be offended by them. By enabling the switch, you agree that you won't be triggered by any of the additional options and will not asociate any of the authors and/or their personal beliefs and opinions with additional options.",
+ triggerAgreement: "i agree with terms and conditions stated above",
+ triggerWarningSet: "additional settings toggled",
+ additionalOptions: "additional settings",
themeSet: "theme set, open another page for the changes to take effect",
errorReportingSet: "error reporting preference set",
- errorReporting: "error reporting",
- on: "on",
- off: "off",
- selectErrorReporting: "should error reports be submitted to the developers?",
+ errorReporting: "error reporting",
+ on: "on",
+ off: "off",
+ selectErrorReporting: "should error reports be submitted to the developers?",
// gsec
gsecErrNet: "GimSIS connection error",
gsecErrLogin: "GimSIS login error (bad password?), try logging out",
@@ -481,7 +485,7 @@ 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",
// settings
- language: "jezik",
+ language: "jezik",
selectLanguage: "izberite željen jezik",
languageSet: "jezik nastavljen, odprite neko drugo stran da se pokažejo spremembe",
theme: "izgled",
@@ -491,10 +495,14 @@ var langstrings = {
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",
- on: "vklopljeno",
- off: "izklopljeno",
- selectErrorReporting: "ali naj so napake v aplikaciji posredovane razvijalcem?",
+ errorReporting: "pošiljanje napak",
+ on: "vklopljeno",
+ off: "izklopljeno",
+ selectErrorReporting: "ali naj so napake v aplikaciji posredovane razvijalcem?",
+ triggerWarning: "spodnji gumb omogoči dodatne možnosti, ki lahko razburijo/vznevoljijo nekatere uporabnike. Če omogočite stikalo se strinjate, da avtorjev in/ali njihovih osebnih prepričanj ne boste povezovali s katerokoli od dodatnih omogočenih možnosti.",
+ triggerAgreement: "strinjam se z zgoraj navedenimi pogoji",
+ triggerWarningSet: "spremenili ste stanje dodatnih nastavitev",
+ additionalOptions: "dodatne nastavitve",
// 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
index f158a98..d2e99ce 100644
--- a/assets/js/lib/themes.js
+++ b/assets/js/lib/themes.js
@@ -83,6 +83,62 @@ const THEME_COLOR_SCHEMES = {
"color-btn-flat": "rgba(178, 178, 178, 1)",
"color-btn-flat-disabled": "rgba(52, 52, 52, 1)"
+ },
+ left: {
+ "color-primary": "rgba(173, 0, 0, 1)",
+ "color-secondary": "rgba(148, 15, 15, 1)",
+ "color-accent": "rgba(181, 42, 42, 1)",
+ "color-primary-light": "rgba(250, 230, 230, 1)",
+ "color-invalid": "rgba(120, 0, 108, 1)",
+ "color-primary-transparent": "rgba(173, 0, 0, 0.3)",
+
+ "background-color": "rgba(255, 255, 255, 1)",
+ "background-accent": "rgba(199, 38, 38, 0.2)",
+ "background-accent-1": "rgb(219, 192, 192, 1)",
+
+ "color-header-bold": "rgba(255, 255, 255, 1)",
+ "color-header-span": "rgba(255, 255, 255, 1)",
+
+ "color-text": "rgba(0, 0, 0, 1)",
+ "color-text-light": "rgba(97, 97, 97, 1)",
+ "color-label-text": "rgba(158, 158, 158, 1)",
+ "color-table-hover": "rgba(242, 242, 242, 0.5)",
+
+ "color-sidenav-background": "rgba(255, 255, 255, 1)",
+ "color-sidenav-text": "rgba(0, 0, 0, 0.87)",
+ "color-sidenav-header": "rgba(0, 0, 0, 0.54)",
+ "color-divider": "rgba(224, 224, 224, 1)",
+
+ "color-btn-flat": "rgba(52, 52, 52, 1)",
+ "color-btn-flat-disabled": "rgba(178, 178, 178, 1)"
+ },
+ right: {
+ "color-primary": "rgba(7, 0, 105, 1)",
+ "color-secondary": "rgba(206, 217, 0, 1)",
+ "color-accent": "rgba(0, 94, 156, 1)",
+ "color-primary-light": "rgba(195, 191, 255, 1)",
+ "color-invalid": "rgba(192, 0, 0, 1)",
+ "color-primary-transparent": "rgba(7, 0, 105, 0.3)",
+
+ "background-color": "rgba(255, 255, 255, 1)",
+ "background-accent": "rgba(0, 60, 156, 0.2)",
+ "background-accent-1": "rgb(215, 219, 192, 1)",
+
+ "color-header-bold": "rgba(255, 255, 255, 1)",
+ "color-header-span": "rgba(255, 255, 255, 1)",
+
+ "color-text": "rgba(0, 0, 0, 1)",
+ "color-text-light": "rgba(97, 97, 97, 1)",
+ "color-label-text": "rgba(158, 158, 158, 1)",
+ "color-table-hover": "rgba(242, 242, 242, 0.5)",
+
+ "color-sidenav-background": "rgba(255, 255, 255, 1)",
+ "color-sidenav-text": "rgba(0, 0, 0, 0.87)",
+ "color-sidenav-header": "rgba(0, 0, 0, 0.54)",
+ "color-divider": "rgba(224, 224, 224, 1)",
+
+ "color-btn-flat": "rgba(52, 52, 52, 1)",
+ "color-btn-flat-disabled": "rgba(178, 178, 178, 1)"
}
}
diff --git a/assets/js/settings.js b/assets/js/settings.js
index 1dd3bfc..0854042 100644
--- a/assets/js/settings.js
+++ b/assets/js/settings.js
@@ -21,8 +21,53 @@ async function setErrorReporting(targetE) {
});
}
+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"
+ };
+ 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();
+ });
+ }
+}
+
+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 () => {
+ // Setup checkbox handler
+ $("#triggered-checkbox").change(function() {
+ if (this.checked) {
+ setAdditionalOptions(true);
+ } else {
+ setAdditionalOptions(false);
+ }
+ });
+
$("#select-language").on("change", function() {
setLanguage($(this).find(":selected").val());
});
diff --git a/assets/js/setup-storage.js b/assets/js/setup-storage.js
index 7aaa089..0d2552a 100644
--- a/assets/js/setup-storage.js
+++ b/assets/js/setup-storage.js
@@ -2,7 +2,7 @@ async function setupStorage(force = false) {
let logged_in;
promises_check_if_already_installed = [
localforage.getItem("logged_in").then( function(val) {
- console.log("[setupStorage] logged in status: "+val);
+ console.log("[setupStorage] logged in status: " + val);
logged_in = val;
})
];
@@ -20,7 +20,8 @@ async function setupStorage(force = false) {
localforage.setItem("meals", {}),
localforage.setItem("chosenLang", "en"),
localforage.setItem("theme", "light"),
- localforage.setItem("errorReporting", "on")
+ localforage.setItem("errorReporting", "on"),
+ localforage.setItem("triggerWarningAccepted", false)
];
if (logged_in && force == false) { // torej, če je že bila prijava narejena, ne posodobi backwards-compatible vrednosti (username, password,...)
@@ -33,7 +34,8 @@ async function setupStorage(force = false) {
localforage.setItem("username", ""),
localforage.setItem("password", ""),
localforage.setItem("chosenLang", "en"),
- localforage.setItem("theme", "light")
+ localforage.setItem("theme", "light"),
+ localforage.setItem("triggerWarningAccepted", false)
];
await localforage.clear();
await Promise.all(promises_first_install);