feat(materials): Фаза 3 (часть 2) — источник «Учебник»

Сервер инжектит в /textbook/<slug> плавающую кнопку «В мои материалы» (js/textbook-clip.js +
material-save.js рядом с deep-link). Сохраняет текущий § как ссылку /textbook/<slug>#sec-<id>
(заголовок = название §, источник = глава). Скрыта в classroom-embed и для неавторизованных.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maxim Dolgolyov
2026-06-04 12:17:08 +03:00
parent 61e30bedf9
commit 43fe90d601
2 changed files with 54 additions and 1 deletions
+5 -1
View File
@@ -424,7 +424,11 @@ const EMBED_INJECT = `
// Always injected (plain + embed): deep-link helper so /textbook/<slug>#sec-pN
// actually opens § N. Without it the page ignores the hash and shows §1.
const DEEPLINK_INJECT = `\n<script defer src="/js/textbook-deeplink.js"></script>\n`;
const DEEPLINK_INJECT = `
<script defer src="/js/textbook-deeplink.js"></script>
<script defer src="/js/material-save.js"></script>
<script defer src="/js/textbook-clip.js"></script>
`;
function _renderTextbook(filePath, slug, embed) {
let stat; try { stat = fs.statSync(filePath); } catch { return null; }