diff --git a/frontend/js/labs/_pilots.js b/frontend/js/labs/_pilots.js new file mode 100644 index 0000000..e897b8e --- /dev/null +++ b/frontend/js/labs/_pilots.js @@ -0,0 +1,45 @@ +'use strict'; +/* + * Пилотная регистрация в LabRegistry (Фаза 0 контент-движка). + * + * Доказывает паритет: каталог/открытие/теория этих 3 симуляций идут через реестр. + * Загружается ПОСЛЕДНИМ среди labs-скриптов, поэтому P_* (lab-glue.js), + * THEORY (lab-init.js) и _openXxx (graph/quadratic/pendulum.js) уже определены. + * preview задан функцией (ленивое вычисление в renderSims) — безопасно к порядку. + * + * В Фазе 1 регистрация переедет в сами sim-файлы, а этот файл будет удалён. + */ +(function () { + if (!window.LabRegistry) return; + var R = window.LabRegistry; + + R.register({ + id: 'graph', cat: 'math', + title: 'График функции', desc: 'Постройте и исследуйте графики функций', + preview: function () { return (typeof P_GRAPH !== 'undefined') ? P_GRAPH : ''; }, + theory: (typeof THEORY !== 'undefined') ? THEORY.graph : null, + open: function () { _openGraph(); }, + stop: function () { /* нет анимационного цикла */ }, + destroy: function () { /* нет ресурсов для освобождения */ } + }); + + R.register({ + id: 'quadratic', cat: 'math', + title: 'Квадратное уравнение', desc: 'Дискриминант, корни, теорема Виета', + preview: function () { return (typeof P_QUADRATIC !== 'undefined') ? P_QUADRATIC : ''; }, + theory: (typeof THEORY !== 'undefined') ? THEORY.quadratic : null, + open: function () { _openQuadratic(); }, + stop: function () { /* нет анимационного цикла */ }, + destroy: function () { /* нет ресурсов для освобождения */ } + }); + + R.register({ + id: 'pendulum', cat: 'phys', + title: 'Маятник', desc: 'Колебания, период, затухание', + preview: function () { return (typeof P_PENDULUM !== 'undefined') ? P_PENDULUM : ''; }, + theory: (typeof THEORY !== 'undefined') ? THEORY.pendulum : null, + open: function () { _openPendulum(); }, + stop: function () { if (typeof pendSim !== 'undefined' && pendSim && pendSim.stop) pendSim.stop(); }, + destroy: function () { if (typeof pendSim !== 'undefined' && pendSim && pendSim.stop) pendSim.stop(); } + }); +})(); diff --git a/frontend/js/labs/lab-glue.js b/frontend/js/labs/lab-glue.js index b46b90f..ef572a9 100644 --- a/frontend/js/labs/lab-glue.js +++ b/frontend/js/labs/lab-glue.js @@ -949,7 +949,9 @@ } function loadTheory(simId) { - const t = THEORY[simId]; + // Контент-движок: теория мигрированных симуляций берётся из манифеста реестра. + const _rm = window.LabRegistry ? window.LabRegistry.get(simId) : null; + const t = (_rm && _rm.theory) ? _rm.theory : THEORY[simId]; const el = document.getElementById('theory-content'); if (!t) { el.innerHTML = '
Теория для этой симуляции пока не добавлена
'; return; } let html = `
${LS.icon('book-open',16)} ${t.title}
`; diff --git a/frontend/lab.html b/frontend/lab.html index 400a371..a047cda 100644 --- a/frontend/lab.html +++ b/frontend/lab.html @@ -4801,6 +4801,7 @@ + @@ -4863,6 +4864,7 @@ +