teaching: run carrier builds from the toolkit page
Extract the console runner into web/teaching/console-runner.js (classic script, file:// safe) and mount it on carrier-toolkit.html: per-part 运行本件, per-group 运行本组, 运行全部 and 运行装配, all fed by lessons.mjs ids at build time. Fix runButton() emitting a duplicate class attribute that dropped run-group/run-assembly. Server banner now prints the carrier page URL; new check:carrier-live gate drives the dry lesson end-to-end. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,7 @@ import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { PROJECT_DIR, REPO_ROOT, groups, parts, stats } from "../../../tools/carrier/catalog.mjs";
|
||||
import { carrierLessons } from "./lessons.mjs";
|
||||
|
||||
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
||||
const DEFAULT_OUT = path.resolve(HERE, "../../teaching/carrier-toolkit.html");
|
||||
@@ -47,7 +48,7 @@ function volumeText(volume) {
|
||||
return volume == null ? "—" : `${Math.round(volume).toLocaleString("en-US")} mm³`;
|
||||
}
|
||||
|
||||
function partCard(part) {
|
||||
function partCard(part, lesson) {
|
||||
const steps = readSteps(part.document);
|
||||
const rows = steps.map((step) => {
|
||||
const kind = KIND_ZH[step.kind] ?? step.kind ?? "";
|
||||
@@ -56,10 +57,14 @@ function partCard(part) {
|
||||
const features = part.featureTypes?.length
|
||||
? ` · 特征 ${part.featureTypes.map(esc).join("、")}`
|
||||
: "";
|
||||
const runButton = lesson
|
||||
? `<button class="act run-part" type="button" data-run data-lesson-id="${esc(lesson.id)}" disabled>运行本件</button>`
|
||||
: "";
|
||||
return `<article class="part" id="${esc(part.id)}">
|
||||
<div class="head"><h3>${esc(part.id)} · ${esc(part.title)}</h3><span class="pill">${part.steps} 步</span></div>
|
||||
<div class="meta"><code>${esc(part.document)}</code> · 记录体积 ${esc(volumeText(part.volume))}${features}</div>
|
||||
<ol class="steps">${rows}</ol>
|
||||
<div class="runrow">${runButton}<span class="part-status" data-part-status="${esc(part.id)}"></span></div>
|
||||
<pre class="cmd">cd "${esc(REPO_ROOT)}" && DISPLAY=:1 node tools/carrier/create-part.mjs ${esc(part.id)}</pre>
|
||||
<div class="links">
|
||||
<a href="console.html">在教学控制台运行</a>
|
||||
@@ -68,14 +73,92 @@ function partCard(part) {
|
||||
</article>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map catalog parts to their console lessons, so the page never re-types an id:
|
||||
* the runner only needs `data-lesson-id` / `data-lesson-ids` on the buttons.
|
||||
*/
|
||||
function lessonIndex() {
|
||||
const lessons = carrierLessons();
|
||||
const env = lessons.find((lesson) => lesson.job.dry)
|
||||
?? lessons.find((lesson) => lesson.job.kind === "carrier-part");
|
||||
const assembly = lessons.find((lesson) => lesson.job.kind === "carrier-assembly");
|
||||
const perPart = new Map();
|
||||
for (const lesson of lessons) {
|
||||
if (lesson.job.kind === "carrier-part" && !lesson.job.dry) perPart.set(lesson.job.partId, lesson);
|
||||
}
|
||||
const lessonPart = Object.fromEntries([...perPart].map(([partId, lesson]) => [lesson.id, partId]));
|
||||
const labels = Object.fromEntries(lessons.map((lesson) => [lesson.id, lesson.title]));
|
||||
return { env, assembly, perPart, lessonPart, labels };
|
||||
}
|
||||
|
||||
function runButton(label, attributes = "", kind = "ghost") {
|
||||
// Callers add modifier classes as `class="run-group"` inside `attributes`.
|
||||
// Merge them into the base class list: two class attributes on one tag make
|
||||
// the browser keep only the first, silently dropping the modifier.
|
||||
const extra = [];
|
||||
const attrs = attributes
|
||||
.replace(/\bclass="([^"]*)"/g, (_, names) => {
|
||||
extra.push(...names.trim().split(/\s+/).filter(Boolean));
|
||||
return "";
|
||||
})
|
||||
.replace(/\s+/g, " ")
|
||||
.trim();
|
||||
const classes = [kind, ...extra].filter(Boolean).join(" ");
|
||||
return `<button class="${classes}" type="button" data-run ${attrs} disabled>${esc(label)}</button>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* The in-page runner panel: the same DOM contract console.html uses, so
|
||||
* console-runner.js can drive it unchanged. Buttons start real headed builds
|
||||
* through the teaching server's job queue.
|
||||
*/
|
||||
function runnerPanel(summary, index, allLessonIds) {
|
||||
const runAll = allLessonIds
|
||||
? runButton(`运行全部 ${summary.parts} 件`, `id="run" data-lesson-ids="${esc(allLessonIds)}"`, "act")
|
||||
: "";
|
||||
const envButton = index.env
|
||||
? runButton("环境自检(dry,不打开浏览器)", `data-lesson-id="${esc(index.env.id)}"`)
|
||||
: "";
|
||||
return `<section class="card" id="runner">
|
||||
<div class="row"><h2 style="margin:0">在页面上直接运行</h2><span id="status" class="chip">检测服务…</span><span style="flex:1"></span><span id="verdict" class="verdict muted">等待运行</span></div>
|
||||
<div id="offline-banner" class="banner offline" hidden>这个页面是从磁盘打开的,运行需要教学服务:在 <code>web/</code> 下执行 <code>npm run console</code>(即 <code>web/teaching/server.mjs</code>),再打开它打印的 <code>carrier-toolkit.html?token=…</code> 地址。</div>
|
||||
<p class="small muted">按钮调用的是<strong>已有的</strong>工具 <code>tools/carrier/create-part.mjs</code> 与 <code>create-assembly.mjs</code>:界面点击由共享引擎执行,本机会开一个有头的 Chrome 窗口,日志与判定实时显示在下面。单件约 5–10 分钟;「运行本组 / 运行全部」按队列串行(同一时间只跑一件),失败的零件会标记在卡片上,队列继续(等同于 <code>create-all --keep-going</code>)。</p>
|
||||
<div class="chips" id="preflight-chips"><span class="chip">检查中…</span></div>
|
||||
<div class="row">
|
||||
${runAll}
|
||||
${envButton}
|
||||
<button class="ghost" id="cancel" type="button" disabled>取消</button>
|
||||
<button class="ghost" id="recheck" type="button">重新检查前置</button>
|
||||
<span style="flex:1"></span><span id="job-id" class="small muted"></span>
|
||||
</div>
|
||||
<div class="row small muted" style="margin:8px 0"><span id="progress-text">0 / 0</span><span id="current-case"></span></div>
|
||||
<div class="progress"><i id="progress-bar"></i></div>
|
||||
<pre class="term" id="terminal"><span class="sys">等待运行…</span></pre>
|
||||
<div id="results"><p class="muted small">运行结束后按零件列出。</p></div>
|
||||
<div id="evidence"><p class="muted small">运行结束后给出报告 JSON。</p></div>
|
||||
</section>`;
|
||||
}
|
||||
|
||||
function render() {
|
||||
const summary = stats();
|
||||
const all = parts();
|
||||
const index = lessonIndex();
|
||||
const carrierData = JSON.stringify({ labels: index.labels, lessonPart: index.lessonPart })
|
||||
.replace(/</g, "\\u003c");
|
||||
const partsWithLessons = all.filter((part) => index.perPart.has(part.id));
|
||||
const allLessonIds = partsWithLessons.map((part) => index.perPart.get(part.id).id).join(",");
|
||||
const sections = groups().map((group) => {
|
||||
const members = all.filter((part) => part.system === group.id);
|
||||
const groupLessonIds = members
|
||||
.map((part) => index.perPart.get(part.id)?.id)
|
||||
.filter(Boolean);
|
||||
const groupButton = groupLessonIds.length
|
||||
? runButton(`运行本组(${groupLessonIds.length} 件)`,
|
||||
`class="run-group" data-lesson-ids="${esc(groupLessonIds.join(","))}"`)
|
||||
: "";
|
||||
return `<section class="group" id="group-${esc(group.id)}">
|
||||
<h2>${esc(group.label)} <span class="muted small">${members.length} 件</span></h2>
|
||||
<div class="parts">${members.map(partCard).join("")}</div>
|
||||
<div class="grouphead"><h2>${esc(group.label)} <span class="muted small">${members.length} 件</span></h2><span style="flex:1"></span>${groupButton}</div>
|
||||
<div class="parts">${members.map((part) => partCard(part, index.perPart.get(part.id))).join("")}</div>
|
||||
</section>`;
|
||||
}).join("");
|
||||
|
||||
@@ -116,6 +199,37 @@ table{border-collapse:collapse;width:100%;font-size:13.5px}
|
||||
th,td{border-bottom:1px solid var(--line);padding:6px 8px;text-align:left;vertical-align:top}
|
||||
th{color:var(--muted);font-weight:500}
|
||||
.note{border-left:3px solid var(--warn);padding:8px 12px;background:#1d1a12;border-radius:0 8px 8px 0;margin:10px 0}
|
||||
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
|
||||
.grouphead{display:flex;gap:10px;align-items:center}
|
||||
.chips{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0}
|
||||
.chip{display:inline-block;border:1px solid var(--line);border-radius:999px;padding:1px 9px;font-size:12px;background:var(--panel2)}
|
||||
.chip.ok{border-color:#3d6b48;color:var(--ok)}
|
||||
.chip.bad{border-color:#6b3d3d;color:var(--bad)}
|
||||
.chip.warn{border-color:#6b5a3d;color:var(--warn)}
|
||||
.chip .fix{display:none;margin-left:6px;color:var(--muted)}
|
||||
.chip.bad:hover .fix{display:inline}
|
||||
button.act,button.ghost{font:inherit;font-size:13px;padding:5px 12px;border-radius:8px;border:1px solid var(--line);cursor:pointer}
|
||||
button.act{background:#1f3b44;color:var(--text);border-color:#2f6b7a}
|
||||
button.ghost{background:var(--panel2);color:var(--text)}
|
||||
button:disabled{opacity:.45;cursor:not-allowed}
|
||||
.runrow{display:flex;gap:10px;align-items:center;margin:0 0 8px}
|
||||
.part-status{font-size:12.5px}
|
||||
.part-status.ok{color:var(--ok)}
|
||||
.part-status.bad{color:var(--bad)}
|
||||
.verdict{font-size:13px;padding:2px 10px;border-radius:999px;border:1px solid var(--line);background:var(--panel2)}
|
||||
.verdict.pass{color:var(--ok);border-color:#3d6b48}
|
||||
.verdict.bad{color:var(--bad);border-color:#6b3d3d}
|
||||
.verdict.muted{color:var(--muted)}
|
||||
.progress{height:8px;background:#0b1117;border:1px solid var(--line);border-radius:999px;overflow:hidden;margin:8px 0}
|
||||
.progress i{display:block;height:100%;width:0;background:var(--accent);transition:width .3s}
|
||||
pre.term{background:#0b1117;border:1px solid var(--line);border-radius:8px;padding:10px;max-height:320px;overflow:auto;font-size:12px;white-space:pre-wrap;word-break:break-all}
|
||||
pre.term .ok{color:var(--ok)}
|
||||
pre.term .err{color:var(--bad)}
|
||||
pre.term .sys{color:var(--warn)}
|
||||
.st-passed{color:var(--ok)}
|
||||
.st-failed{color:var(--bad)}
|
||||
.st-blocked{color:var(--warn)}
|
||||
.banner.offline{border-left:3px solid var(--bad);background:#24161a;padding:10px 12px;border-radius:0 8px 8px 0;margin:8px 0}
|
||||
@media (max-width:700px){.parts{grid-template-columns:1fr}main{padding:12px}}
|
||||
@media print{header.top,.links,pre.cmd{display:none!important}}
|
||||
</style>
|
||||
@@ -141,10 +255,14 @@ th{color:var(--muted);font-weight:500}
|
||||
|
||||
<div class="note"><strong>零件在船上是什么样:</strong>每件都按舰体坐标建模(X 向舰首为 +,z=24 m 为飞行甲板面),所以单独打开是零件、装配后自动就位,插装位姿是单位矩阵。改一个零件的尺寸,装配结果跟着变——这正是教学里要讲的“零件与装配同源”。</div>
|
||||
|
||||
${runnerPanel(summary, index, allLessonIds)}
|
||||
|
||||
${sections}
|
||||
|
||||
<section class="group" id="assembly">
|
||||
<h2>装配 <span class="muted small">1 艘</span></h2>
|
||||
<div class="grouphead"><h2>装配 <span class="muted small">1 艘</span></h2><span style="flex:1"></span>${index.assembly
|
||||
? runButton("运行装配", `class="run-assembly" data-lesson-id="${esc(index.assembly.id)}"`)
|
||||
: ""}</div>
|
||||
<article class="part">
|
||||
<div class="head"><h3>CarrierAssembly · ${summary.parts} 件合成整舰</h3><span class="pill">${summary.parts} 插入 / ${summary.parts - 1} 关节</span></div>
|
||||
<div class="meta">新建装配文档「航空母舰」,逐个装载并插入 ${summary.parts} 个零件链接,接地舰体,其余 ${summary.parts - 1} 件各建一个固定关节,最后求解并列出 BOM。</div>
|
||||
@@ -189,6 +307,36 @@ ${sections}
|
||||
|
||||
<p class="small muted" style="margin:26px 0 40px">本页由 <code>web/tools/teaching-console/build-carrier-page.mjs</code> 生成,请勿手改。</p>
|
||||
</main>
|
||||
<script>window.__CARRIER__ = ${carrierData};</script>
|
||||
<script src="console-runner.js"></script>
|
||||
<script>
|
||||
(function(){
|
||||
"use strict";
|
||||
var CARRIER = window.__CARRIER__ || { labels: {}, lessonPart: {} };
|
||||
TeachingRunner.mount({
|
||||
buttonSelector: "button[data-run]",
|
||||
labelFor: function(lessonId){ return CARRIER.labels[lessonId] || lessonId; },
|
||||
resolveRun: function(button){
|
||||
var many = button.getAttribute("data-lesson-ids");
|
||||
if (many) {
|
||||
var ids = many.split(",").filter(Boolean);
|
||||
return ids.length ? { sequence: ids, keepGoing: true } : null;
|
||||
}
|
||||
var one = button.getAttribute("data-lesson-id");
|
||||
return one ? { lessonId: one, params: {} } : null;
|
||||
},
|
||||
onDone: function(lessonId, job){
|
||||
var partId = CARRIER.lessonPart[lessonId];
|
||||
if (!partId) return;
|
||||
var badge = document.querySelector('[data-part-status="' + partId + '"]');
|
||||
if (!badge) return;
|
||||
var verdict = (job && job.verdict) || "unknown";
|
||||
badge.className = "part-status " + (verdict === "pass" ? "ok" : "bad");
|
||||
badge.textContent = verdict === "pass" ? "✓ 通过" : "✗ " + verdict;
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
|
||||
@@ -2,18 +2,23 @@
|
||||
/**
|
||||
* Browser gate for the beginner page web/teaching/carrier-toolkit.html.
|
||||
*
|
||||
* Opens the generated page over file:// (it must be self-contained and readable
|
||||
* with no server) and asserts: 20 part cards, every system section present,
|
||||
* copyable commands and links to the console / old case / hub, no template
|
||||
* leakage, no pageerror/console/request failures, and zero horizontal overflow
|
||||
* at 1440×900 and 390×844.
|
||||
* Default (offline): opens the generated page over file:// — it must stay
|
||||
* readable with no server — and asserts: 20 part cards, every system section,
|
||||
* copyable commands and links, the runner UI degrading to disabled buttons with
|
||||
* an offline banner, no unexpected pageerror/console/request failures, and zero
|
||||
* horizontal overflow at 1440×900 and 390×844.
|
||||
*
|
||||
* --live: starts the teaching server on an ephemeral port, opens the page with
|
||||
* its token and runs the environment lesson (dry, seconds) through the in-page
|
||||
* runner, asserting the same verdict/results/evidence the console gate expects.
|
||||
*
|
||||
* Prerequisite: playwright resolvable from web/node_modules.
|
||||
* Exit: 0 pass / 1 page problem / 2 prerequisite missing.
|
||||
*
|
||||
* Usage: node web/tools/teaching-console/check-carrier-page.mjs
|
||||
* Usage: node web/tools/teaching-console/check-carrier-page.mjs [--live]
|
||||
*/
|
||||
import path from "node:path";
|
||||
import { spawn } from "node:child_process";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { createRequire } from "node:module";
|
||||
import { fileURLToPath } from "node:url";
|
||||
@@ -22,6 +27,8 @@ const HERE = path.dirname(fileURLToPath(import.meta.url));
|
||||
const REPO = path.resolve(HERE, "../../..");
|
||||
const require = createRequire(path.join(REPO, "web/package.json"));
|
||||
const PAGE = path.join(REPO, "web/teaching/carrier-toolkit.html");
|
||||
const SERVER = path.join(REPO, "web/teaching/server.mjs");
|
||||
const LIVE = process.argv.includes("--live");
|
||||
|
||||
const failures = [];
|
||||
const note = (message) => { failures.push(message); console.error(`FAIL ${message}`); };
|
||||
@@ -36,64 +43,185 @@ try {
|
||||
|
||||
const VIEWPORTS = [{ width: 1440, height: 900 }, { width: 390, height: 844 }];
|
||||
|
||||
const browser = await chromium.launch({ headless: true, args: ["--no-sandbox", "--disable-dev-shm-usage"] });
|
||||
const page = await browser.newPage({ viewport: VIEWPORTS[0] });
|
||||
const pageErrors = [];
|
||||
const consoleErrors = [];
|
||||
const failedRequests = [];
|
||||
page.on("pageerror", (error) => pageErrors.push(String(error.message ?? error)));
|
||||
page.on("console", (message) => { if (message.type() === "error") consoleErrors.push(message.text()); });
|
||||
page.on("requestfailed", (request) => failedRequests.push(`${request.url()} ${request.failure()?.errorText ?? ""}`));
|
||||
|
||||
const response = await page.goto(pathToFileURL(PAGE).href, { waitUntil: "load" });
|
||||
if (!response) note("file:// 打开页面失败(无 response)");
|
||||
|
||||
const dom = await page.evaluate(() => {
|
||||
const text = document.body.innerText;
|
||||
const partIds = [...document.querySelectorAll("article.part[id]")].map((node) => node.id);
|
||||
const hrefs = [...document.querySelectorAll("a[href]")].map((node) => node.getAttribute("href"));
|
||||
const commands = [...document.querySelectorAll("code")].map((node) => node.textContent).join("\n");
|
||||
return {
|
||||
partIds,
|
||||
groups: document.querySelectorAll("section.group").length,
|
||||
stepRows: document.querySelectorAll("ol.steps li").length,
|
||||
hrefs,
|
||||
hasConsole: hrefs.some((href) => /console\.html/.test(href)),
|
||||
hasCase: hrefs.some((href) => /cases\/carrier\.html/.test(href)),
|
||||
hasIndex: hrefs.some((href) => /(^|\/)index\.html$/.test(href)),
|
||||
command: /create-part\.mjs P\d{2}/.test(commands) && /create-assembly\.mjs/.test(commands)
|
||||
&& /create-all\.mjs/.test(commands),
|
||||
leakage: ["[object Object]", "undefined", "NaN", "${"].filter((token) => text.includes(token)),
|
||||
};
|
||||
});
|
||||
|
||||
const expectedIds = Array.from({ length: 20 }, (_, index) => `P${String(index + 1).padStart(2, "0")}`);
|
||||
const missing = expectedIds.filter((id) => !dom.partIds.includes(id));
|
||||
if (dom.partIds.length !== 20) note(`零件卡片 ${dom.partIds.length} 张,应为 20 张`);
|
||||
if (missing.length) note(`缺少零件卡片:${missing.join(", ")}`);
|
||||
// 12 system sections + assembly/tools/troubleshooting.
|
||||
if (dom.groups < 15) note(`分组区仅 ${dom.groups} 个,应至少 15 个(12 系统 + 装配/工具/排错)`);
|
||||
if (dom.stepRows < 200) note(`界面步骤条目仅 ${dom.stepRows} 条,应至少 200 条(记录 210 步)`);
|
||||
if (!dom.hasConsole) note("没有跳转教学控制台的链接");
|
||||
if (!dom.hasCase) note("没有跳转旧版案例(cases/carrier.html)的链接");
|
||||
if (!dom.hasIndex) note("没有返回 index.html 的链接");
|
||||
if (!dom.command) note("缺少可复制的 create-part / create-all / create-assembly 命令");
|
||||
for (const token of dom.leakage) note(`模板泄漏标记:${token}`);
|
||||
for (const error of pageErrors) note(`pageerror: ${error}`);
|
||||
for (const error of consoleErrors) note(`console: ${error}`);
|
||||
for (const error of failedRequests) note(`request: ${error}`);
|
||||
|
||||
for (const viewport of VIEWPORTS) {
|
||||
await page.setViewportSize(viewport);
|
||||
await page.waitForTimeout(120);
|
||||
const overflow = await page.evaluate(() => Math.max(0, document.documentElement.scrollWidth - window.innerWidth));
|
||||
if (overflow > 0) note(`${viewport.width}px: 横向溢出 ${overflow}px`);
|
||||
console.log(`${viewport.width}x${viewport.height}: overflow=${overflow}`);
|
||||
/** Failure paths we design for: the offline health probe, plus live guard/abort requests. */
|
||||
function ignoreExpected(list, { offline }) {
|
||||
return list.filter((entry) => {
|
||||
if (offline) return !(/\/api\/console\/|ERR_FILE_NOT_FOUND|ERR_CONNECTION_REFUSED|Failed to load resource/.test(entry));
|
||||
return !(/status of 401|status of 404|\/api\/console\/events\?.*ERR_ABORTED/.test(entry));
|
||||
});
|
||||
}
|
||||
|
||||
const browser = await chromium.launch({ headless: true, args: ["--no-sandbox", "--disable-dev-shm-usage"] });
|
||||
|
||||
async function openPage(url) {
|
||||
const page = await browser.newPage({ viewport: VIEWPORTS[0] });
|
||||
const pageErrors = [];
|
||||
const consoleErrors = [];
|
||||
const failedRequests = [];
|
||||
page.on("pageerror", (error) => pageErrors.push(String(error.message ?? error)));
|
||||
page.on("console", (message) => { if (message.type() === "error") consoleErrors.push(message.text()); });
|
||||
page.on("requestfailed", (request) => failedRequests.push(`${request.url()} ${request.failure()?.errorText ?? ""}`));
|
||||
const response = await page.goto(url, { waitUntil: "load" });
|
||||
return { page, response, pageErrors, consoleErrors, failedRequests };
|
||||
}
|
||||
|
||||
async function checkOffline() {
|
||||
const { page, response, pageErrors, consoleErrors, failedRequests } = await openPage(pathToFileURL(PAGE).href);
|
||||
if (!response) note("file:// 打开页面失败(无 response)");
|
||||
|
||||
const dom = await page.evaluate(() => {
|
||||
const text = document.body.innerText;
|
||||
const partIds = [...document.querySelectorAll("article.part[id]")].map((node) => node.id);
|
||||
const hrefs = [...document.querySelectorAll("a[href]")].map((node) => node.getAttribute("href"));
|
||||
const commands = [...document.querySelectorAll("code")].map((node) => node.textContent).join("\n");
|
||||
const runParts = [...document.querySelectorAll("button.run-part")];
|
||||
return {
|
||||
partIds,
|
||||
groups: document.querySelectorAll("section.group").length,
|
||||
stepRows: document.querySelectorAll("ol.steps li").length,
|
||||
hrefs,
|
||||
hasConsole: hrefs.some((href) => /console\.html/.test(href)),
|
||||
hasCase: hrefs.some((href) => /cases\/carrier\.html/.test(href)),
|
||||
hasIndex: hrefs.some((href) => /(^|\/)index\.html$/.test(href)),
|
||||
command: /create-part\.mjs P\d{2}/.test(commands) && /create-assembly\.mjs/.test(commands)
|
||||
&& /create-all\.mjs/.test(commands),
|
||||
leakage: ["[object Object]", "undefined", "NaN", "${"].filter((token) => text.includes(token)),
|
||||
runParts: runParts.length,
|
||||
runPartsDisabled: runParts.every((button) => button.disabled),
|
||||
runAllDisabled: document.getElementById("run")?.disabled ?? null,
|
||||
banner: !document.getElementById("offline-banner").hidden,
|
||||
runnerState: document.body.dataset.runnerState,
|
||||
};
|
||||
});
|
||||
|
||||
const expectedIds = Array.from({ length: 20 }, (_, index) => `P${String(index + 1).padStart(2, "0")}`);
|
||||
const missing = expectedIds.filter((id) => !dom.partIds.includes(id));
|
||||
if (dom.partIds.length !== 20) note(`零件卡片 ${dom.partIds.length} 张,应为 20 张`);
|
||||
if (missing.length) note(`缺少零件卡片:${missing.join(", ")}`);
|
||||
// 12 system sections + assembly/tools/troubleshooting.
|
||||
if (dom.groups < 15) note(`分组区仅 ${dom.groups} 个,应至少 15 个(12 系统 + 装配/工具/排错)`);
|
||||
if (dom.stepRows < 200) note(`界面步骤条目仅 ${dom.stepRows} 条,应至少 200 条(记录 210 步)`);
|
||||
if (!dom.hasConsole) note("没有跳转教学控制台的链接");
|
||||
if (!dom.hasCase) note("没有跳转旧版案例(cases/carrier.html)的链接");
|
||||
if (!dom.hasIndex) note("没有返回 index.html 的链接");
|
||||
if (!dom.command) note("缺少可复制的 create-part / create-all / create-assembly 命令");
|
||||
for (const token of dom.leakage) note(`模板泄漏标记:${token}`);
|
||||
// The runner must degrade, not fail, without a server.
|
||||
if (dom.runParts !== 20) note(`运行本件按钮 ${dom.runParts} 个,应为 20 个`);
|
||||
if (!dom.runPartsDisabled) note("file:// 下仍有可点的运行本件按钮");
|
||||
if (dom.runAllDisabled !== true) note("file:// 下「运行全部」按钮未禁用");
|
||||
if (!dom.banner) note("file:// 下未显示离线提示");
|
||||
if (dom.runnerState !== "offline") note(`file:// 下 runnerState=${dom.runnerState},应为 offline`);
|
||||
for (const error of pageErrors) note(`pageerror: ${error}`);
|
||||
for (const error of ignoreExpected(consoleErrors, { offline: true })) note(`console: ${error}`);
|
||||
for (const error of ignoreExpected(failedRequests, { offline: true })) note(`request: ${error}`);
|
||||
|
||||
for (const viewport of VIEWPORTS) {
|
||||
await page.setViewportSize(viewport);
|
||||
await page.waitForTimeout(120);
|
||||
const overflow = await page.evaluate(() => Math.max(0, document.documentElement.scrollWidth - window.innerWidth));
|
||||
if (overflow > 0) note(`${viewport.width}px: 横向溢出 ${overflow}px`);
|
||||
console.log(`${viewport.width}x${viewport.height}: overflow=${overflow}`);
|
||||
}
|
||||
await page.close();
|
||||
console.log(`offline: 20 卡片 / ${dom.groups} 分区 / ${dom.stepRows} 步 / 运行按钮禁用 / runnerState=${dom.runnerState}`);
|
||||
}
|
||||
|
||||
function startServer() {
|
||||
const token = "carrier-gate-" + Date.now().toString(36);
|
||||
const child = spawn(process.execPath, [SERVER], {
|
||||
cwd: REPO,
|
||||
env: { ...process.env, TEACHING_PORT: "0", TEACHING_TOKEN: token },
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
});
|
||||
const ready = new Promise((resolve, reject) => {
|
||||
let buffer = "";
|
||||
const timer = setTimeout(() => reject(new Error("server did not report an origin within 15s")), 15000);
|
||||
child.stdout.on("data", (chunk) => {
|
||||
buffer += chunk.toString("utf8");
|
||||
for (const line of buffer.split("\n")) {
|
||||
try {
|
||||
const parsed = JSON.parse(line);
|
||||
if (parsed.origin) {
|
||||
clearTimeout(timer);
|
||||
resolve({ origin: parsed.origin, token });
|
||||
return;
|
||||
}
|
||||
} catch {
|
||||
/* partial line */
|
||||
}
|
||||
}
|
||||
});
|
||||
child.on("exit", (code) => reject(new Error(`server exited early (${code})`)));
|
||||
});
|
||||
return { child, ready };
|
||||
}
|
||||
|
||||
async function checkLive() {
|
||||
const server = startServer();
|
||||
try {
|
||||
const { origin, token } = await server.ready;
|
||||
console.log(`live: ${origin}`);
|
||||
const { page, pageErrors, consoleErrors, failedRequests } = await openPage(`${origin}/carrier-toolkit.html?token=${token}`);
|
||||
await page.waitForFunction(() => document.body.dataset.runnerState === "ready", null, { timeout: 120000 });
|
||||
await page.waitForFunction(() => document.querySelectorAll("#preflight-chips .chip.bad").length === 0
|
||||
&& document.querySelectorAll("#preflight-chips .chip").length >= 5, null, { timeout: 120000 });
|
||||
const ready = await page.evaluate(() => ({
|
||||
runParts: document.querySelectorAll("button.run-part").length,
|
||||
runPartsEnabled: [...document.querySelectorAll("button.run-part")].every((button) => !button.disabled),
|
||||
groups: document.querySelectorAll("button.run-group").length,
|
||||
assembly: Boolean(document.querySelector("button.run-assembly")),
|
||||
status: document.getElementById("status").textContent,
|
||||
}));
|
||||
if (ready.runParts !== 20) note(`live: 运行本件按钮 ${ready.runParts} 个`);
|
||||
if (!ready.runPartsEnabled) note("live: 前置已满足但运行本件按钮仍禁用");
|
||||
if (ready.groups < 12) note(`live: 分组运行按钮 ${ready.groups} 个,应至少 12 个`);
|
||||
if (!ready.assembly) note("live: 缺少装配运行按钮");
|
||||
|
||||
// The environment lesson is the dry run: seconds, not minutes. Never click a
|
||||
// part card here — those rebuild a full model headed.
|
||||
await page.click('button[data-lesson-id="lesson-carrier-environment"]');
|
||||
await page.waitForFunction(() => document.getElementById("terminal").textContent.includes("前置全部满足"), null, { timeout: 180000 });
|
||||
await page.waitForFunction(() => /通过|失败|运行失败|超时|已取消/.test(document.getElementById("verdict").textContent), null, { timeout: 240000 });
|
||||
const outcome = await page.evaluate(() => ({
|
||||
verdict: document.getElementById("verdict").textContent,
|
||||
rows: document.querySelectorAll("#results tbody tr").length,
|
||||
evidence: document.querySelectorAll('#evidence a[href*="/api/console/artifacts/"]').length,
|
||||
runnerState: document.body.dataset.runnerState,
|
||||
buttonsReenabled: [...document.querySelectorAll("button[data-run]")].every((button) => !button.disabled),
|
||||
}));
|
||||
if (!/通过/.test(outcome.verdict)) note(`live: 判定为「${outcome.verdict}」`);
|
||||
if (outcome.rows < 1) note("live: 结果表没有行");
|
||||
if (outcome.evidence < 1) note("live: 没有报告 JSON 证据链接");
|
||||
if (outcome.runnerState !== "ready") note(`live: 结束后 runnerState=${outcome.runnerState}`);
|
||||
if (!outcome.buttonsReenabled) note("live: 结束后运行按钮未恢复");
|
||||
console.log(`live: verdict=${outcome.verdict} rows=${outcome.rows} evidence=${outcome.evidence}`);
|
||||
|
||||
for (const viewport of VIEWPORTS) {
|
||||
await page.setViewportSize(viewport);
|
||||
await page.waitForTimeout(200);
|
||||
const overflow = await page.evaluate(() => Math.max(0, document.documentElement.scrollWidth - window.innerWidth));
|
||||
if (overflow > 0) note(`live ${viewport.width}px: 横向溢出 ${overflow}px`);
|
||||
}
|
||||
for (const error of pageErrors) note(`live pageerror: ${error}`);
|
||||
for (const error of ignoreExpected(consoleErrors, { offline: false })) note(`live console: ${error}`);
|
||||
for (const error of ignoreExpected(failedRequests, { offline: false })) note(`live request: ${error}`);
|
||||
await page.close();
|
||||
} finally {
|
||||
server.child.kill("SIGTERM");
|
||||
await new Promise((resolve) => server.child.once("exit", resolve));
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (LIVE) await checkLive();
|
||||
else await checkOffline();
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
await browser.close();
|
||||
if (failures.length) {
|
||||
console.error(`\ncarrier-toolkit.html 门禁失败:${failures.length} 项`);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`\ncarrier-toolkit.html 门禁通过:20 张零件卡片 / ${dom.groups} 个分组区 / ${dom.stepRows} 条步骤 / 双视口 0 溢出`);
|
||||
console.log(`\ncarrier-toolkit.html 门禁通过${LIVE ? "(live)" : ""}`);
|
||||
|
||||
@@ -275,7 +275,7 @@ function volumeText(volume) {
|
||||
* where it sits on the vessel), and the last lesson assembles all 20 into one
|
||||
* document with 19 fixed joints.
|
||||
*/
|
||||
function carrierLessons() {
|
||||
export function carrierLessons() {
|
||||
const parts = carrierParts();
|
||||
const byGroup = new Map(carrierGroups().map((group) => [group.id, group.label]));
|
||||
const intro = {
|
||||
|
||||
@@ -137,6 +137,7 @@ summary{cursor:pointer;font-size:13.5px}
|
||||
<script>window.__LESSONS__ = {{LESSONS_JSON}};</script>
|
||||
<script>window.__CATALOG__ = {{CATALOG_JSON}};</script>
|
||||
<script>window.__COMMANDS__ = {{COMMANDS_JSON}};</script>
|
||||
<script src="console-runner.js"></script>
|
||||
<script>
|
||||
(function(){
|
||||
"use strict";
|
||||
@@ -147,19 +148,10 @@ summary{cursor:pointer;font-size:13.5px}
|
||||
LESSONS.lessons.forEach(function(l){ byId[l.id] = l; });
|
||||
var groups = LESSONS.groups;
|
||||
|
||||
var token = "";
|
||||
(function(){
|
||||
var url = new URL(location.href);
|
||||
var param = url.searchParams.get("token");
|
||||
if (param) { token = param; try { sessionStorage.setItem("teaching-token", param); } catch(e){} url.searchParams.delete("token"); history.replaceState(null, "", url.toString()); }
|
||||
else { try { token = sessionStorage.getItem("teaching-token") || ""; } catch(e){} }
|
||||
})();
|
||||
|
||||
var state = {
|
||||
online: false, checked: false, preflight: null, lesson: null,
|
||||
job: null, jobId: null, source: null, running: false, logs: 0,
|
||||
practice: {}, autoScroll: true, completed: {}
|
||||
};
|
||||
// Console-only glue: the course list, lesson panels and practice picker.
|
||||
// Running, streaming, verdicts and evidence live in console-runner.js, which
|
||||
// the carrier toolkit page mounts too.
|
||||
var state = { lesson: null, practice: {}, completed: {} };
|
||||
try { state.completed = JSON.parse(localStorage.getItem("teaching-console-done-v1") || "{}"); } catch(e) { state.completed = {}; }
|
||||
|
||||
function $(id){ return document.getElementById(id); }
|
||||
@@ -197,7 +189,7 @@ summary{cursor:pointer;font-size:13.5px}
|
||||
$("opt-observe").hidden = l.job.kind !== "suite" || l.job.selectable;
|
||||
$("opt-shots").hidden = l.job.kind !== "suite" || l.job.selectable;
|
||||
$("lesson-command").textContent = commandFor(l);
|
||||
updateButtons();
|
||||
runner.syncButtons();
|
||||
renderSidebar();
|
||||
}
|
||||
|
||||
@@ -225,177 +217,29 @@ summary{cursor:pointer;font-size:13.5px}
|
||||
$("practice-list").innerHTML = html;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- preflight */
|
||||
function renderPreflight(report){
|
||||
state.preflight = report;
|
||||
if (!report) { $("preflight-chips").innerHTML = '<span class="chip bad">无法读取前置检查</span>'; return; }
|
||||
$("preflight-chips").innerHTML = report.checks.map(function(c){
|
||||
return '<span class="chip ' + (c.ok ? "ok" : "bad") + '">' + (c.ok ? "✓ " : "✗ ") + esc(c.id) +
|
||||
'<span class="fix">' + esc(c.detail) + (c.ok ? "" : " · 修复:" + esc(c.fix)) + '</span></span>';
|
||||
}).join("");
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
function updateButtons(){
|
||||
var l = state.lesson;
|
||||
var ready = state.online && !state.running && l && (!state.preflight || state.preflight.ok || l.job.kind === "preflight");
|
||||
$("run").disabled = !ready;
|
||||
$("cancel").disabled = !state.running || !state.online;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------- api */
|
||||
function api(path, options){
|
||||
options = options || {};
|
||||
options.headers = Object.assign({ "x-teaching-token": token }, options.headers || {});
|
||||
return fetch(path, options).then(function(res){
|
||||
return res.json().catch(function(){ return {}; }).then(function(body){
|
||||
if (!res.ok) { var err = new Error(body.error || ("HTTP " + res.status)); err.code = body.code; err.detail = body.detail; throw err; }
|
||||
return body;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function checkHealth(){
|
||||
fetch("/api/console/health", { cache: "no-store" }).then(function(res){ return res.json(); }).then(function(){
|
||||
state.online = true; state.checked = true; setStatus(); refreshPreflight(); updateButtons();
|
||||
}).catch(function(){
|
||||
state.online = false; state.checked = true; setStatus(); updateButtons();
|
||||
$("preflight-chips").innerHTML = '<span class="chip warn">离线:无法读取前置检查</span>';
|
||||
});
|
||||
}
|
||||
|
||||
function setStatus(){
|
||||
var chip = $("status");
|
||||
chip.className = "chip " + (state.online ? "ok" : "bad");
|
||||
chip.textContent = state.online ? "服务在线" : "服务离线";
|
||||
$("offline-banner").hidden = state.online;
|
||||
}
|
||||
|
||||
function refreshPreflight(){
|
||||
if (!state.online) return;
|
||||
fetch("/api/console/preflight", { cache: "no-store" }).then(function(r){ return r.json(); }).then(renderPreflight).catch(function(){
|
||||
$("preflight-chips").innerHTML = '<span class="chip bad">前置检查失败</span>';
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- running */
|
||||
function params(){
|
||||
if (!state.lesson || !state.lesson.job.selectable) return {};
|
||||
var ids = Object.keys(state.practice).filter(function(id){ return state.practice[id]; });
|
||||
return { only: ids, slow: $("observe").checked ? 300 : 0, highlight: $("observe").checked, screenshots: $("shots").checked ? "all" : "fails" };
|
||||
}
|
||||
|
||||
function startRun(){
|
||||
var l = state.lesson;
|
||||
if (!l) return;
|
||||
clearTerminal();
|
||||
state.logs = 0; state.running = true; state.job = null; state.jobId = null;
|
||||
$("verdict").className = "verdict muted"; $("verdict").textContent = "启动中…";
|
||||
$("results").innerHTML = '<p class="muted small">运行中…</p>';
|
||||
$("evidence").innerHTML = '<p class="muted small">运行结束后生成。</p>';
|
||||
updateButtons();
|
||||
var payload = { lessonId: l.id, params: params() };
|
||||
api("/api/console/run", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(payload) }).then(function(job){
|
||||
state.jobId = job.jobId;
|
||||
$("job-id").textContent = job.jobId;
|
||||
subscribe(job.jobId);
|
||||
}).catch(function(err){
|
||||
state.running = false; updateButtons();
|
||||
appendLine("stderr", "无法启动:" + (err.message || err));
|
||||
if (err.code === "E_PREFLIGHT" && err.detail && err.detail.blockers) {
|
||||
appendLine("sys", "未满足的前置:" + err.detail.blockers.map(function(b){ return b.id; }).join(", "));
|
||||
}
|
||||
$("verdict").className = "verdict bad"; $("verdict").textContent = "未启动(" + (err.code || "错误") + ")";
|
||||
});
|
||||
}
|
||||
|
||||
function subscribe(jobId){
|
||||
if (state.source) { state.source.close(); state.source = null; }
|
||||
var source = new EventSource("/api/console/events?jobId=" + encodeURIComponent(jobId) + "&token=" + encodeURIComponent(token));
|
||||
state.source = source;
|
||||
source.addEventListener("snapshot", function(event){ onSnapshot(JSON.parse(event.data)); });
|
||||
source.addEventListener("log", function(event){ var data = JSON.parse(event.data); appendLine(data.stream, data.text); });
|
||||
source.addEventListener("done", function(event){ onSnapshot(JSON.parse(event.data)); finishRun(); });
|
||||
source.onerror = function(){ /* server restarts close the stream; the page stays readable */ };
|
||||
}
|
||||
|
||||
function finishRun(){
|
||||
state.running = false;
|
||||
if (state.source) { state.source.close(); state.source = null; }
|
||||
updateButtons();
|
||||
var job = state.job;
|
||||
if (job && job.verdict === "pass") {
|
||||
state.completed[state.lesson.id] = true;
|
||||
try { localStorage.setItem("teaching-console-done-v1", JSON.stringify(state.completed)); } catch(e){}
|
||||
renderSidebar();
|
||||
}
|
||||
}
|
||||
|
||||
function onSnapshot(job){
|
||||
state.job = job;
|
||||
$("job-id").textContent = job.jobId || "";
|
||||
var planned = job.planned || 0, completed = job.completed || 0;
|
||||
$("progress-text").textContent = completed + " / " + planned;
|
||||
$("progress-bar").style.width = planned ? Math.round(100 * completed / planned) + "%" : "0%";
|
||||
$("current-case").textContent = job.current ? ("当前:" + job.current) : "";
|
||||
if (job.verdict) {
|
||||
$("verdict").className = "verdict " + job.verdict;
|
||||
$("verdict").textContent = verdictLabel(job.verdict) + (job.exitCode != null ? "(exit " + job.exitCode + ")" : "");
|
||||
} else if (job.state) {
|
||||
$("verdict").className = "verdict muted";
|
||||
$("verdict").textContent = job.state === "running" ? "运行中…" : job.state;
|
||||
}
|
||||
renderResults(job);
|
||||
renderEvidence(job);
|
||||
}
|
||||
|
||||
function verdictLabel(v){
|
||||
return { pass: "通过", product_fail: "产品失败", precondition_fail: "前置失败", run_fail: "运行失败",
|
||||
timeout: "超时", cancelled: "已取消", preflight_failed: "前置失败" }[v] || v;
|
||||
}
|
||||
|
||||
function renderResults(job){
|
||||
var results = job.results || [];
|
||||
if (!results.length) return;
|
||||
var rows = results.map(function(item){
|
||||
return '<tr><td class="path">' + esc(item.id) + '</td><td>' + esc(item.title || "") + '</td><td class="st-' + esc(item.status) + '">' + esc(item.status) + '</td><td>' + (item.seconds != null ? Number(item.seconds).toFixed(1) + "s" : "") + '</td><td class="small">' + esc(item.error || "") + '</td></tr>';
|
||||
}).join("");
|
||||
$("results").innerHTML = '<div class="table-scroll" style="overflow:auto"><table><thead><tr><th>用例</th><th>标题</th><th>状态</th><th>耗时</th><th>错误</th></tr></thead><tbody>' + rows + "</tbody></table></div>";
|
||||
}
|
||||
|
||||
function renderEvidence(job){
|
||||
var links = [];
|
||||
if (job.runDir) {
|
||||
var base = "/evidence/" + job.runDir.replace(/^docs\//, "");
|
||||
links.push('<a href="' + esc(base) + '/index.html" target="_blank" rel="noopener">完整报告(index.html)</a>');
|
||||
links.push('<a href="' + esc(base) + '/report.md" target="_blank" rel="noopener">report.md</a>');
|
||||
links.push('<a href="' + esc(base) + '/GAPS.md" target="_blank" rel="noopener">GAPS.md</a>');
|
||||
}
|
||||
if (job.kind === "probe") links.push('<a href="/api/console/artifacts/' + esc(job.jobId) + '/layout.json" target="_blank" rel="noopener">布局报告 JSON</a>');
|
||||
if (job.kind === "reducer-part" || job.kind === "reducer-assembly") links.push('<a href="/api/console/artifacts/' + esc(job.jobId) + '/report.json" target="_blank" rel="noopener">零件/装配报告 JSON</a>');
|
||||
if (job.origin) links.push('<span class="small muted">本次运行 origin:<code>' + esc(job.origin) + '</code></span>');
|
||||
$("evidence").innerHTML = links.length ? links.map(function(x){ return '<div>' + x + '</div>'; }).join("") : '<p class="muted small">运行结束后可打开完整报告与截图。</p>';
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------- terminal */
|
||||
function appendLine(stream, text){
|
||||
var term = $("terminal");
|
||||
if (state.logs === 0) term.textContent = "";
|
||||
state.logs += 1;
|
||||
var span = document.createElement("span");
|
||||
span.className = stream === "stderr" ? "err" : (/passed|ORIGIN=/.test(text) ? "ok" : (stream === "sys" ? "sys" : ""));
|
||||
span.textContent = text + "\n";
|
||||
term.appendChild(span);
|
||||
while (term.childNodes.length > 2000) term.removeChild(term.firstChild);
|
||||
if (state.autoScroll) term.scrollTop = term.scrollHeight;
|
||||
}
|
||||
|
||||
function clearTerminal(){
|
||||
$("terminal").textContent = "";
|
||||
state.logs = 0;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- wiring */
|
||||
var runner = TeachingRunner.mount({
|
||||
buttonSelector: "#run",
|
||||
extraGate: function(){ return Boolean(state.lesson); },
|
||||
resolveRun: function(){
|
||||
if (!state.lesson) return null;
|
||||
return { lessonId: state.lesson.id, params: params() };
|
||||
},
|
||||
onDone: function(lessonId, job){
|
||||
if (job && job.verdict === "pass") {
|
||||
state.completed[lessonId] = true;
|
||||
try { localStorage.setItem("teaching-console-done-v1", JSON.stringify(state.completed)); } catch(e){}
|
||||
renderSidebar();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("search").addEventListener("input", renderSidebar);
|
||||
document.addEventListener("keydown", function(event){
|
||||
if (event.key === "/" && document.activeElement !== $("search")) { event.preventDefault(); $("search").focus(); }
|
||||
@@ -413,25 +257,16 @@ summary{cursor:pointer;font-size:13.5px}
|
||||
var id = input.value;
|
||||
if (input.checked) {
|
||||
var selected = Object.keys(state.practice).filter(function(k){ return state.practice[k]; });
|
||||
if (selected.length >= 8) { input.checked = false; appendLine("sys", "自由练习最多选择 8 个用例。"); return; }
|
||||
if (selected.length >= 8) { input.checked = false; runner.append("sys", "自由练习最多选择 8 个用例。"); return; }
|
||||
state.practice[id] = true;
|
||||
} else {
|
||||
delete state.practice[id];
|
||||
}
|
||||
});
|
||||
$("run").addEventListener("click", startRun);
|
||||
$("cancel").addEventListener("click", function(){
|
||||
if (!state.jobId) return;
|
||||
api("/api/console/cancel", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ jobId: state.jobId }) })
|
||||
.catch(function(err){ appendLine("stderr", "取消失败:" + err.message); });
|
||||
});
|
||||
$("recheck").addEventListener("click", function(){ checkHealth(); });
|
||||
$("terminal").addEventListener("scroll", function(){ var t = $("terminal"); state.autoScroll = t.scrollTop + t.clientHeight >= t.scrollHeight - 30; });
|
||||
|
||||
renderSidebar();
|
||||
state.lesson = byId["lesson-00-preflight"] || LESSONS.lessons[0];
|
||||
renderLesson();
|
||||
checkHealth();
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user