Files
Learn_System/backend/scripts/check_geom11_js.js
T
Maxim Dolgolyov b771c3d497 feat(geom11 phase0): skeleton + миграция + мини-3D движок g3d.js
- 026_geometry_11_hub.sql: hub geometry-11 (cyan, 11 параграфов) + 4 раздела
  (Призма и цилиндр, Пирамида и конус, Сфера и шар, Повторение).
- frontend/js/g3d.js: мини-3D движок для стереометрии.
  Векторная математика, матрицы 3x3, перспективная + изометрическая проекции,
  меши призмы/пирамиды/цилиндра/конуса, wireframe сферы, back-face culling
  через нормали, Z-sort, drag-to-rotate (mouse + touch), preset views.
- frontend/textbooks/geometry_11_hub.html: hub с палитрой cyan/sky,
  4 карточками разделов, аккордеон финала курса (placeholder Phase 5).
- frontend/textbooks/geometry_11_ch{1..4}.html: skeleton 4 разделов
  (через gen_geom11_chapters.js). Все включают: помощники KaTeX, SVG 2D
  (axes2D/plotFunc/pointWithDrop/asymptote/rightAngleMark/angleArcAuto/unitVec),
  ICONS, makeCard, setupSorter, gcd, wireReadBtn, secNav, search, sidebar,
  GEOM11 POLISH CSS + JS, подключение /js/g3d.js. STUB builder для всех 11
  параграфов + 4 финалов с demo-G3D viewer (призма/цилиндр/пирамида/конус/
  сфера-wireframe).
2026-05-29 12:45:20 +03:00

50 lines
1.3 KiB
JavaScript

'use strict';
const fs = require('fs');
const path = require('path');
const files = [
'../../frontend/js/g3d.js',
'../../frontend/textbooks/geometry_11_hub.html',
'../../frontend/textbooks/geometry_11_ch1.html',
'../../frontend/textbooks/geometry_11_ch2.html',
'../../frontend/textbooks/geometry_11_ch3.html',
'../../frontend/textbooks/geometry_11_ch4.html',
];
let totalErrors = 0;
for (const rel of files) {
const p = path.join(__dirname, rel);
const src = fs.readFileSync(p, 'utf8');
if (rel.endsWith('.js')) {
// pure JS file
try {
new Function(src);
console.log('OK (parse) ' + rel);
} catch (e) {
totalErrors++;
console.error('FAIL ' + rel + ':\n' + e.message);
}
continue;
}
// Extract all inline <script>...</script> bodies (skip src= scripts)
const re = /<script(?![^>]*\bsrc=)[^>]*>([\s\S]*?)<\/script>/gi;
let m, idx = 0;
while ((m = re.exec(src))) {
idx++;
try {
new Function(m[1]);
} catch (e) {
totalErrors++;
console.error('FAIL ' + rel + ' [inline script #' + idx + ']:\n' + e.message);
}
}
console.log('OK (' + idx + ' inline) ' + rel);
}
if (totalErrors > 0) {
console.error('\nTOTAL ERRORS: ' + totalErrors);
process.exit(1);
}
console.log('\nAll OK.');