`;
+ }
+ /* a level's topics in study order, each with the one or two materials to start from */
+ function topicRows(lv) {
+ const ts = (lv.topics || []).map(topicById).filter(Boolean);
if (!ts.length) return "";
const ev = (topic, target) => `data-event="level_topic" data-event-params='${esc(JSON.stringify({ level: lv.id, topic, target }))}'`;
const row = (t, k) => `
+ ${ts.map((t, k) => row(t, k + 1)).join("")}`;
}
- /* one level in full: who it is for, what it covers, what you can do after it, and the order to take it */
- function levelPanel(lv, i) {
- const mine = myLevel(), mi = mine ? lvIndex(mine.level) : -1;
+ /* one level opened: what to open next, the topics in order, then who it is for and what is behind it */
+ function levelBody(lv) {
const steps = stepsOf(lv), quests = questsOf(lv.id), done = quests.filter(questDone).length, cleared = levelDone(lv.id);
const inSteps = new Set(steps.map((s) => s.repo));
const items = levelItems(lv.id);
const extra = items.filter((r) => !inSteps.has(r.repo) && r.kind !== "paid");
const books = items.filter((r) => r.kind === "paid");
const build = (lv.quests || []).length > 0;
- const topics = topicOrder(lv);
+ const topics = topicRows(lv);
const crew = [...new Set(items.flatMap((r) => r.builders || []))];
- const count = `${done} / ${quests.length}`;
- /* a learning level is one path, its topics in order; the repositories behind them are listed once, small */
- const repoList = (label) => `
`;
+ }
+
+ /* one level as a row of the syllabus: number, name, question, progress squares; the body opens below it */
+ function levelBlock(lv, i, open) {
+ const st = levelStatus(lv), build = (lv.quests || []).length > 0, c = countOf(lv);
+ const prev = state.levels[i - 1];
+ const layer = i === 0 ? `
` : "";
+ const tag = st === "mine" ? `내 레벨` : st === "past" ? `통과` : st === "cleared" ? `클리어` : "";
+ return `${layer}
+
+ ${st === "cleared" ? "★" : i}
+ ${LV(lv.id)}${esc(lv.tier || lv.name)}${tag}${esc(lv.question)}
+ ${squaresHTML(lv)}${c.done}/${c.n}${esc(countLabel(lv))}
+
+
+ ${levelBody(lv)}
+ `;
+ }
+ function renderShelf() {
const shelf = $("#shelf");
if (!shelf) return;
- const id = shownLevel(), lv = levelOf(id), i = lvIndex(id);
+ const id = shownLevel();
state.level = id;
- const keep = shelf.querySelector(`details[data-more="${id}"]`);
- const wasOpen = keep && keep.open;
- const keepT = shelf.querySelector(`details[data-topics="${id}"]`), topicsOpen = keepT && keepT.open;
- shelf.innerHTML = levelPanel(lv, i);
- if (wasOpen) { const d = shelf.querySelector("details[data-more]"); if (d) d.open = true; }
- if (topicsOpen) { const d = shelf.querySelector("details[data-topics]"); if (d) d.open = true; }
- if (dir && !reduceMotion) { const a = shelf.firstElementChild; a.classList.add(dir > 0 ? "enter-r" : "enter-l"); }
+ if (!state.openLv) state.openLv = new Set([id]);
+ shelf.innerHTML = `
${state.levels.map((lv, i) => levelBlock(lv, i, state.openLv.has(lv.id))).join("")}
+
레벨 대신 주제별로 이어서 보고 싶다면
`;
wireAvatars(shelf);
paintTopicProgress();
- renderRail(reveal); renderHud(); renderTestCard();
+ renderHud(); renderTestCard();
const repos = [...state.repos.values()].filter((r) => !r.kind && r.status !== "depot");
const depot = [...state.repos.values()].filter((r) => r.status === "depot");
$("#n-course").textContent = repos.length; $("#n-course").title = `레포 ${repos.length}개`;
- $("#shelf-foot").innerHTML = `자료 이름을 누르면 자세한 정보와 링크가 열립니다. 진단 결과와 클리어 기록은 이 브라우저에만 남습니다. 운영·보관 레포: ${depot.map((r) => `${esc(r.title)}`).join(", ")}`;
+ $("#shelf-foot").innerHTML = `주제 이름을 누르면 자료실에서 그 주제의 자료를 모두 볼 수 있습니다. 진단 결과와 진도는 이 브라우저에만 남습니다. 운영·보관 레포: ${depot.map((r) => `${esc(r.title)}`).join(", ")}`;
+ }
+ /* which levels are open is remembered while the page is open, and a click on a level row is counted */
+ function wireSyllabus() {
+ const shelf = $("#shelf");
+ if (!shelf) return;
+ shelf.addEventListener("toggle", (e) => {
+ const d = e.target;
+ if (!(d instanceof HTMLDetailsElement) || !d.classList.contains("sy-lv")) return;
+ if (!state.openLv) state.openLv = new Set();
+ if (d.open) { state.openLv.add(d.dataset.row); state.level = d.dataset.row; } else state.openLv.delete(d.dataset.row);
+ }, true);
+ shelf.addEventListener("click", (e) => {
+ const sm = e.target.closest(".sy-lv > summary");
+ if (sm) track("select_level", { level: sm.parentElement.dataset.row, source: sm.parentElement.open ? "syllabus_close" : "syllabus" });
+ });
}
/* each section arrives once as it comes into view: its station dot, then the heading, then the content */
function revealSections() {
@@ -582,18 +599,6 @@
const show = () => { const t = /^#[\w-]+$/.test(location.hash) && document.getElementById(location.hash.slice(1)); const sec = t && t.closest("section.band"); if (sec) sec.classList.add("rv-in"); };
window.addEventListener("hashchange", show); show();
}
- /* the rail draws itself once, the first time the curriculum comes into view */
- function watchRail() {
- const rail = $("#lv-rail");
- if (!rail || reduceMotion || !("IntersectionObserver" in window)) return;
- rail.classList.add("pre");
- const io = new IntersectionObserver((ens) => ens.forEach((en) => {
- if (!en.isIntersecting) return;
- rail.classList.remove("pre"); rail.classList.add("drawn"); io.disconnect();
- }), { threshold: 0, rootMargin: "0px 0px 20% 0px" });
- io.observe(rail);
- }
-
/* ---------- level test: concept questions place the visitor on a level ---------- */
const test = { step: 0, picks: [], interest: null, done: false };
function meterHTML(levelId) {
@@ -608,10 +613,10 @@
const n = state.leveltest.questions.length;
box.classList.toggle("lt-slim", !lv);
box.innerHTML = lv
- ? `