import { CSS } from "../helpers/loader.js"; const isRunningFromAnIframe = window.self !== window.top; class ComponentBreadcrumb extends HTMLDivElement { constructor() { super(); if (new window.URL(location.href).searchParams.get("nav") === "false") return null; const htmlLogout = isRunningFromAnIframe ? "" : ` power `; const paths = (this.getAttribute("path") || "").split("/"); const htmlPathChunks = paths.slice(0, -1).map((chunk, idx) => { const label = idx === 0 ? "Filestash" : chunk; const link = paths.slice(0, idx).join("/") + "/"; // const minify = () => { // if (idx === 0) return false; // else if (paths.length <= (document.body.clientWidth > 800 ? 5 : 4)) return false; // else if (idx > paths.length - (document.body.clientWidth > 1000 ? 4 : 3)) return false; // return true; // }; const limitSize = (word) => { // TODO return word; }; const isLast = idx === paths.length - 1; if (isLast) { return `
${label}
`; } return `
${limitSize(label)}
path_separator
`; }).join(""); this.render({ htmlLogout, htmlPathChunks }); } async render({ htmlLogout, htmlPathChunks }) { const css = await CSS(import.meta.url, "breadcrumb.css"); this.innerHTML = ` `; } } customElements.define("component-breadcrumb", ComponentBreadcrumb, { extends: "div" });