diff --git a/plugin.php b/plugin.php
index 353707d..b83b64c 100644
--- a/plugin.php
+++ b/plugin.php
@@ -1,29 +1,14 @@
dbFields = array(
- // Label shown at the top of the sidebar and in the mobile drawer.
'title' => 'On this page',
- // Pixel offset to clear the fixed navbar when jumping to a heading.
'navbarHeight' => 80,
- // Viewport width (px) at which the fixed sidebar appears.
- // Below this width the mobile floating-button drawer is used instead.
'minWidth' => 1280,
);
}
- // ---- Admin settings form ----
-
public function form() {
global $L;
@@ -34,40 +19,59 @@ class PluginBluditToc extends Plugin {
$h = '';
$h .= '
';
- $h .= '' . $L->get('Sidebar title') . ' ';
- $h .= ' ';
+ $h .= '' . $L->get('Sidebar title') . ' ';
+ $h .= ' ';
$h .= '
';
$h .= '';
- $h .= '' . $L->get('Navbar height (px)') . ' ';
- $h .= ' ';
- $h .= '' . $L->get('Used to offset hash-jump anchors so they clear the fixed navbar.') . ' ';
+ $h .= '' . $L->get('Navbar height (px)') . ' ';
+ $h .= ' ';
+ $h .= '' . $L->get('Pixel offset applied to heading anchors to clear a fixed navbar.') . ' ';
$h .= '
';
$h .= '';
- $h .= '' . $L->get('Fixed sidebar min-width (px)') . ' ';
- $h .= ' ';
- $h .= '' . $L->get('Viewport widths below this value use the mobile floating button instead.') . ' ';
+ $h .= '' . $L->get('Sidebar min viewport width (px)') . ' ';
+ $h .= ' ';
+ $h .= '' . $L->get('Below this width the mobile floating button is shown instead.') . ' ';
$h .= '
';
return $h;
}
- // ---- Front-end hooks ----
-
- /**
- * Inject the plugin CSS in .
- */
public function siteHead() {
- $url = DOMAIN_PLUGINS . $this->directoryName . '/toc.css';
- return ' ' . PHP_EOL;
+ return '' . PHP_EOL;
}
- /**
- * Inject the ToC sidebar container right after .
- * It is position:fixed, so placement in the DOM doesn't affect layout.
- * JS will populate and mark the container visible.
- */
public function siteBodyBegin() {
$title = htmlspecialchars($this->getValue('title'), ENT_QUOTES, 'UTF-8');
return '' . PHP_EOL;
}
- /**
- * Inject config + script just before .
- * Config is passed via window.BLTOC so the JS file stays cache-friendly.
- */
public function siteBodyEnd() {
$title = json_encode($this->getValue('title'));
$navbarHeight = (int) $this->getValue('navbarHeight');
$minWidth = (int) $this->getValue('minWidth');
- $url = DOMAIN_PLUGINS . $this->directoryName . '/toc.js';
- $out = '' . PHP_EOL;
- $out .= '' . PHP_EOL;
- return $out;
+ return '' . PHP_EOL;
}
}
diff --git a/toc.css b/toc.css
deleted file mode 100644
index f46f53e..0000000
--- a/toc.css
+++ /dev/null
@@ -1,223 +0,0 @@
-/* =============================================================
- Bludit ToC Plugin — toc.css
- Self-contained: no dependency on the host theme's CSS variables.
- Dark mode is handled via prefers-color-scheme.
- If the theme exposes --accent / --text-muted / --bg-primary,
- those are layered on top via @supports for a seamless integration.
- ============================================================= */
-
-/* ---- Color tokens (light) ---- */
-#bltoc-sidebar {
- --bltoc-text: #777;
- --bltoc-hover: #111;
- --bltoc-active: #0066cc;
- --bltoc-label: #999;
- --bltoc-bg: #fff;
- --bltoc-border: rgba(0,0,0,0.08);
- --bltoc-fab-bg: #0066cc;
- --bltoc-fab-color: #fff;
-}
-
-/* ---- Color tokens (dark) ---- */
-@media (prefers-color-scheme: dark) {
- #bltoc-sidebar {
- --bltoc-text: #999;
- --bltoc-hover: #eee;
- --bltoc-active: #4d9fff;
- --bltoc-label: #666;
- --bltoc-bg: #1a1a1a;
- --bltoc-border: rgba(255,255,255,0.08);
- }
-}
-
-/* Let blowdit (or any theme) override via its own design tokens */
-@supports (color: var(--accent)) {
- #bltoc-sidebar { --bltoc-active: var(--accent); }
-}
-@supports (color: var(--text-muted)) {
- #bltoc-sidebar { --bltoc-text: var(--text-muted); }
-}
-@supports (color: var(--bg-primary)) {
- #bltoc-sidebar { --bltoc-bg: var(--bg-primary); }
-}
-
-/* ============================================================
- Desktop fixed sidebar
- Visible only at min-width set by the admin (default 1280px).
- JS adds .bltoc-ready when headings are found, making it appear.
- ============================================================ */
-.bltoc-sidebar {
- display: none; /* hidden until JS confirms headings exist */
- position: fixed;
- left: 1rem;
- top: 5rem; /* approx below a typical navbar; fine-tuned with navbarHeight in JS */
- width: 210px;
- max-height: calc(100vh - 6rem);
- overflow-y: auto;
- overflow-x: hidden;
- z-index: 200;
- font-size: 0.8125rem;
- line-height: 1.5;
- scrollbar-width: thin;
- scrollbar-color: var(--bltoc-border) transparent;
-}
-
-/* JS adds data-bltoc-minwidth on ; sidebar shows only above that threshold. */
-/* Actual media-query breakpoint is injected by JS via a