up/overrides/main.html
Tolaria c7a3fe9412 feat(action-points): add zensical.toml kill switch + perf + legibility
Feature flag:
- [project.extra.action_points] enabled (default true) in zensical.toml.
- overrides/main.html exposes it as window.TOA_ACTION_POINTS_ENABLED in
  <head>, before extra_javascript loads.
- extra.js bails at the top of the IIFE when the flag is false: no
  storage, no nav badges, no heading pills, no confetti, no per-click
  work. Checkboxes fall back to Material's read-only tasklist.
  Verified inert when disabled (0 badges/pills/canvases, no localStorage,
  no JS errors).

Perf:
- In-memory write-through cache for the parsed store: a single toggle
  went from 15 localStorage JSON.parse reads to 0.
- updateNavBadges() updates badges in place (reuse span, only write on
  change) instead of removing+rebuilding every badge each toggle, which
  forced a full Material nav relayout. JS/toggle ~0.37->0.26ms,
  layout delta ~0.73->0.63ms.

Legibility:
- Override -webkit-text-fill-color (headings set it; pseudo-elements
  inherit it and it beats `color`) to #fff on completed green pills and
  nav badges, so the count/checkmark is white on green. h2 text color
  itself untouched.
2026-06-03 23:46:14 +08:00

23 lines
904 B
HTML

{% extends "base.html" %}
{#
Action Points feature flag.
Exposes the zensical.toml setting `[project.extra.action_points] enabled`
to client-side JS as `window.TOA_ACTION_POINTS_ENABLED`. This block renders
in <head>, before extra_javascript loads in {% block scripts %}, so the
action-points engine in docs/javascripts/extra.js can bail out immediately
when the feature is disabled.
Set `enabled = false` in zensical.toml to turn the ENTIRE interactive
checklist feature off — no localStorage, no nav badges, no confetti, no
per-click work. Checkboxes then fall back to Material's default read-only
rendering. Defaults to ON when the key is absent.
#}
{% block extrahead %}
{{ super() }}
<script>
window.TOA_ACTION_POINTS_ENABLED =
{{ "false" if config.extra.action_points and config.extra.action_points.enabled == false else "true" }};
</script>
{% endblock %}