diff --git a/frontend/admin.html b/frontend/admin.html index 4d8d988..2d59310 100644 --- a/frontend/admin.html +++ b/frontend/admin.html @@ -831,40 +831,7 @@
- +
@@ -1894,6 +1861,7 @@
+
+ diff --git a/frontend/analytics.html b/frontend/analytics.html index a322aa3..e0ea7eb 100644 --- a/frontend/analytics.html +++ b/frontend/analytics.html @@ -241,53 +241,7 @@
- +
@@ -334,6 +288,7 @@
+ + + + + + diff --git a/frontend/board.html b/frontend/board.html index 42bcc8d..68f75da 100644 --- a/frontend/board.html +++ b/frontend/board.html @@ -256,53 +256,7 @@
- +
@@ -353,6 +307,7 @@
+ + + + + + + + @@ -345,12 +300,7 @@ let _subjectSlug = ''; document.getElementById('nav-avatar').textContent = (user.name||'LS').split(' ').slice(0,2).map(w=>w[0]?.toUpperCase()||'').join('')||'LS'; document.getElementById('nav-user').textContent = user.name || '—'; - if (user.role === 'admin') - document.getElementById('sbl-admin').style.display = ''; LS.showBoardIfAllowed(); - if (user.role !== 'student') { - document.getElementById('sbl-classes').style.display = ''; - } } LS.sidebar?.init(); lucide.createIcons(); diff --git a/frontend/css/ls.css b/frontend/css/ls.css index 9cfbf7e..cee5264 100644 --- a/frontend/css/ls.css +++ b/frontend/css/ls.css @@ -444,6 +444,13 @@ body { overflow-x: hidden; } +/* notif wrap — visually separate from nav items */ +#notif-wrap { + border-top: 1.5px solid var(--border); + margin-top: 6px; + padding-top: 6px; +} + /* notif drop anchored relative to sidebar */ .notif-drop { position: fixed; diff --git a/frontend/dashboard.html b/frontend/dashboard.html index d3830af..8919da7 100644 --- a/frontend/dashboard.html +++ b/frontend/dashboard.html @@ -1172,54 +1172,7 @@
- +
@@ -1568,6 +1521,7 @@
+ + + diff --git a/frontend/gradebook.html b/frontend/gradebook.html index 643b92b..c0412fb 100644 --- a/frontend/gradebook.html +++ b/frontend/gradebook.html @@ -194,53 +194,7 @@
- +
@@ -295,6 +249,7 @@
+ + @@ -504,15 +459,6 @@ function showToast(msg) { const user = LS.getUser(); LS.initPage(); - // sbl-classes — только для учителей/админов - if (user.role !== 'student') { - const el = document.getElementById('sbl-classes'); - if (el) el.style.display = ''; - } - if (user.role === 'admin') { - const a = document.getElementById('sbl-admin'); - if (a) a.style.display = ''; - } LS.showBoardIfAllowed(); LS.notif.init(); diff --git a/frontend/homework.html b/frontend/homework.html index 9ae5937..41d03ee 100644 --- a/frontend/homework.html +++ b/frontend/homework.html @@ -145,53 +145,7 @@
- +
@@ -257,6 +211,7 @@
+ + @@ -625,19 +580,13 @@ let _dashOffset = 0; // animated dash offset for link flow const user = LS.getUser(); LS.initPage(); - // sbl-classes — только для учителей/админов - if (user.role !== 'student') { - const el = document.getElementById('sbl-classes'); - if (el) el.style.display = ''; - } - if (user.role === 'admin') { - const a = document.getElementById('sbl-admin'); - if (a) a.style.display = ''; - } LS.showBoardIfAllowed(); LS.notif.init(); lucide.createIcons(); + const feats = await LS.loadFeatures(); + if (feats.knowledge_map === false) { window.location.replace('/403'); return; } + LS.hideDisabledFeatures?.(); document.querySelector('.sb-toggle')?.addEventListener('click', () => { setTimeout(() => { resizeCanvas(); recenter(); }, 310); diff --git a/frontend/lab.html b/frontend/lab.html index d48c851..b4dc8da 100644 --- a/frontend/lab.html +++ b/frontend/lab.html @@ -648,51 +648,7 @@
- +
@@ -3689,6 +3645,7 @@
+ @@ -3713,10 +3670,7 @@ const { user, isTeacher, isAdmin } = LS.initPage(); window._simQuizAllowed = true; // default; overridden after permission fetch for students LS.showBoardIfAllowed(); - if (isTeacher) { - document.getElementById('sbl-classes').style.display = ''; - document.getElementById('sbl-admin').style.display = ''; - } + /* ════════════════════════════════ SIM CATALOGUE (defined after P_* consts below) diff --git a/frontend/lesson-editor.html b/frontend/lesson-editor.html index d79bb46..000882a 100644 --- a/frontend/lesson-editor.html +++ b/frontend/lesson-editor.html @@ -1001,6 +1001,7 @@
+ + + + + @@ -497,11 +449,8 @@ LS.showBoardIfAllowed(); if (isTeacher) { - document.getElementById('btn-upload-nav').style.display = ''; document.getElementById('btn-upload-main').style.display = ''; document.getElementById('btn-new-folder').style.display = ''; - document.getElementById('sbl-classes').style.display = ''; - document.getElementById('sbl-admin').style.display = ''; } /* ── constants ── */ diff --git a/frontend/live-quiz.html b/frontend/live-quiz.html index 0afcef9..1e90618 100644 --- a/frontend/live-quiz.html +++ b/frontend/live-quiz.html @@ -336,53 +336,7 @@
- +
@@ -495,6 +449,7 @@
+ + + + + + + + + + + + after api.js on each page. + +const fs = require('fs'); +const path = require('path'); + +const FRONTEND = path.join(__dirname, '..', 'frontend'); + +// Pages that get the universal sidebar (excludes test-run.html, login.html, 403/404/500, parent.html, guest-board.html) +const PAGES = [ + 'admin', 'analytics', + 'biochem', 'biochem-library', 'biochem-pathways', 'biochem-properties', 'biochem-reactions', + 'board', 'classes', 'classroom', 'collection', 'collection-rb', 'course', 'crossword', + 'dashboard', 'flashcards', 'gradebook', 'hangman', 'homework', + 'knowledge-map', 'lab', 'lesson', 'lesson-editor', 'lesson-history', 'library', 'live-quiz', + 'my-lessons', 'pet', 'profile', 'question-bank', + 'red-book', 'red-book-biomes', 'red-book-ecosystem', 'red-book-games', + 'theory', +]; + +// Regex: match +// Handles optional extra attributes and multi-line content +const ASIDE_RE = /]*\bclass="sidebar"[^>]*>[\s\S]*?<\/aside>/; + +// Match existing sidebar.js script tag +const SIDEBAR_SCRIPT_RE = /<\/script>/; + +// Match api.js script tag +const API_SCRIPT_RE = /(<\/script>)/; + +let changed = 0; +let skipped = 0; +let errors = 0; + +for (const name of PAGES) { + const file = path.join(FRONTEND, `${name}.html`); + if (!fs.existsSync(file)) { + console.log(` SKIP ${name}.html (not found)`); + skipped++; + continue; + } + + let src = fs.readFileSync(file, 'utf8'); + let modified = false; + + // 1. Replace sidebar