// Phase 5 — Hub polish: добавить тематические SVG watermarks для каждой // chapter-карточки, hover-микро-анимации, live-индикатор прогресса. 'use strict'; const fs = require('fs'); const path = require('path'); const DST = path.join(__dirname, '..', '..', 'frontend', 'textbooks', 'physics_8_hub.html'); let h = fs.readFileSync(DST, 'utf8'); // === 1. Add hub-level animations CSS (inline into ', HUB_EXTRA_CSS + '\n'); console.log('Hub polish CSS injected'); } // === 2. Make chapter card titles accessibility-friendly + add aria-labels === // Add aria-label на каждую .ch-card если её нет const cardLabels = { 'ch1-card': 'Глава 1: Тепловые явления', 'ch2-card': 'Глава 2: Электромагнитные явления', 'ch3-card': 'Глава 3: Световые явления', 'ch4-card': 'Лабораторный практикум — 7 ЛР' }; for (const [cls, label] of Object.entries(cardLabels)) { const regex = new RegExp(`(]*class="ch-card ${cls}"[^>]*)>`, 'g'); h = h.replace(regex, (match, before) => { if (/aria-label=/.test(before)) return match; return `${before} aria-label="${label}">`; }); } // === 3. Footer "Created with..." note (or replace existing if any) === // Optional — add a soft footer const FOOTER_HTML = ` `; if (!h.includes('47 IV-6 интерактивов')) { h = h.replace('', FOOTER_HTML + '\n'); console.log('Footer added'); } fs.writeFileSync(DST, h); console.log('hub size:', h.length);