From a8e1c253941584c9fb7fc5f11a5709a10d475710 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 9 May 2023 22:20:11 +0200 Subject: [PATCH] settings: Add animations switch --- config/config.json | 1 + css/main.css | 3 +++ index.html | 8 ++++++++ js/dom.js | 1 + js/main.js | 16 ++++++++++++++++ 5 files changed, 29 insertions(+) diff --git a/config/config.json b/config/config.json index af5da46..0a6bc2d 100644 --- a/config/config.json +++ b/config/config.json @@ -8,6 +8,7 @@ "dark_mode": false, "open_new_tab": false, "blur": true, + "animations": true, "hosted_by": "somebody" }, "services": [ diff --git a/css/main.css b/css/main.css index 4bd2dc4..ce7c64b 100644 --- a/css/main.css +++ b/css/main.css @@ -30,6 +30,9 @@ body { .noblur { --blur: blur(0); } +.noanim * { + transition: none !important; +} ::-webkit-scrollbar { display: none; diff --git a/index.html b/index.html index 58bbe8e..0d4ce29 100644 --- a/index.html +++ b/index.html @@ -114,6 +114,14 @@
+
+
animation
+
+
Animations
+
Show nice and fancy page transitions, improves experience
+
+
+
diff --git a/js/dom.js b/js/dom.js index fa6c772..3a1bf89 100644 --- a/js/dom.js +++ b/js/dom.js @@ -89,6 +89,7 @@ function load_config(conf) { switch_theme(get_bool("dark_mode")); new_tab_toggle(get_bool("open_new_tab")); blur_toggle(get_bool("blur")); + animations(get_bool("animations")); } function is_secure(uri) { diff --git a/js/main.js b/js/main.js index fe8029c..4329f3e 100644 --- a/js/main.js +++ b/js/main.js @@ -92,6 +92,22 @@ function blur_toggle(value) { } } +function animations(value) { + let v = get_bool("animations"); + if (value === undefined) v = !v; + config("animations", v); + setting = get("setting-animations").classList; + let body = document.body.classList; + if (v) { + setting.add("checked"); + body.remove("noanim"); + } + else { + setting.remove("checked"); + body.add("noanim"); + } +} + function reset_all_settings() { if (check_cookies()) localStorage.clear(); load_config(CONFIG_DEFAULT);