chore (sidebar): display rules

This commit is contained in:
MickaelK 2024-12-13 10:11:01 +11:00
parent 44f4cc74f0
commit b787403a1e

View file

@ -19,8 +19,7 @@ const mv = (from, to) => withVirtualLayer(
);
export default async function ctrlSidebar(render, nRestart = 0) {
if (new URL(location.toString()).searchParams.get("nav") === "false") return;
else if (document.body.clientWidth < 850) return;
if (!shouldDisplay()) return;
const $sidebar = render(createElement(`
<div class="component_sidebar"><div>
@ -251,6 +250,13 @@ function checkVisible($el) {
rect.right <= (window.innerWidth || document.documentElement.clientWidth);
}
function shouldDisplay() {
if (new URL(location.toString()).searchParams.get("nav") === "false") return false;
else if (window.self !== window.top) return false;
else if (document.body.clientWidth < 850) return false;
return true;
}
class PathChunk {
constructor() {
this.pathname = [""].concat(fromHref(