From 8e8a1ece2e95e3817739b0ded93eac5214ba49b6 Mon Sep 17 00:00:00 2001 From: rstular Date: Wed, 20 May 2020 20:47:22 +0200 Subject: New themes --- assets/js/lang/bundle.js | 26 +++++++++----- assets/js/lib/themes.js | 56 +++++++++++++++++++++++++++++ assets/js/settings.js | 45 +++++++++++++++++++++++ assets/js/setup-storage.js | 8 +++-- assets/pages-src/misc/msg-compose-modal.bvr | 2 +- assets/pages-src/settings.bvr | 19 ++++++++-- dist/js/app.js | 2 +- dist/js/lang/bundle.js | 26 +++++++++----- dist/js/lib/themes.js | 56 +++++++++++++++++++++++++++++ dist/js/settings.js | 45 +++++++++++++++++++++++ dist/js/setup-storage.js | 8 +++-- dist/pages/about.html | 2 +- dist/pages/messaging.html | 2 +- dist/pages/settings.html | 19 ++++++++-- dist/sw.js | 4 +-- 15 files changed, 286 insertions(+), 34 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 611cae7..e42c9fd 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 = $(``); + $("#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); diff --git a/assets/pages-src/misc/msg-compose-modal.bvr b/assets/pages-src/misc/msg-compose-modal.bvr index 16d1b9c..5889214 100644 --- a/assets/pages-src/misc/msg-compose-modal.bvr +++ b/assets/pages-src/misc/msg-compose-modal.bvr @@ -36,7 +36,7 @@ encryptMessage - +
@@ -92,10 +92,25 @@ report_problem
+
+ +
+
+
additionalOptions
+
+
+

triggerWarning

+
+
+ +
diff --git a/dist/js/app.js b/dist/js/app.js index e0be429..88246df 100755 --- a/dist/js/app.js +++ b/dist/js/app.js @@ -3,7 +3,7 @@ const app_version = "1.0.13-beta"; -const previous_commit = "22bc85704a637175361d7447634f605d6a9102a1"; +const previous_commit = "db70845685ffe5fa725530ca03ba4c72e822e450"; if ("serviceWorker" in navigator) { navigator.serviceWorker.register("/sw.js") diff --git a/dist/js/lang/bundle.js b/dist/js/lang/bundle.js index 75fae14..9545c38 100644 --- a/dist/js/lang/bundle.js +++ b/dist/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/dist/js/lib/themes.js b/dist/js/lib/themes.js index 611cae7..e42c9fd 100644 --- a/dist/js/lib/themes.js +++ b/dist/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/dist/js/settings.js b/dist/js/settings.js index 1dd3bfc..0854042 100644 --- a/dist/js/settings.js +++ b/dist/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 = $(``); + $("#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/dist/js/setup-storage.js b/dist/js/setup-storage.js index 7aaa089..0d2552a 100644 --- a/dist/js/setup-storage.js +++ b/dist/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); diff --git a/dist/pages/about.html b/dist/pages/about.html index 24bdb01..3d5f05a 100755 --- a/dist/pages/about.html +++ b/dist/pages/about.html @@ -142,7 +142,7 @@

- ^HEAD 22bc85704a637175361d7447634f605d6a9102a1 + ^HEAD db70845685ffe5fa725530ca03ba4c72e822e450

diff --git a/dist/pages/messaging.html b/dist/pages/messaging.html index d90e53d..e5c85e5 100755 --- a/dist/pages/messaging.html +++ b/dist/pages/messaging.html @@ -145,7 +145,7 @@ encryptMessage - +
@@ -112,10 +112,25 @@ report_problem
+
+ +
+
+
additionalOptions
+
+
+

triggerWarning

+
+
+ +
diff --git a/dist/sw.js b/dist/sw.js index 8501ee1..a34dba4 100755 --- a/dist/sw.js +++ b/dist/sw.js @@ -3,8 +3,8 @@ // Change version to cause cache refresh -const static_cache_name = "site-static-1.0.13-beta-22bc857"; -// commit before the latest is 22bc85704a637175361d7447634f605d6a9102a1 +const static_cache_name = "site-static-1.0.13-beta-db70845"; +// commit before the latest is db70845685ffe5fa725530ca03ba4c72e822e450 // Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js // sw.js NE SME BITI CACHAN, ker vsebuje verzijo! -- cgit v1.2.3 From 9a8fc181865154f0fc72a30a9554c72bb28c3ce3 Mon Sep 17 00:00:00 2001 From: rstular Date: Wed, 20 May 2020 20:54:10 +0200 Subject: Bug fix --- assets/js/settings.js | 1 + dist/js/app.js | 2 +- dist/js/settings.js | 1 + dist/pages/about.html | 2 +- dist/sw.js | 4 ++-- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/assets/js/settings.js b/assets/js/settings.js index 0854042..f9e3c79 100644 --- a/assets/js/settings.js +++ b/assets/js/settings.js @@ -47,6 +47,7 @@ function setUIAdditionalOptions(state) { $("#option-" + item).remove(); }); } + $("#select-theme").formSelect(); } async function setAdditionalOptions(state) { diff --git a/dist/js/app.js b/dist/js/app.js index 88246df..1d36346 100755 --- a/dist/js/app.js +++ b/dist/js/app.js @@ -3,7 +3,7 @@ const app_version = "1.0.13-beta"; -const previous_commit = "db70845685ffe5fa725530ca03ba4c72e822e450"; +const previous_commit = "3f938cc55a938da9cd7bf4151eb442b580ae4546"; if ("serviceWorker" in navigator) { navigator.serviceWorker.register("/sw.js") diff --git a/dist/js/settings.js b/dist/js/settings.js index 0854042..f9e3c79 100644 --- a/dist/js/settings.js +++ b/dist/js/settings.js @@ -47,6 +47,7 @@ function setUIAdditionalOptions(state) { $("#option-" + item).remove(); }); } + $("#select-theme").formSelect(); } async function setAdditionalOptions(state) { diff --git a/dist/pages/about.html b/dist/pages/about.html index 3d5f05a..ee5b05a 100755 --- a/dist/pages/about.html +++ b/dist/pages/about.html @@ -142,7 +142,7 @@

- ^HEAD db70845685ffe5fa725530ca03ba4c72e822e450 + ^HEAD 3f938cc55a938da9cd7bf4151eb442b580ae4546

diff --git a/dist/sw.js b/dist/sw.js index a34dba4..d62cc04 100755 --- a/dist/sw.js +++ b/dist/sw.js @@ -3,8 +3,8 @@ // Change version to cause cache refresh -const static_cache_name = "site-static-1.0.13-beta-db70845"; -// commit before the latest is db70845685ffe5fa725530ca03ba4c72e822e450 +const static_cache_name = "site-static-1.0.13-beta-3f938cc"; +// commit before the latest is 3f938cc55a938da9cd7bf4151eb442b580ae4546 // Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js // sw.js NE SME BITI CACHAN, ker vsebuje verzijo! -- cgit v1.2.3