Inline logo SVG and hide login/logout buttons
- Embed logo SVG directly in PHP output instead of fetching via JS to eliminate the flash of missing logo on page load - Hide login/logout nav items since auth is handled by reverse proxy
This commit is contained in:
@@ -81,7 +81,11 @@ class BockenTheme extends AbstractModule implements ModuleCustomInterface, Modul
|
||||
|
||||
public function bodyContent(): string
|
||||
{
|
||||
$logoUrl = $this->assetUrl('img/logo.svg');
|
||||
$logoSvg = file_get_contents(self::MODULE_RESOURCE_PATH . 'img/logo.svg');
|
||||
// Strip XML declaration, collapse to single line for safe JS string embedding
|
||||
$logoSvg = preg_replace('/<\?xml[^?]*\?>/', '', $logoSvg);
|
||||
$logoSvg = preg_replace('/\s+/', ' ', trim($logoSvg));
|
||||
$logoSvgJs = addcslashes($logoSvg, "'\\");
|
||||
|
||||
return <<<HTML
|
||||
<script src="https://unpkg.com/lucide@latest"></script>
|
||||
@@ -155,20 +159,10 @@ class BockenTheme extends AbstractModule implements ModuleCustomInterface, Modul
|
||||
|
||||
var logoContainer = document.createElement('div');
|
||||
logoContainer.className = 'bocken-logo-container';
|
||||
logoContainer.innerHTML = '<a href="https://bocken.org" class="bocken-logo-link" aria-label="Bocken.org"></a>';
|
||||
|
||||
// Fetch and inline the SVG so parent CSS variables work
|
||||
fetch('{$logoUrl}')
|
||||
.then(function(r) { return r.text(); })
|
||||
.then(function(svgText) {
|
||||
var wrapper = document.createElement('div');
|
||||
wrapper.className = 'bocken-logo';
|
||||
wrapper.innerHTML = svgText;
|
||||
logoContainer.querySelector('a').appendChild(wrapper);
|
||||
updateLogoFill();
|
||||
});
|
||||
logoContainer.innerHTML = '<a href="https://bocken.org" class="bocken-logo-link" aria-label="Bocken.org"><div class="bocken-logo">{$logoSvgJs}</div></a>';
|
||||
|
||||
titleEl.parentNode.insertBefore(logoContainer, titleEl);
|
||||
updateLogoFill();
|
||||
}
|
||||
|
||||
// --- Theme toggle button injection ---
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -864,8 +864,10 @@ a:hover,
|
||||
.menu-pending .nav-link::before { background-image: url("../img/shield-alt-solid.svg"); }
|
||||
.menu-mymenu .nav-link::before { background-image: url("../img/user-solid.svg"); }
|
||||
.menu-language .nav-link::before { background-image: url("../img/language-solid.svg"); }
|
||||
.menu-logout .nav-link::before { background-image: url("../img/sign-out-alt-solid.svg"); }
|
||||
.menu-login .nav-link::before { background-image: url("../img/sign-in-alt-solid.svg"); }
|
||||
.menu-logout,
|
||||
.menu-login {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
// Hide header search (redundant — Search dropdown exists in primary nav)
|
||||
|
||||
Reference in New Issue
Block a user