mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-14 20:35:32 +01:00
chore (sidebar): display rules
This commit is contained in:
parent
44f4cc74f0
commit
b787403a1e
1 changed files with 8 additions and 2 deletions
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Reference in a new issue