diff options
Diffstat (limited to 'view/theme')
-rw-r--r-- | view/theme/redbasic/css/narrow_navbar.css | 10 | ||||
-rw-r--r-- | view/theme/redbasic/css/style.css | 46 | ||||
-rw-r--r-- | view/theme/redbasic/js/redbasic.js | 54 | ||||
-rw-r--r-- | view/theme/redbasic/php/config.php | 8 | ||||
-rw-r--r-- | view/theme/redbasic/php/theme.php | 22 | ||||
-rw-r--r-- | view/theme/redbasic/php/theme_init.php | 25 |
6 files changed, 49 insertions, 116 deletions
diff --git a/view/theme/redbasic/css/narrow_navbar.css b/view/theme/redbasic/css/narrow_navbar.css index 7a48fc71e..9f915418e 100644 --- a/view/theme/redbasic/css/narrow_navbar.css +++ b/view/theme/redbasic/css/narrow_navbar.css @@ -4,16 +4,6 @@ --bs-navbar-padding-y: 1px; } - .contextual-help-content-open { - top: 2.5rem; - } - - #region_1, - #region_2, - #region_3 { - padding-top: 3.5rem; - } - #jGrowl.top-right { top: 3.5rem; right: 15px; diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index b20977f28..3bf5d5f20 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -608,7 +608,7 @@ nav .acpopup { padding: 3px; border: 0px solid var(--bs-border-color); border-radius: var(--bs-border-radius); - background-color: #fff; + background-color: var(--bs-body-bg); z-index: 1052; } @@ -1378,38 +1378,6 @@ blockquote { background-color: var(--bs-tertiary-bg); } -.navbar { - z-index:1030; -} - - - -@media screen and (max-width: 992px) { - - main { - left: -$left_aside_widthrem; - width: calc( 100% + $left_aside_widthrem ); - } - - main.region_1-on { - left: 0px; - } - - #nav-app-link-wrapper { - min-width: 0; - } - - #nav-app-link-wrapper { - margin-right: 0.5rem; - } - - #navbar-collapse-2 .navbar-app i { - font-size: 1rem; - margin-right: 0.5rem; - } - -} - .shareable_element_text { height: 300px; width: 300px; @@ -1513,10 +1481,6 @@ dl.bb-dl > dd > li { font-weight: normal; } -.onoffswitch.checkbox:hover label { - color: var(--bs-link-color); -} - .onoffswitch.checkbox:hover > div label { border-color: var(--bs-link-color); } @@ -1534,21 +1498,21 @@ dl.bb-dl > dd > li { .onoffswitch-inner:before { content: attr(data-on); padding-right: 21px; - background-color: rgba(var(--bs-body-color-rgb), 0); + background-color: var(--bs-secondary-bg); text-align: right; } .onoffswitch-inner:after { content: attr(data-off); padding-left: 21px; - background-color: rgba(var(--bs-body-color-rgb), 0); - color: var(--bs-border-color); + background-color: var(--bs-secondary-bg); text-align: left; } .onoffswitch-switch { display: block; width: 15px; margin:4px; - background: var(--bs-secondary-bg); + background: var(--bs-tertiary-color); + color: var(--bs-secondary-color); border-radius: 10px; position: absolute; top: 0; bottom: 0; right: 36px; transition: right 0.2s ease-in-out; diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index 706bf2808..0f2617cc0 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -8,20 +8,15 @@ let redbasic_theme_color = localStorage.getItem('redbasic_theme_color'); if (redbasic_dark_mode == 1) { $('html').attr('data-bs-theme', 'dark'); } + if (redbasic_dark_mode == 0) { $('html').attr('data-bs-theme', 'light'); } - - - - 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) { @@ -60,24 +55,20 @@ $(document).ready(function() { } $('#css3-calc').remove(); // Remove the test element + if($(window).width() < 1200) { + $("#right_aside_wrapper").children().detach().appendTo('#left_aside_wrapper'); + $('#notifications_wrapper').addClass('d-none'); + } + 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); + stickyScroll('.aside_spacer_left', '.aside_spacer_top_left', 'section', parseFloat(document.querySelector('main').getBoundingClientRect().top), 20); } if (document.querySelector('#region_3')) { - stickyScroll('.aside_spacer_right', '.aside_spacer_top_right', '.content', parseFloat(window.getComputedStyle(document.querySelector('#region_3')).getPropertyValue('padding-top')), 20); + stickyScroll('.aside_spacer_right', '.aside_spacer_top_right', 'section', parseFloat(document.querySelector('main').getBoundingClientRect().top), 20); } - $('#expand-aside').on('click', function() { - if($('main').hasClass('region_1-on')){ - toggleAside('left'); - } - else { - toggleAside('right'); - } - }); - $('.usermenu').click(function() { if($('#navbar-collapse-1, #navbar-collapse-2').hasClass('show')){ $('#navbar-collapse-1, #navbar-collapse-2').removeClass('show'); @@ -148,7 +139,7 @@ $(document).ready(function() { //just one finger touched touch_start = e.touches.item(0).clientX; if (touch_start < touch_max) { - $('html, body').css('overflow-y', 'hidden'); + $('body').css('overflow-y', 'hidden'); } } else { @@ -158,7 +149,7 @@ $(document).ready(function() { }); window.addEventListener('touchend', function(e) { - $('html, body').css('overflow-y', ''); + $('body').css('overflow-y', ''); let touch_offset = 30; //at least 30px are a swipe if (touch_start) { @@ -168,20 +159,15 @@ $(document).ready(function() { if (touch_end > (touch_start + touch_offset)) { //a left -> right swipe if (touch_start < touch_max) { - toggleAside('right'); + toggleAside(); } } if (touch_end < (touch_start - touch_offset)) { //a right -> left swipe - //toggleAside('left'); } } }); - $(document).on('hz:hqControlsClickAction', function(e) { - toggleAside('left'); - }); - }); function setStyle(element, cssProperty) { @@ -229,12 +215,12 @@ function stickyScroll(sticky, stickyTop, container, topOffset, bottomOffset) { setStyle(sticky, { position: 'sticky', top: Math.round(diff) - bottomOffset + 'px', bottom: '' }); } else { // upscroll code - h = sticky.getBoundingClientRect().top - content.getBoundingClientRect().top - topOffset; + h = sticky.getBoundingClientRect().top - content.getBoundingClientRect().top; if(Math.round(stickyTop.getBoundingClientRect().height) === lasth) { setStyle(stickyTop, { height: Math.round(h) + 'px' }); } lasth = Math.round(h); - setStyle(sticky, { position: 'sticky', top: '', bottom: Math.round(diff - topOffset) + 'px' }); + setStyle(sticky, { position: 'sticky', top: '', bottom: Math.round(diff) - topOffset + 'px' }); } lastScrollTop = st <= 0 ? 0 : st; // For Mobile or negative scrolling } @@ -255,18 +241,4 @@ function makeFullScreen(full) { } } -function toggleAside(swipe) { - if ($('main').hasClass('region_1-on') && swipe === 'left') { - $('#expand-aside-icon').addClass('fa-arrow-circle-right').removeClass('fa-arrow-circle-left'); - $('html, body').css({ 'position': '', left: '' }); - $('main').removeClass('region_1-on'); - $('#overlay').remove(); - } - if (!$('main').hasClass('region_1-on') && swipe === 'right') { - $('#expand-aside-icon').removeClass('fa-arrow-circle-right').addClass('fa-arrow-circle-left'); - $('html, body').css({ 'position': 'sticky', 'left': '0px'}); - $('main').addClass('region_1-on'); - $('<div id="overlay"></div>').appendTo('body').one('click', function() { toggleAside('left'); }); - } -} diff --git a/view/theme/redbasic/php/config.php b/view/theme/redbasic/php/config.php index b4cb281b9..344f3ff68 100644 --- a/view/theme/redbasic/php/config.php +++ b/view/theme/redbasic/php/config.php @@ -129,7 +129,15 @@ class RedbasicConfig { } +function redbasic_theme_admin_enable() { + // This function is called once when the theme is being enabled by the admin + // It can be used to register hooks etc. +} +function redbasic_theme_admin_disable() { + // This function is called once when the theme is being disabled by the admin + // It can be used to unregister hooks etc. +} diff --git a/view/theme/redbasic/php/theme.php b/view/theme/redbasic/php/theme.php index b7e08705c..c33c4f78e 100644 --- a/view/theme/redbasic/php/theme.php +++ b/view/theme/redbasic/php/theme.php @@ -14,26 +14,6 @@ */ -function redbasic_init(&$a) { +function redbasic_init() { - $mode = ''; - $navbar_mode = ''; - - if (local_channel()) { - $mode = ((get_pconfig(local_channel(), 'redbasic', 'dark_mode')) ? 'dark' : 'light'); - $navbar_mode = ((get_pconfig(local_channel(), 'redbasic', 'navbar_dark_mode')) ? 'dark' : 'light'); - } - - if (App::$profile_uid) { - $mode = ((get_pconfig(App::$profile_uid, 'redbasic', 'dark_mode')) ? 'dark' : 'light'); - $navbar_mode = ((get_pconfig(App::$profile_uid, 'redbasic', 'navbar_dark_mode')) ? 'dark' : 'light'); - } - - if (!$mode) { - $mode = ((get_config('redbasic', 'dark_mode')) ? 'dark' : 'light'); - $navbar_mode = ((get_config('redbasic', 'navbar_dark_mode')) ? 'dark' : 'light'); - } - - App::$page['color_mode'] = 'data-bs-theme="' . $mode . '"'; - App::$page['navbar_color_mode'] = (($navbar_mode === 'dark') ? 'data-bs-theme="' . $navbar_mode . '"' : ''); } diff --git a/view/theme/redbasic/php/theme_init.php b/view/theme/redbasic/php/theme_init.php index 0ac580f0e..cb81165b1 100644 --- a/view/theme/redbasic/php/theme_init.php +++ b/view/theme/redbasic/php/theme_init.php @@ -1,15 +1,34 @@ <?php +require_once('view/php/theme_init.php'); head_add_css('/library/fork-awesome/css/fork-awesome.min.css'); head_add_css('/vendor/twbs/bootstrap/dist/css/bootstrap.min.css'); head_add_css('/library/bootstrap-tagsinput/bootstrap-tagsinput.css'); head_add_css('/view/css/bootstrap-red.css'); -head_add_css('/library/datetimepicker/jquery.datetimepicker.css'); head_add_css('/library/bootstrap-colorpicker/dist/css/bootstrap-colorpicker.min.css'); -require_once('view/php/theme_init.php'); head_add_js('/vendor/twbs/bootstrap/dist/js/bootstrap.bundle.min.js'); head_add_js('/library/bootbox/bootbox.min.js'); head_add_js('/library/bootstrap-tagsinput/bootstrap-tagsinput.js'); -head_add_js('/library/datetimepicker/jquery.datetimepicker.js'); head_add_js('/library/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.js'); + +$redbasic_mode = ''; +$redbasic_navbar_mode = ''; + +if (local_channel()) { + $redbasic_mode = ((get_pconfig(local_channel(), 'redbasic', 'dark_mode')) ? 'dark' : 'light'); + $redbasic_navbar_mode = ((get_pconfig(local_channel(), 'redbasic', 'navbar_dark_mode')) ? 'dark' : 'light'); +} + +if (App::$profile_uid) { + $redbasic_mode = ((get_pconfig(App::$profile_uid, 'redbasic', 'dark_mode')) ? 'dark' : 'light'); + $redbasic_navbar_mode = ((get_pconfig(App::$profile_uid, 'redbasic', 'navbar_dark_mode')) ? 'dark' : 'light'); +} + +if (!$redbasic_mode) { + $redbasic_mode = ((get_config('redbasic', 'dark_mode')) ? 'dark' : 'light'); + $redbasic_navbar_mode = ((get_config('redbasic', 'navbar_dark_mode')) ? 'dark' : 'light'); +} + +App::$page['color_mode'] = 'data-bs-theme="' . $redbasic_mode . '"'; +App::$page['navbar_color_mode'] = (($redbasic_navbar_mode === 'dark') ? 'data-bs-theme="' . $redbasic_navbar_mode . '"' : ''); |