DSH-Arch-Setup/plugins/dsh-compact-sidebar/lib/client.js
Шурупов Илья Викторович cf9443753e Add one-command Arch DSH setup
Package the portable DSH profiles, local plugins, desktop integration, Firefox wrapper, and ownership-aware installer lifecycle. Bundle checksum-pinned OpenVSCode, editor extensions, translation assets, and cloudflared so unreliable upstream artifact downloads cannot break a clean installation.
2026-09-12 19:13:36 +03:00

80 lines
2.8 KiB
JavaScript

/**
* dsh-compact-sidebar — browser half.
*
* Reclaims the top of the sidebar by fully hiding chrome, rather than merely
* shrinking it:
* • the logo row (`.logoRow` — the "deepseek HARNESS" brand)
* • the New Session button (`.newSession`)
*
* NOTE: the sidebar collapse / panel-toggle button lives INSIDE the logo row,
* so hiding the whole row removes it too. If you want to keep the collapse
* toggle, set HIDE_LOGO_ROW = false below (the brand text can be hidden on its
* own via HIDE_BRAND_ONLY instead).
*
* The CSS-module classes are content-hashed (e.g. `hHd-Xa_logoRow`) and the
* hash changes between builds, so we match on the stable suffix with
* attribute-substring selectors like `[class*="_logoRow"]`.
* @module dsh-compact-sidebar/client
*/
window.__ModuleLoader__.load({
id: "dsh-compact-sidebar",
factory: (require) => {
var module = { exports: {} };
var exports = module.exports;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
// ---- CONFIG (edit here) -----------------------------------------------
// Remove the entire logo row (brand + the collapse/panel-toggle button).
const HIDE_LOGO_ROW = true;
// Remove the New Session button.
const HIDE_NEW_SESSION = true;
// Alternative to HIDE_LOGO_ROW: keep the row (and its collapse toggle) but
// hide only the brand text/logo. Ignored when HIDE_LOGO_ROW is true.
const HIDE_BRAND_ONLY = false;
// -----------------------------------------------------------------------
const rules = [];
if (HIDE_LOGO_ROW) {
rules.push('[class*="_root"] [class*="_logoRow"]{display:none !important;}');
} else if (HIDE_BRAND_ONLY) {
rules.push('[class*="_root"] [class*="_brand"]{display:none !important;}');
}
if (HIDE_NEW_SESSION) {
rules.push('[class*="_root"] [class*="_newSession"]{display:none !important;}');
}
const STYLE_ID = "dsh-compact-sidebar-style";
const cssText = rules.join("");
/** Insert (or update) the override <style>, returning a cleanup fn. */
function install() {
let el = document.getElementById(STYLE_ID);
if (!el) {
el = document.createElement("style");
el.id = STYLE_ID;
(document.head || document.documentElement).appendChild(el);
}
el.textContent = cssText;
return () => {
const node = document.getElementById(STYLE_ID);
if (node) node.remove();
};
}
/** No client services required — this is pure CSS. */
const inject = [];
/** Client plugin body: inject the sidebar hiding (HMR-safe cleanup). */
function apply(ctx) {
if (ctx && typeof ctx.effect === "function") {
ctx.effect(install, "dsh-compact-sidebar: hide brand + New Session");
} else {
install();
}
}
exports.apply = apply;
exports.inject = inject;
return module.exports;
},
});