|
259 | 259 | } |
260 | 260 |
|
261 | 261 | let growthTiles = []; |
| 262 | + /* the team's numbers, said once, next to the people who made them */ |
| 263 | + function renderContribStats() { |
| 264 | + const el = $("#contrib-stats"); |
| 265 | + if (!el || !growthTiles.length) return; |
| 266 | + const v = Object.fromEntries(growthTiles.map((t) => [t.key, t])); |
| 267 | + const part = (t, label) => (t ? `<span><b>${fmt(t.value)}</b>${label}</span>` : ""); |
| 268 | + el.innerHTML = [part(v.runners, "명이 러너로 참여"), part(v.projects, "개 프로젝트"), part(v.stars, " GitHub 스타"), part(v.events, "명 행사 참가")].join(""); |
| 269 | + } |
262 | 270 | function renderGrowth(animate = true) { |
263 | 271 | growthTiles = growthSeries(); |
264 | 272 | const box = $("#growth"); |
| 273 | + renderContribStats(); |
| 274 | + if (!box) return; |
265 | 275 | box.innerHTML = growthTiles.map((t) => { |
266 | 276 | const has = t.series.length > 1; |
267 | 277 | const first = has ? t.series[0] : null, last = has ? t.series[t.series.length - 1] : null; |
|
340 | 350 | const line = primaryLine(r); |
341 | 351 | const rank = top.indexOf(id); |
342 | 352 | const badges = [ |
343 | | - rank >= 0 ? `<span class="b top">TOP ${rank + 1}</span>` : "", |
| 353 | + rank >= 0 ? `<span class="b top">★ ${rank + 1}위</span>` : "", |
344 | 354 | r.status === "running" ? `<span class="b live">진행 중</span>` : "", |
345 | 355 | r.status !== "running" && ageDays(r.pushed) != null && ageDays(r.pushed) <= 14 ? `<span class="b new">새 업데이트</span>` : "", |
346 | 356 | r.kind === "paid" ? `<span class="b paid">${esc(r.type || "")} · 유료</span>` : "", |
|
384 | 394 | <div class="lv-side"><span class="lv-n">자료 ${free}개${items.length > free ? ` · 도서·강의 ${items.length - free}` : ""}</span>${makers.length ? `<span class="lv-makers" title="${esc(makers.join(", "))}">${makers.slice(0, 4).map((n) => avatarHTML(n, "sm")).join("")}<span>${makers.length}명이 만들었습니다</span></span>` : ""}</div> |
385 | 395 | </div> |
386 | 396 | <ol class="lv-items">${items.map((r, k) => episodeHTML(r, lv.id, k, top)).join("")}</ol> |
| 397 | + ${items.length > 2 ? `<button type="button" class="lv-more" data-lv-more>${lv.id} 자료 ${items.length - 2}개 더 보기</button>` : ""} |
387 | 398 | </li>`; |
388 | 399 | }).join(""); |
389 | 400 | $("#chapters").innerHTML = state.levels.map((lv) => `<button type="button" data-chapter="${lv.id}" aria-current="false"><b>${lv.id}</b> <span class="nm">${esc(lv.name)}</span></button>`).join(""); |
|
395 | 406 | const depot = [...state.repos.values()].filter((r) => r.status === "depot"); |
396 | 407 | const learnable = repos.filter((r) => (r.lines || []).length); |
397 | 408 | const done = learnable.filter((r) => state.ridden.has(r.repo)).length; |
398 | | - $("#curriculum-sub").textContent = `L0부터 L4까지, 팀이 만든 레포 ${repos.length}개를 순서대로 엮었습니다. L0–L2는 무료 자료만으로 끝까지 갈 수 있습니다.`; |
| 409 | + $("#curriculum-sub").textContent = `L0부터 L4까지, 팀이 만든 레포 ${repos.length}개를 순서대로 엮었습니다. L0–L2는 무료 자료만으로도 끝까지 갈 수 있고, 책과 강의는 더 깊게 보고 싶을 때 고르면 됩니다.`; |
399 | 410 | $("#n-course").textContent = repos.length; $("#n-course").title = `레포 ${repos.length}개`; |
400 | 411 | $("#shelf-foot").innerHTML = `${done ? `<span class="done-n">학습 완료 ${done} / ${learnable.length}</span> ` : ""}카드를 누르면 자세한 정보와 링크가 열립니다. 운영·보관 레포: ${depot.map((r) => `<a href="${esc(repoUrl(r))}" target="_blank" rel="noopener">${esc(r.title)}</a>`).join(", ")}`; |
401 | 412 | shelfSpy(); |
|
730 | 741 | if (state.route !== "all") setRoute("all"); |
731 | 742 | const el = $(`#shelf .ep[data-id="${CSS.escape(id)}"]`); |
732 | 743 | if (!el) return; |
| 744 | + const block = el.closest(".lv"); if (block) block.classList.add("open"); |
733 | 745 | document.querySelectorAll("#shelf .ep.picked").forEach((x) => x.classList.remove("picked", "flash")); |
734 | 746 | el.classList.add("picked"); |
735 | 747 | el.scrollIntoView({ behavior: reduceMotion ? "auto" : "smooth", block: "center" }); |
|
738 | 750 | } |
739 | 751 |
|
740 | 752 | /* ---------- book and lecture (hero) ---------- */ |
| 753 | + /* the book the team translated and the lecture built on it: one click to Hanbit */ |
741 | 754 | function renderPartner() { |
742 | 755 | const items = (state.map.paid || []).filter((p) => p.cover); |
743 | 756 | $("#partner-list").innerHTML = items.map((p) => { |
744 | 757 | const out = (p.links || [])[0]; |
| 758 | + const who = p.type === "도서" ? "인과추론팀 옮김" : `강사 ${p.credit || ""}`; |
745 | 759 | return `<li class="pt-card"> |
746 | | - <button type="button" class="pt-main" data-goto="${esc(p.id)}" aria-label="${esc(`${p.type} ${p.title}, 커리큘럼 ${p.level}에서 보기`)}"> |
| 760 | + <a class="pt-main" href="${esc(out ? out.url : "#curriculum")}" target="_blank" rel="noopener" data-event="click_partner" data-event-params='${esc(JSON.stringify({ item: p.id, action: "out" }))}' aria-label="${esc(`${p.type} ${p.title}, 한빛미디어에서 보기`)}"> |
747 | 761 | <img class="pt-img ${p.type === "도서" ? "book" : "wide"}" src="${esc(p.cover)}" alt="" width="${p.type === "도서" ? 26 : 48}" height="34"> |
748 | | - <span class="pt-text"><b>${esc(p.shortTitle || p.title)}</b><span class="pt-lv"><span class="pt-type">${esc(p.type)}</span><span class="pt-paid">유료</span>커리큘럼 ${esc(p.level)}에서 보기</span></span> |
749 | | - </button> |
750 | | - ${out ? `<a class="pt-out" href="${esc(out.url)}" target="_blank" rel="noopener" title="한빛미디어에서 보기" aria-label="${esc(`${p.title} 한빛미디어에서 보기`)}"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M6 4h6v6M12 4l-8 8" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg></a>` : ""} |
| 762 | + <span class="pt-text"><b>${esc(p.shortTitle || p.title)}</b><span class="pt-lv"><span class="pt-type">${esc(p.type)}</span>${esc(who)}</span></span> |
| 763 | + <svg class="pt-arrow" viewBox="0 0 16 16" aria-hidden="true"><path d="M6 4h6v6M12 4l-8 8" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg> |
| 764 | + </a> |
| 765 | + <button type="button" class="pt-goto" data-goto="${esc(p.id)}">커리큘럼 ${esc(p.level)}</button> |
751 | 766 | </li>`; |
752 | 767 | }).join(""); |
753 | 768 | } |
754 | 769 |
|
| 770 | + |
755 | 771 | /* ---------- featured sites (hero) ---------- */ |
756 | 772 | function renderFeatured() { |
757 | 773 | $("#featured").innerHTML = (state.featured || []).map((f) => { |
|
931 | 947 | <div class="au-head">${avatarHTML(pick.author, "lg")}<div><b class="au-name">${esc(pick.author)}</b>${tier ? `<span class="au-tier">${tierMedal(person, 18)}${esc(tier.name)}</span>` : ""}</div></div> |
932 | 948 | <p class="au-about">${esc(about)}</p> |
933 | 949 | ${series.length > 1 ? `<ol class="au-series">${series.map((a) => `<li${a === pick ? ' aria-current="true"' : ""}>${postLink(a, "series", `<span class="n">${a.episode || ""}편</span><span class="t">${esc(a.title)}</span>`)}</li>`).join("")}</ol>` : ""} |
934 | | - <p class="au-links">${person ? `<button type="button" class="btn ghost sm" data-person="${esc(person.name)}">Builder 이력</button>` : ""}${info.slug ? `<a class="btn ghost sm" href="builders/${esc(info.slug)}.html">Builder 페이지</a>` : ""}</p> |
| 950 | + <p class="au-links">${person ? `<button type="button" class="btn ghost sm" data-person="${esc(person.name)}">${esc(pick.author)}의 Builder 이력</button>` : ""}</p> |
935 | 951 | </aside> |
936 | 952 | </div> |
937 | 953 | ${others.length ? `<ul class="post-list">${others.map((a) => `<li>${postLink(a, "list", `<span class="pl-t">${esc(a.title)}</span><span class="pl-m">${esc(a.author)}${a.series ? ` · ${esc(a.series)}` : ""} · ${dot(a.date)}</span>`)}</li>`).join("")}</ul>` : ""} |
|
1344 | 1360 | if (nl) { closeStation(); gotoLevel(nl.dataset.nextLevel); return; } |
1345 | 1361 | const ext = e.target.closest("a[data-post][target=_blank]"); |
1346 | 1362 | if (ext) stamp("post"); |
| 1363 | + const more = e.target.closest("[data-lv-more]"); |
| 1364 | + if (more) { more.closest(".lv").classList.add("open"); return; } |
1347 | 1365 | const mc = e.target.closest("[data-medal-card]"); |
1348 | 1366 | if (mc) { openMedalCard(mc.dataset.medalCard); return; } |
1349 | 1367 | const dl = e.target.closest("[data-card-save]"); |
|
0 commit comments