From 9dc949b62c6b5e3c8872211f71b11714d9d22b22 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 20 Jan 2023 11:05:15 +0000 Subject: native dark theme initial checkin --- view/theme/redbasic/js/redbasic.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'view/theme/redbasic/js') diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index 04469cb85..7584f9421 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -2,6 +2,19 @@ * redbasic theme specific JavaScript */ +let redbasic_dark_mode = localStorage.getItem('redbasic_dark_mode'); + +if (redbasic_dark_mode == 1) { + $('html').attr('data-bs-theme', 'light'); + $('#theme-switch-icon').removeClass('fa-sun-o').addClass('fa-moon-o'); +} + + +if (redbasic_dark_mode == 2) { + $('html').attr('data-bs-theme', 'dark'); + $('#theme-switch-icon').removeClass('fa-moon-o').addClass('fa-sun-o'); +} + $(document).ready(function() { // CSS3 calc() fallback (for unsupported browsers) @@ -40,6 +53,20 @@ $(document).ready(function() { } }); + $('#theme-switch').click(function() { + if ($('html').attr('data-bs-theme') === 'dark') { + $('html').attr('data-bs-theme', 'light'); + localStorage.setItem('redbasic_dark_mode', 1); + $('#theme-switch-icon').removeClass('fa-sun-o').addClass('fa-moon-o'); + } + else { + $('html').attr('data-bs-theme', 'dark'); + localStorage.setItem('redbasic_dark_mode', 2); + $('#theme-switch-icon').removeClass('fa-moon-o').addClass('fa-sun-o'); + } + }); + + $('#menu-btn').click(function() { if($('#navbar-collapse-1').hasClass('show')){ $('#navbar-collapse-1').removeClass('show'); -- cgit v1.2.3 From 2d5e09f93022f8e31986e331f67901fe755ae6ec Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 20 Jan 2023 20:07:37 +0000 Subject: theme fixes --- view/theme/redbasic/js/redbasic.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'view/theme/redbasic/js') diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index 7584f9421..27ad9e15f 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -54,6 +54,8 @@ $(document).ready(function() { }); $('#theme-switch').click(function() { + // $('*').addClass('disable-transition'); + if ($('html').attr('data-bs-theme') === 'dark') { $('html').attr('data-bs-theme', 'light'); localStorage.setItem('redbasic_dark_mode', 1); @@ -64,6 +66,8 @@ $(document).ready(function() { localStorage.setItem('redbasic_dark_mode', 2); $('#theme-switch-icon').removeClass('fa-moon-o').addClass('fa-sun-o'); } + + // setTimeout(() => { $('*').removeClass('disable-transition') }, 100); }); -- cgit v1.2.3 From 56361fa2fc42eefde4794358986187a508c7054e Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 25 Jan 2023 10:59:17 +0000 Subject: theme fixes --- view/theme/redbasic/js/redbasic.js | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'view/theme/redbasic/js') diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index 27ad9e15f..b32042668 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -4,18 +4,20 @@ let redbasic_dark_mode = localStorage.getItem('redbasic_dark_mode'); -if (redbasic_dark_mode == 1) { - $('html').attr('data-bs-theme', 'light'); - $('#theme-switch-icon').removeClass('fa-sun-o').addClass('fa-moon-o'); -} +$(document).ready(function() { + if (redbasic_dark_mode == 1) { + $('html').attr('data-bs-theme', 'light'); + $('meta[name=theme-color]').attr('content', $('nav').css('background-color')); + $('#theme-switch-icon').removeClass('fa-sun-o').addClass('fa-moon-o'); + } -if (redbasic_dark_mode == 2) { - $('html').attr('data-bs-theme', 'dark'); - $('#theme-switch-icon').removeClass('fa-moon-o').addClass('fa-sun-o'); -} -$(document).ready(function() { + if (redbasic_dark_mode == 2) { + $('html').attr('data-bs-theme', 'dark'); + $('meta[name=theme-color]').attr('content', $('nav').css('background-color')); + $('#theme-switch-icon').removeClass('fa-moon-o').addClass('fa-sun-o'); + } // CSS3 calc() fallback (for unsupported browsers) $('body').append(''); @@ -54,8 +56,6 @@ $(document).ready(function() { }); $('#theme-switch').click(function() { - // $('*').addClass('disable-transition'); - if ($('html').attr('data-bs-theme') === 'dark') { $('html').attr('data-bs-theme', 'light'); localStorage.setItem('redbasic_dark_mode', 1); @@ -66,8 +66,7 @@ $(document).ready(function() { localStorage.setItem('redbasic_dark_mode', 2); $('#theme-switch-icon').removeClass('fa-moon-o').addClass('fa-sun-o'); } - - // setTimeout(() => { $('*').removeClass('disable-transition') }, 100); + $('meta[name=theme-color]').attr('content', $('nav').css('background-color')); }); @@ -86,7 +85,7 @@ $(document).ready(function() { }); $("input[data-role=cat-tagsinput]").tagsinput({ - tagClass: 'badge rounded-pill bg-warning text-dark' + tagClass: 'badge rounded-pill bg-warning' }); $('a.disabled').click(function(e) { -- cgit v1.2.3 From 08e925758e920b898ac2d08710eab2f9638fe276 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 25 Jan 2023 13:08:05 +0000 Subject: update fullcalendar library --- view/theme/redbasic/js/redbasic.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'view/theme/redbasic/js') diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index b32042668..f502b2538 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -4,20 +4,19 @@ let redbasic_dark_mode = localStorage.getItem('redbasic_dark_mode'); -$(document).ready(function() { - - if (redbasic_dark_mode == 1) { - $('html').attr('data-bs-theme', 'light'); - $('meta[name=theme-color]').attr('content', $('nav').css('background-color')); - $('#theme-switch-icon').removeClass('fa-sun-o').addClass('fa-moon-o'); - } +if (redbasic_dark_mode == 1) { + $('html').attr('data-bs-theme', 'light'); + $('meta[name=theme-color]').attr('content', $('nav').css('background-color')); + $('#theme-switch-icon').removeClass('fa-sun-o').addClass('fa-moon-o'); +} +if (redbasic_dark_mode == 2) { + $('html').attr('data-bs-theme', 'dark'); + $('meta[name=theme-color]').attr('content', $('nav').css('background-color')); + $('#theme-switch-icon').removeClass('fa-moon-o').addClass('fa-sun-o'); +} - if (redbasic_dark_mode == 2) { - $('html').attr('data-bs-theme', 'dark'); - $('meta[name=theme-color]').attr('content', $('nav').css('background-color')); - $('#theme-switch-icon').removeClass('fa-moon-o').addClass('fa-sun-o'); - } +$(document).ready(function() { // CSS3 calc() fallback (for unsupported browsers) $('body').append(''); -- cgit v1.2.3 From 32dcc28414a43b42e5da082b1781824ecac42bfb Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 25 Jan 2023 14:05:20 +0000 Subject: calendar: fixes --- view/theme/redbasic/js/redbasic.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'view/theme/redbasic/js') diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index f502b2538..ca27bb825 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -84,7 +84,7 @@ $(document).ready(function() { }); $("input[data-role=cat-tagsinput]").tagsinput({ - tagClass: 'badge rounded-pill bg-warning' + tagClass: 'badge rounded-pill bg-warning text-dark' }); $('a.disabled').click(function(e) { -- cgit v1.2.3 From 23f93044c1f511d21dcf612f1052db8801b2a4e0 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 25 Jan 2023 15:22:15 +0000 Subject: update forkawesome lib --- view/theme/redbasic/js/redbasic.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'view/theme/redbasic/js') diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index ca27bb825..7a6d795a4 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -6,18 +6,19 @@ let redbasic_dark_mode = localStorage.getItem('redbasic_dark_mode'); if (redbasic_dark_mode == 1) { $('html').attr('data-bs-theme', 'light'); - $('meta[name=theme-color]').attr('content', $('nav').css('background-color')); $('#theme-switch-icon').removeClass('fa-sun-o').addClass('fa-moon-o'); } if (redbasic_dark_mode == 2) { $('html').attr('data-bs-theme', 'dark'); - $('meta[name=theme-color]').attr('content', $('nav').css('background-color')); $('#theme-switch-icon').removeClass('fa-moon-o').addClass('fa-sun-o'); } + $(document).ready(function() { + $('meta[name=theme-color]').attr('content', $('nav').css('background-color')); + // CSS3 calc() fallback (for unsupported browsers) $('body').append(''); if( $('#css3-calc').width() == 10) { @@ -31,6 +32,7 @@ $(document).ready(function() { } $('#css3-calc').remove(); // Remove the test element + if (document.querySelector('#region_1')) { stickyScroll('.aside_spacer_left', '.aside_spacer_top_left', '.content', parseFloat(window.getComputedStyle(document.querySelector('#region_1')).getPropertyValue('padding-top')), 0); } -- cgit v1.2.3 From c4b37ba462e8f3b9296ca04eeb7fe68d13d7eaee Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 26 Jan 2023 07:22:21 +0000 Subject: theme fixes --- view/theme/redbasic/js/redbasic.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'view/theme/redbasic/js') diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index 7a6d795a4..ea74660b4 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -3,21 +3,28 @@ */ let redbasic_dark_mode = localStorage.getItem('redbasic_dark_mode'); +let redbasic_theme_color = localStorage.getItem('redbasic_theme_color'); -if (redbasic_dark_mode == 1) { +if (redbasic_dark_mode) { + $('html').attr('data-bs-theme', 'dark'); + $('#theme-switch-icon').removeClass('fa-moon-o').addClass('fa-sun-o'); +} +else { $('html').attr('data-bs-theme', 'light'); $('#theme-switch-icon').removeClass('fa-sun-o').addClass('fa-moon-o'); } -if (redbasic_dark_mode == 2) { - $('html').attr('data-bs-theme', 'dark'); - $('#theme-switch-icon').removeClass('fa-moon-o').addClass('fa-sun-o'); -} +if (redbasic_theme_color) { + $('meta[name=theme-color]').attr('content', redbasic_theme_color); +} $(document).ready(function() { - $('meta[name=theme-color]').attr('content', $('nav').css('background-color')); + 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')); + } // CSS3 calc() fallback (for unsupported browsers) $('body').append(''); @@ -59,15 +66,16 @@ $(document).ready(function() { $('#theme-switch').click(function() { if ($('html').attr('data-bs-theme') === 'dark') { $('html').attr('data-bs-theme', 'light'); - localStorage.setItem('redbasic_dark_mode', 1); + localStorage.removeItem('redbasic_dark_mode'); $('#theme-switch-icon').removeClass('fa-sun-o').addClass('fa-moon-o'); } else { $('html').attr('data-bs-theme', 'dark'); - localStorage.setItem('redbasic_dark_mode', 2); + localStorage.setItem('redbasic_dark_mode', 1); $('#theme-switch-icon').removeClass('fa-moon-o').addClass('fa-sun-o'); } $('meta[name=theme-color]').attr('content', $('nav').css('background-color')); + localStorage.setItem('redbasic_theme_color', $('nav').css('background-color')); }); -- cgit v1.2.3 From 79b40179b40b0f1539e58a8c2c7d7f914e6b212b Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 26 Jan 2023 18:28:40 +0000 Subject: redbasic: implement setting for always light navbar icons and some minor fixes --- view/theme/redbasic/js/redbasic.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'view/theme/redbasic/js') 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'); } -- cgit v1.2.3 From 94b26e1e66113d1936aa6f1b944a3161b99e8750 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 26 Jan 2023 18:35:49 +0000 Subject: redbasic: fix regression --- view/theme/redbasic/js/redbasic.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'view/theme/redbasic/js') diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index 54d683ce7..b7036262d 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -5,10 +5,10 @@ let redbasic_dark_mode = localStorage.getItem('redbasic_dark_mode'); let redbasic_theme_color = localStorage.getItem('redbasic_theme_color'); -if (redbasic_dark_mode === 1) { +if (redbasic_dark_mode == 1) { $('html').attr('data-bs-theme', 'dark'); } -if (redbasic_dark_mode === 0) { +if (redbasic_dark_mode == 0) { $('html').attr('data-bs-theme', 'light'); } @@ -19,11 +19,11 @@ if (redbasic_theme_color) { $(document).ready(function() { - if (redbasic_dark_mode === 1) { + 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) { + 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'); } -- cgit v1.2.3 From 65f001b4b7dcf23ee80e137cfca64993a3da5318 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 2 Mar 2023 16:45:10 +0000 Subject: provide a fake progress bar for pwa standalone mode --- view/theme/redbasic/js/redbasic.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'view/theme/redbasic/js') diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index b7036262d..b502ad333 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -13,11 +13,29 @@ if (redbasic_dark_mode == 0) { } + + + if (redbasic_theme_color) { $('meta[name=theme-color]').attr('content', redbasic_theme_color); } + + $(document).ready(function() { + // provide a fake progress bar for pwa standalone mode + if (window.matchMedia('(display-mode: standalone)').matches) { + $(window).on('beforeunload', function(){ + $('
').prependTo('body'); + let w = 10; + setInterval(function () { + $('.page-loader').css('width', w + 'vw'); + if (w < 90) { + w = w+2; + } + }, 10); + }); + } if (redbasic_dark_mode == 1) { $('#theme-switch-icon').removeClass('fa-moon-o').addClass('fa-sun-o'); -- cgit v1.2.3 From 9f10e7e3562dfa161962439fe117e11ba42e6875 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 4 Mar 2023 17:03:37 +0000 Subject: simplify pageloader animation --- view/theme/redbasic/js/redbasic.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'view/theme/redbasic/js') diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index b502ad333..706bf2808 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -26,14 +26,10 @@ $(document).ready(function() { // provide a fake progress bar for pwa standalone mode if (window.matchMedia('(display-mode: standalone)').matches) { $(window).on('beforeunload', function(){ - $('
').prependTo('body'); - let w = 10; - setInterval(function () { - $('.page-loader').css('width', w + 'vw'); - if (w < 90) { - w = w+2; - } - }, 10); + if ($('.page-loader').length) { + return; + } + $('
').prependTo('body'); }); } -- cgit v1.2.3