From c34fd27c6a4726031b9873af9fec6fdf29ea3186 Mon Sep 17 00:00:00 2001 From: Maxim Dolgolyov Date: Sat, 30 May 2026 09:17:38 +0300 Subject: [PATCH] =?UTF-8?q?feat(phys9=20ch):=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=20=D0=B1=D0=BB=D0=BE=D0=BA=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=B4=D0=B0=D1=87=20=D0=BF=D0=B0=D1=80=D0=B0=D0=B3=D1=80?= =?UTF-8?q?=D0=B0=D1=84=D0=B0=20=D0=B8=D0=B7=20legacy=20POOLS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Раньше в монолите physics_9.html на каждый § был блок задач (navDots, taskArea, fb, sum, progress-bar и chip-ok), но в новых ch-страницах physics_9_ch{1..5}.html этого не было. Изменения: 1. В каждой ch1..ch5.html добавлен hook поверх ensureBuilt: - Функция _makeTaskBlock(sec) генерирует HTML контейнеров legacy-tasks (#taskArea, #navDots, #fb, #sum, #prog, #ok, #cur, #max, кнопка «Заново», кнопка «Следующая»). - _injectTasks(id) добавляет блок в #-body если есть window.POOLS[id], и вызывает window.renderTask(id) + window.renderNav(id) для рендера первой задачи. - ensureBuilt обёрнут так, чтобы вызывать _injectTasks после оригинального билда. 2. В phys9_legacy.js добавлен экспорт POOLS и STATE в window (раньше они были скрыты внутри IIFE). Стили блока задач используют CSS-переменные секции (var(--sec-acc, ...)) и работают с любой темой главы. Теперь по каждому §1-§36 показывается соответствующий пул задач (TASKS_P1..P36). Co-Authored-By: Claude Opus 4.7 --- frontend/js/phys9_legacy.js | 2 ++ frontend/textbooks/physics_9_ch1.html | 29 +++++++++++++++++++++++++++ frontend/textbooks/physics_9_ch2.html | 29 +++++++++++++++++++++++++++ frontend/textbooks/physics_9_ch3.html | 29 +++++++++++++++++++++++++++ frontend/textbooks/physics_9_ch4.html | 29 +++++++++++++++++++++++++++ frontend/textbooks/physics_9_ch5.html | 29 +++++++++++++++++++++++++++ 6 files changed, 147 insertions(+) diff --git a/frontend/js/phys9_legacy.js b/frontend/js/phys9_legacy.js index 7e3dfdd..4fe44c0 100644 --- a/frontend/js/phys9_legacy.js +++ b/frontend/js/phys9_legacy.js @@ -5947,4 +5947,6 @@ try { if (typeof TASKS_P33 !== "undefined") window.TASKS_P33 = TASKS_P33; } catc try { if (typeof TASKS_P34 !== "undefined") window.TASKS_P34 = TASKS_P34; } catch(e) {} try { if (typeof TASKS_P35 !== "undefined") window.TASKS_P35 = TASKS_P35; } catch(e) {} try { if (typeof TASKS_P36 !== "undefined") window.TASKS_P36 = TASKS_P36; } catch(e) {} +try { if (typeof POOLS !== "undefined") window.POOLS = POOLS; } catch(e) {} +try { if (typeof STATE !== "undefined") window.STATE = STATE; } catch(e) {} })(); diff --git a/frontend/textbooks/physics_9_ch1.html b/frontend/textbooks/physics_9_ch1.html index 007ab82..07da14a 100644 --- a/frontend/textbooks/physics_9_ch1.html +++ b/frontend/textbooks/physics_9_ch1.html @@ -778,6 +778,35 @@ function buildParaSelector(){ const BUILT=new Set(); const BUILDERS = { p1:()=>build_p1(), p2:()=>build_p2(), p3:()=>build_p3(), p4:()=>build_p4(), p5:()=>build_p5(), p6:()=>build_p6(), p7:()=>build_p7(), p8:()=>build_p8(), p9:()=>build_p9(), p10:()=>build_p10(), p11:()=>build_p11(), p12:()=>build_p12(), p13:()=>build_p13(), p14:()=>build_p14(), final1:()=>build_final1() }; function ensureBuilt(id){ if(BUILT.has(id)) return; const fn=BUILDERS[id]; if(fn){ fn(); BUILT.add(id); } } + +function _makeTaskBlock(sec){ + return '' + + '
' + + '
' + + '
Задачи параграфа
' + + '
0 верно
' + + '
0/?
' + + '' + + '
' + + '
' + + '' + + '
' + + '' + + '
' + + '' + + '
'; +} +function _injectTasks(id){ + if(!id || !id.startsWith('p')) return; + if(!window.POOLS || !window.POOLS[id]) return; + var body = document.getElementById(id + '-body'); + if(!body || body.querySelector('.legacy-tasks')) return; + body.insertAdjacentHTML('beforeend', _makeTaskBlock(id)); + setTimeout(function(){ try { if(window.renderTask) window.renderTask(id); if(window.renderNav) window.renderNav(id); } catch(e){} }, 60); +} +var _origEnsureBuilt = ensureBuilt; +ensureBuilt = function(id){ _origEnsureBuilt(id); _injectTasks(id); }; + function goTo(id){ STATE.current=id; ensureBuilt(id); document.querySelectorAll('.sec').forEach(s=>s.classList.remove('active')); diff --git a/frontend/textbooks/physics_9_ch2.html b/frontend/textbooks/physics_9_ch2.html index c69bdd0..0f74a75 100644 --- a/frontend/textbooks/physics_9_ch2.html +++ b/frontend/textbooks/physics_9_ch2.html @@ -762,6 +762,35 @@ function buildParaSelector(){ const BUILT=new Set(); const BUILDERS = { p15:()=>build_p15(), p16:()=>build_p16(), p17:()=>build_p17(), p18:()=>build_p18(), p19:()=>build_p19(), p20:()=>build_p20(), p21:()=>build_p21(), p22:()=>build_p22(), p23:()=>build_p23(), p24:()=>build_p24(), final2:()=>build_final2() }; function ensureBuilt(id){ if(BUILT.has(id)) return; const fn=BUILDERS[id]; if(fn){ fn(); BUILT.add(id); } } + +function _makeTaskBlock(sec){ + return '' + + '
' + + '
' + + '
Задачи параграфа
' + + '
0 верно
' + + '
0/?
' + + '' + + '
' + + '
' + + '' + + '
' + + '' + + '
' + + '' + + '
'; +} +function _injectTasks(id){ + if(!id || !id.startsWith('p')) return; + if(!window.POOLS || !window.POOLS[id]) return; + var body = document.getElementById(id + '-body'); + if(!body || body.querySelector('.legacy-tasks')) return; + body.insertAdjacentHTML('beforeend', _makeTaskBlock(id)); + setTimeout(function(){ try { if(window.renderTask) window.renderTask(id); if(window.renderNav) window.renderNav(id); } catch(e){} }, 60); +} +var _origEnsureBuilt = ensureBuilt; +ensureBuilt = function(id){ _origEnsureBuilt(id); _injectTasks(id); }; + function goTo(id){ STATE.current=id; ensureBuilt(id); document.querySelectorAll('.sec').forEach(s=>s.classList.remove('active')); diff --git a/frontend/textbooks/physics_9_ch3.html b/frontend/textbooks/physics_9_ch3.html index 257fc6b..85735aa 100644 --- a/frontend/textbooks/physics_9_ch3.html +++ b/frontend/textbooks/physics_9_ch3.html @@ -746,6 +746,35 @@ function buildParaSelector(){ const BUILT=new Set(); const BUILDERS = { p25:()=>build_p25(), p26:()=>build_p26(), p27:()=>build_p27(), p28:()=>build_p28(), p29:()=>build_p29(), p30:()=>build_p30(), final3:()=>build_final3() }; function ensureBuilt(id){ if(BUILT.has(id)) return; const fn=BUILDERS[id]; if(fn){ fn(); BUILT.add(id); } } + +function _makeTaskBlock(sec){ + return '' + + '
' + + '
' + + '
Задачи параграфа
' + + '
0 верно
' + + '
0/?
' + + '' + + '
' + + '
' + + '' + + '
' + + '' + + '
' + + '' + + '
'; +} +function _injectTasks(id){ + if(!id || !id.startsWith('p')) return; + if(!window.POOLS || !window.POOLS[id]) return; + var body = document.getElementById(id + '-body'); + if(!body || body.querySelector('.legacy-tasks')) return; + body.insertAdjacentHTML('beforeend', _makeTaskBlock(id)); + setTimeout(function(){ try { if(window.renderTask) window.renderTask(id); if(window.renderNav) window.renderNav(id); } catch(e){} }, 60); +} +var _origEnsureBuilt = ensureBuilt; +ensureBuilt = function(id){ _origEnsureBuilt(id); _injectTasks(id); }; + function goTo(id){ STATE.current=id; ensureBuilt(id); document.querySelectorAll('.sec').forEach(s=>s.classList.remove('active')); diff --git a/frontend/textbooks/physics_9_ch4.html b/frontend/textbooks/physics_9_ch4.html index 74bd9ca..33cd6ec 100644 --- a/frontend/textbooks/physics_9_ch4.html +++ b/frontend/textbooks/physics_9_ch4.html @@ -746,6 +746,35 @@ function buildParaSelector(){ const BUILT=new Set(); const BUILDERS = { p31:()=>build_p31(), p32:()=>build_p32(), p33:()=>build_p33(), p34:()=>build_p34(), p35:()=>build_p35(), p36:()=>build_p36(), final4:()=>build_final4() }; function ensureBuilt(id){ if(BUILT.has(id)) return; const fn=BUILDERS[id]; if(fn){ fn(); BUILT.add(id); } } + +function _makeTaskBlock(sec){ + return '' + + '
' + + '
' + + '
Задачи параграфа
' + + '
0 верно
' + + '
0/?
' + + '' + + '
' + + '
' + + '' + + '
' + + '' + + '
' + + '' + + '
'; +} +function _injectTasks(id){ + if(!id || !id.startsWith('p')) return; + if(!window.POOLS || !window.POOLS[id]) return; + var body = document.getElementById(id + '-body'); + if(!body || body.querySelector('.legacy-tasks')) return; + body.insertAdjacentHTML('beforeend', _makeTaskBlock(id)); + setTimeout(function(){ try { if(window.renderTask) window.renderTask(id); if(window.renderNav) window.renderNav(id); } catch(e){} }, 60); +} +var _origEnsureBuilt = ensureBuilt; +ensureBuilt = function(id){ _origEnsureBuilt(id); _injectTasks(id); }; + function goTo(id){ STATE.current=id; ensureBuilt(id); document.querySelectorAll('.sec').forEach(s=>s.classList.remove('active')); diff --git a/frontend/textbooks/physics_9_ch5.html b/frontend/textbooks/physics_9_ch5.html index 5ad88af..1a29fe3 100644 --- a/frontend/textbooks/physics_9_ch5.html +++ b/frontend/textbooks/physics_9_ch5.html @@ -770,6 +770,35 @@ function buildParaSelector(){ const BUILT=new Set(); const BUILDERS = { lr1:()=>build_lr1(), lr2:()=>build_lr2(), lr3:()=>build_lr3(), lr4:()=>build_lr4(), lr5:()=>build_lr5(), lr6:()=>build_lr6(), lr7:()=>build_lr7(), lr8:()=>build_lr8(), lr9:()=>build_lr9(), lr10:()=>build_lr10(), lr11:()=>build_lr11(), lr12:()=>build_lr12(), final5:()=>build_final5() }; function ensureBuilt(id){ if(BUILT.has(id)) return; const fn=BUILDERS[id]; if(fn){ fn(); BUILT.add(id); } } + +function _makeTaskBlock(sec){ + return '' + + '
' + + '
' + + '
Задачи параграфа
' + + '
0 верно
' + + '
0/?
' + + '' + + '
' + + '
' + + '' + + '
' + + '' + + '
' + + '' + + '
'; +} +function _injectTasks(id){ + if(!id || !id.startsWith('p')) return; + if(!window.POOLS || !window.POOLS[id]) return; + var body = document.getElementById(id + '-body'); + if(!body || body.querySelector('.legacy-tasks')) return; + body.insertAdjacentHTML('beforeend', _makeTaskBlock(id)); + setTimeout(function(){ try { if(window.renderTask) window.renderTask(id); if(window.renderNav) window.renderNav(id); } catch(e){} }, 60); +} +var _origEnsureBuilt = ensureBuilt; +ensureBuilt = function(id){ _origEnsureBuilt(id); _injectTasks(id); }; + function goTo(id){ STATE.current=id; ensureBuilt(id); document.querySelectorAll('.sec').forEach(s=>s.classList.remove('active'));