From be3891d68143dc3d90c58da29e87ea72bc631345 Mon Sep 17 00:00:00 2001 From: JGZYES Date: Sat, 5 Sep 2026 12:38:34 +0800 Subject: [PATCH] web: docs AJAX seamless navigation (no page reload) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit docs/index.php now serves a bare partial (crumb + #docs-body, no layout) when ?ajax=1, and a small script intercepts the left tree links to fetch that partial and swap the right content area in place — no full page reload. history.pushState keeps the URL/back-forward working. Non-JS users fall back to normal links. --- web/docs/index.php | 50 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/web/docs/index.php b/web/docs/index.php index ef87d67..23921e3 100644 --- a/web/docs/index.php +++ b/web/docs/index.php @@ -50,6 +50,12 @@ if (is_file($f)) { $title = $page; if ($body !== '' && preg_match('/^#\s+(.+)$/m', str_replace('<', '', $body), $m)) $title = trim(strip_tags($m[1])); +if (isset($_GET['ajax'])) { /* partial response for AJAX nav (no layout) */ + echo '
文档 / ' . htmlspecialchars($title) . '
'; + echo '
' . $body . '
'; + exit; +} + pmm_header('docs', '文档 · ' . $title); ?>