diff options
Diffstat (limited to 'view/theme')
-rw-r--r-- | view/theme/redbasic/css/style.css | 19 | ||||
-rw-r--r-- | view/theme/redbasic/js/redbasic.js | 63 | ||||
-rw-r--r-- | view/theme/redbasic/php/config.php | 145 | ||||
-rw-r--r-- | view/theme/redbasic/schema/Focus-Boxy.css | 8 |
4 files changed, 123 insertions, 112 deletions
diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 85f5939f8..36023e511 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -508,8 +508,8 @@ footer { } .contact-block-img { - width: 2.94rem; - height: 2.94rem; + width: 2.92rem; + height: 2.92rem; margin-bottom: 3px; } @@ -953,6 +953,7 @@ a .drop-icons:hover { } .wall-item-pinned i { + display: inline-block; transform: rotate(45deg); } @@ -1252,17 +1253,23 @@ a .drop-icons:hover { } main.fullscreen { + position: fixed; + top: 0px; left: 0px; - width: 100%; + width: 100vw; height: 100vh; - max-width: none; + z-index: 1020; + overflow: auto; } main.fullscreen .generic-content-wrapper { - position: absolute; - width: 100%; + position: fixed; top: 0px; left: 0px; + width: 100vw; + height: 100vh; + z-index: 1020; + overflow: auto; border-radius: 0px; border-width: 0px; } diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index 9336b7866..144714b50 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -2,8 +2,8 @@ * redbasic theme specific JavaScript */ -let redbasic_dark_mode = localStorage.getItem('redbasic_dark_mode'); -let redbasic_theme_color = localStorage.getItem('redbasic_theme_color'); +const redbasic_dark_mode = localStorage.getItem('redbasic_dark_mode'); +const redbasic_theme_color = localStorage.getItem('redbasic_theme_color'); if (redbasic_dark_mode == 1) { document.documentElement.setAttribute('data-bs-theme', 'dark'); @@ -41,19 +41,19 @@ document.addEventListener('DOMContentLoaded', function () { darkElements.forEach(el => el.setAttribute('data-bs-theme', 'light')); } - let navBackgroundColor = document.querySelector('nav').style.backgroundColor; + const navBackgroundColor = document.querySelector('nav').style.backgroundColor; if (redbasic_theme_color !== navBackgroundColor) { document.querySelector('meta[name=theme-color]').setAttribute('content', navBackgroundColor); localStorage.setItem('redbasic_theme_color', navBackgroundColor); } // CSS3 calc() fallback (for unsupported browsers) - let testElem = document.createElement('div'); + const testElem = document.createElement('div'); testElem.style.width = 'calc(10px + 10px)'; testElem.style.display = 'none'; testElem.id = 'css3-calc'; document.body.appendChild(testElem); - + if (testElem.offsetWidth === 10) { window.addEventListener('resize', function () { if (window.innerWidth < 992) { @@ -66,10 +66,20 @@ document.addEventListener('DOMContentLoaded', function () { testElem.remove(); // Remove the test element if (window.innerWidth < 1200) { - let rightAsideWrapper = document.getElementById("right_aside_wrapper"); - let leftAsideWrapper = document.getElementById("left_aside_wrapper"); - leftAsideWrapper.appendChild(...rightAsideWrapper.children); - document.getElementById('notifications_wrapper').classList.add('d-none'); + const rightAsideWrapper = document.getElementById("right_aside_wrapper"); + const leftAsideWrapper = document.getElementById("left_aside_wrapper"); + const notificationsWrapper = document.getElementById("notifications_wrapper"); + + if (leftAsideWrapper && rightAsideWrapper) { + const children = rightAsideWrapper.children; + if (children.length) { + leftAsideWrapper.append(...children); + } + } + + if (notificationsWrapper) { + notificationsWrapper.classList.add('d-none'); + } } if (document.getElementById('region_1')) { @@ -92,7 +102,7 @@ document.addEventListener('DOMContentLoaded', function () { }); document.getElementById('theme-switch').addEventListener('click', function () { - let html = document.documentElement; + const html = document.documentElement; if (html.getAttribute('data-bs-theme') === 'dark') { let nav = document.querySelector('nav'); if (nav.dataset.bsTheme === 'dark') { @@ -118,23 +128,12 @@ document.addEventListener('DOMContentLoaded', function () { }); document.getElementById('menu-btn').addEventListener('click', function () { - let navCollapse = document.getElementById('navbar-collapse-1'); - if (navCollapse.classList.contains('show')) { + const navCollapse = document.getElementById('navbar-collapse-1'); + if (navCollapse && navCollapse.classList.contains('show')) { navCollapse.classList.remove('show'); } }); - document.querySelectorAll('.notifications-btn').forEach(function (element) { - element.addEventListener('click', function (e) { - e.preventDefault(); - e.stopPropagation(); - let navCollapse = document.getElementById('navbar-collapse-2'); - if (navCollapse.classList.contains('show')) { - navCollapse.classList.remove('show'); - } - }); - }); - $("input[data-role=cat-tagsinput]").tagsinput({ tagClass: 'badge rounded-pill bg-warning text-dark' }); @@ -146,7 +145,7 @@ document.addEventListener('DOMContentLoaded', function () { }); }); - let doctitle = document.title; + const doctitle = document.title; function checkNotify() { let notifyUpdateElem = document.getElementById('notify-update'); if (notifyUpdateElem && notifyUpdateElem.innerHTML !== '') { @@ -159,7 +158,7 @@ document.addEventListener('DOMContentLoaded', function () { setInterval(checkNotify, 10 * 1000); let touch_start = null; - let touch_max = window.innerWidth / 10; + const touch_max = window.innerWidth / 10; window.addEventListener('touchstart', function (e) { if (e.touches.length === 1) { @@ -190,7 +189,7 @@ document.addEventListener('DOMContentLoaded', function () { }); function setStyle(element, cssProperty) { - for (var property in cssProperty) { + for (let property in cssProperty) { element.style[property] = cssProperty[property]; } } @@ -204,8 +203,8 @@ function stickyScroll(sticky, stickyTop, container, topOffset, bottomOffset) { } let stickyHeight = stickyElement.getBoundingClientRect().height; - let stickyTopElement = document.querySelector(stickyTop); - let content = document.querySelector(container); + const stickyTopElement = document.querySelector(stickyTop); + const content = document.querySelector(container); let diff = window.innerHeight - stickyHeight; let h = 0; @@ -246,16 +245,10 @@ function stickyScroll(sticky, stickyTop, container, topOffset, bottomOffset) { function makeFullScreen(full) { if (typeof full === 'undefined' || full === true) { document.querySelector('main').classList.add('fullscreen'); - document.querySelector('header').style.display = 'none'; - document.querySelector('nav').style.display = 'none'; - document.querySelector('aside').style.display = 'none'; document.getElementById('fullscreen-btn').style.display = 'none'; - document.getElementById('inline-btn').style.display = 'block'; + document.getElementById('inline-btn').style.display = 'inline-block'; } else { document.querySelector('main').classList.remove('fullscreen'); - document.querySelector('header').style.display = ''; - document.querySelector('nav').style.display = ''; - document.querySelector('aside').style.display = ''; document.getElementById('fullscreen-btn').style.display = ''; document.getElementById('inline-btn').style.display = 'none'; } diff --git a/view/theme/redbasic/php/config.php b/view/theme/redbasic/php/config.php index 6d2707493..87915bd18 100644 --- a/view/theme/redbasic/php/config.php +++ b/view/theme/redbasic/php/config.php @@ -4,6 +4,7 @@ namespace Zotlabs\Theme; use ScssPhp\ScssPhp\Compiler; use ScssPhp\ScssPhp\OutputStyle; +use ScssPhp\ScssPhp\ValueConverter; class RedbasicConfig { @@ -68,85 +69,89 @@ class RedbasicConfig { } if (isset($_POST['redbasic-settings-submit'])) { - if (isset($_POST['redbasic_primary_color']) || isset($_POST['redbasic_radius'])) { - - $primary_color = ''; - $success_color = ''; - $info_color = ''; - $warning_color = ''; - $danger_color = ''; - $radius = floatval($_POST['redbasic_radius']); - - if (preg_match('/^#([A-Fa-f0-9]{3}){1,2}$/', $_POST['redbasic_primary_color'])) { - $primary_color = $_POST['redbasic_primary_color']; + $primary_color = ''; + $color_changed = false; + $success_color = ''; + $info_color = ''; + $warning_color = ''; + $danger_color = ''; + $radius = floatval($_POST['redbasic_radius']); + $radius_changed = $_POST['redbasic_radius'] !== get_pconfig(local_channel(),'redbasic', 'radius'); + + if (preg_match('/^#([A-Fa-f0-9]{3}){1,2}$/', $_POST['redbasic_primary_color'])) { + if (!$color_changed) { + $color_changed = $_POST['redbasic_primary_color'] !== get_pconfig(local_channel(),'redbasic', 'primary_color'); } - if (preg_match('/^#([A-Fa-f0-9]{3}){1,2}$/', $_POST['redbasic_success_color'])) { - $success_color = $_POST['redbasic_success_color']; + $primary_color = $_POST['redbasic_primary_color']; + } + if (preg_match('/^#([A-Fa-f0-9]{3}){1,2}$/', $_POST['redbasic_success_color'])) { + if (!$color_changed) { + $color_changed = $_POST['redbasic_success_color'] !== get_pconfig(local_channel(),'redbasic', 'success_color'); } - if (preg_match('/^#([A-Fa-f0-9]{3}){1,2}$/', $_POST['redbasic_info_color'])) { - $info_color = $_POST['redbasic_info_color']; + $success_color = $_POST['redbasic_success_color']; + } + if (preg_match('/^#([A-Fa-f0-9]{3}){1,2}$/', $_POST['redbasic_info_color'])) { + if (!$color_changed) { + $color_changed = $_POST['redbasic_info_color'] !== get_pconfig(local_channel(),'redbasic', 'info_color'); } - if (preg_match('/^#([A-Fa-f0-9]{3}){1,2}$/', $_POST['redbasic_warning_color'])) { - $warning_color = $_POST['redbasic_warning_color']; + $info_color = $_POST['redbasic_info_color']; + } + if (preg_match('/^#([A-Fa-f0-9]{3}){1,2}$/', $_POST['redbasic_warning_color'])) { + if (!$color_changed) { + $color_changed = $_POST['redbasic_warning_color'] !== get_pconfig(local_channel(),'redbasic', 'warning_color'); } - if (preg_match('/^#([A-Fa-f0-9]{3}){1,2}$/', $_POST['redbasic_danger_color'])) { - $danger_color = $_POST['redbasic_danger_color']; + $warning_color = $_POST['redbasic_warning_color']; + } + if (preg_match('/^#([A-Fa-f0-9]{3}){1,2}$/', $_POST['redbasic_danger_color'])) { + if (!$color_changed) { + $color_changed = $_POST['redbasic_danger_color'] !== get_pconfig(local_channel(),'redbasic', 'danger_color'); } + $danger_color = $_POST['redbasic_danger_color']; + } + + if (!$primary_color && !$success_color && !$info_color && !$warning_color && !$danger_color && !$radius) { + set_pconfig(local_channel(), 'redbasic', 'bootstrap', ''); + } + else if ($color_changed || $radius_changed) { + try { + $compiler = new Compiler(); + $compiler->setImportPaths('vendor/twbs/bootstrap/scss'); + $compiler->setOutputStyle(OutputStyle::COMPRESSED); + + // Set Variables + if ($primary_color) { + $variables['$primary'] = ValueConverter::parseValue($primary_color); + } + if ($success_color) { + $variables['$success'] = ValueConverter::parseValue($success_color); + } + if ($info_color) { + $variables['$info'] = ValueConverter::parseValue($info_color); + } + if ($warning_color) { + $variables['$warning'] = ValueConverter::parseValue($warning_color); + } + if ($danger_color) { + $variables['$danger'] = ValueConverter::parseValue($danger_color); + } + if ($radius) { + $variables['$border-radius'] = ValueConverter::parseValue($radius . 'rem'); + $variables['$border-radius-sm'] = ValueConverter::parseValue($radius/1.5 . 'rem'); + $variables['$border-radius-lg'] = ValueConverter::parseValue($radius*1.333 . 'rem'); + $variables['$border-radius-xl'] = ValueConverter::parseValue($radius*2.666 . 'rem'); + $variables['$border-radius-xxl'] = ValueConverter::parseValue($radius*5.333 . 'rem'); + } - if ($primary_color || $success_color || $info_color || $warning_color || $danger_color || $radius) { - - try { - $cache_dir = 'store/[data]/[scss]/'; - if(!is_dir($cache_dir)) { - os_mkdir($cache_dir, STORAGE_DEFAULT_PERMISSIONS, true); - } - - $options = [ - 'cacheDir' => $cache_dir, - 'prefix' => 'redbasic_', - 'forceRefresh' => false - ]; - - $compiler = new Compiler($options); - $compiler->setImportPaths('vendor/twbs/bootstrap/scss'); - $compiler->setOutputStyle(OutputStyle::COMPRESSED); - - // Set Variables - if ($primary_color) { - $variables['$primary'] = $primary_color; - } - if ($success_color) { - $variables['$success'] = $success_color; - } - if ($info_color) { - $variables['$info'] = $info_color; - } - if ($warning_color) { - $variables['$warning'] = $warning_color; - } - if ($danger_color) { - $variables['$danger'] = $danger_color; - } - if ($radius) { - $variables['$border-radius'] = $radius . 'rem'; - $variables['$border-radius-sm'] = $radius/1.5 . 'rem'; - $variables['$border-radius-lg'] = $radius*1.333 . 'rem'; - $variables['$border-radius-xl'] = $radius*2.666 . 'rem'; - $variables['$border-radius-xxl'] = $radius*5.333 . 'rem'; - } - - // Replace Bootstrap Variables with Customizer Variables + // Replace Bootstrap Variables with Customizer Variables + if ($variables) { $compiler->replaceVariables($variables); + } - $bs = $compiler->compileString('@import "bootstrap.scss";'); + $bs = $compiler->compileString('@import "bootstrap.scss";'); - set_pconfig(local_channel(), 'redbasic', 'bootstrap', $bs->getCss()); - } catch (\Exception $e) { - logger('scssphp: Unable to compile content'); - } - } - else { - set_pconfig(local_channel(), 'redbasic', 'bootstrap', ''); + set_pconfig(local_channel(), 'redbasic', 'bootstrap', $bs->getCss()); + } catch (\Exception $e) { + logger('scssphp: Unable to compile content'); } } diff --git a/view/theme/redbasic/schema/Focus-Boxy.css b/view/theme/redbasic/schema/Focus-Boxy.css index 290518e8e..826e53e66 100644 --- a/view/theme/redbasic/schema/Focus-Boxy.css +++ b/view/theme/redbasic/schema/Focus-Boxy.css @@ -1,4 +1,5 @@ -.comment .wall-item-body { +.comment .wall-item-body, +.comment .wall-item-tools-left { padding-left: 3.4rem; } @@ -37,3 +38,8 @@ border-right: 0; border-left: 0; } + +.contact-block-img { + width: 2.89rem; + height: 2.89rem; +} |