aboutsummaryrefslogtreecommitdiffstats
path: root/view/theme/redbasic/js
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-01-26 18:28:40 +0000
committerMario <mario@mariovavti.com>2023-01-26 18:28:40 +0000
commit79b40179b40b0f1539e58a8c2c7d7f914e6b212b (patch)
tree4e4ae56930f3d3599aad1fdcfe6653d8c5e5be32 /view/theme/redbasic/js
parent60c968222f0090757dfc20a00433e926c6180fce (diff)
downloadvolse-hubzilla-79b40179b40b0f1539e58a8c2c7d7f914e6b212b.tar.gz
volse-hubzilla-79b40179b40b0f1539e58a8c2c7d7f914e6b212b.tar.bz2
volse-hubzilla-79b40179b40b0f1539e58a8c2c7d7f914e6b212b.zip
redbasic: implement setting for always light navbar icons and some minor fixes
Diffstat (limited to 'view/theme/redbasic/js')
-rw-r--r--view/theme/redbasic/js/redbasic.js26
1 files changed, 19 insertions, 7 deletions
diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js
index ea74660b4..54d683ce7 100644
--- a/view/theme/redbasic/js/redbasic.js
+++ b/view/theme/redbasic/js/redbasic.js
@@ -5,13 +5,11 @@
let redbasic_dark_mode = localStorage.getItem('redbasic_dark_mode');
let redbasic_theme_color = localStorage.getItem('redbasic_theme_color');
-if (redbasic_dark_mode) {
+if (redbasic_dark_mode === 1) {
$('html').attr('data-bs-theme', 'dark');
- $('#theme-switch-icon').removeClass('fa-moon-o').addClass('fa-sun-o');
}
-else {
+if (redbasic_dark_mode === 0) {
$('html').attr('data-bs-theme', 'light');
- $('#theme-switch-icon').removeClass('fa-sun-o').addClass('fa-moon-o');
}
@@ -21,6 +19,15 @@ if (redbasic_theme_color) {
$(document).ready(function() {
+ if (redbasic_dark_mode === 1) {
+ $('#theme-switch-icon').removeClass('fa-moon-o').addClass('fa-sun-o');
+ $('[data-bs-theme="light"]').attr('data-bs-theme', 'dark');
+ }
+ if (redbasic_dark_mode === 0) {
+ $('#theme-switch-icon').removeClass('fa-sun-o').addClass('fa-moon-o');
+ $('[data-bs-theme="dark"]:not(nav)').attr('data-bs-theme', 'light');
+ }
+
if (redbasic_theme_color != $('nav').css('background-color')) {
$('meta[name=theme-color]').attr('content', $('nav').css('background-color'));
localStorage.setItem('redbasic_theme_color', $('nav').css('background-color'));
@@ -65,12 +72,17 @@ $(document).ready(function() {
$('#theme-switch').click(function() {
if ($('html').attr('data-bs-theme') === 'dark') {
- $('html').attr('data-bs-theme', 'light');
- localStorage.removeItem('redbasic_dark_mode');
+ if ($('nav').data('bs-theme') === 'dark') {
+ $('[data-bs-theme="dark"]:not(nav)').attr('data-bs-theme', 'light');
+ }
+ else {
+ $('[data-bs-theme="dark"]').attr('data-bs-theme', 'light');
+ }
+ localStorage.setItem('redbasic_dark_mode', 0);
$('#theme-switch-icon').removeClass('fa-sun-o').addClass('fa-moon-o');
}
else {
- $('html').attr('data-bs-theme', 'dark');
+ $('[data-bs-theme="light"]').attr('data-bs-theme', 'dark');
localStorage.setItem('redbasic_dark_mode', 1);
$('#theme-switch-icon').removeClass('fa-moon-o').addClass('fa-sun-o');
}