public/js/{util,ui,reactions,modals,comments,feed,main}.js 로 분리하고
dashboard/project 에서 <script type="module" src="/public/js/main.js"> 로 로드.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
47 lines
2.0 KiB
JavaScript
47 lines
2.0 KiB
JavaScript
// 엔트리 — 각 모듈 초기화 + 서버 시작 신호(토스트/이스터에그/모달 열기) 처리.
|
|
// _header/dashboard/project 에서 <script type="module" src="/public/js/main.js"> 로 로드.
|
|
import { EGGS_ON, toast, burstThumbs, burstRocket } from "./util.js";
|
|
import { initTheme, initUserMenu, initLogoEgg } from "./ui.js";
|
|
import { initReactions } from "./reactions.js";
|
|
import { initModals, openDetail } from "./modals.js";
|
|
import { initComments } from "./comments.js";
|
|
import { initFeed, initMyFilter } from "./feed.js";
|
|
|
|
// 서버가 <body data-*> 로 전달한 1회성 신호 처리
|
|
function initSignals() {
|
|
const b = document.body;
|
|
if (b.getAttribute("data-toast")) toast(b.getAttribute("data-toast"));
|
|
const egg = b.getAttribute("data-egg");
|
|
if (egg === "lgtm") { burstThumbs(); toast("LGTM 👍 — Looks Good To Me!"); }
|
|
else if (egg === "rocket") burstRocket();
|
|
const open = b.getAttribute("data-open-modal");
|
|
if (open) openDetail(open);
|
|
}
|
|
|
|
function consoleArt() {
|
|
if (!EGGS_ON) return;
|
|
try {
|
|
const art = [" ___ ____ ____ _______ __", " / | / _/ / __ \\/ ____/ | / /", " / /| | / / / / / / __/ | | / / ", "/ ___ |_/ / / /_/ / /___ | |/ / ", "/_/ |_/___/ /_____/_____/ |___/ "].join("\n");
|
|
console.log("%c" + art, "color:#0969da;font-family:monospace;font-size:11px;line-height:1.1");
|
|
console.log("%c👀 코드 구경 왔어요? 환영합니다.", "color:#1f883d;font-size:13px;font-weight:bold");
|
|
console.log("%c사내 개발팀은 늘 동료를 찾고 있어요 — git blame 하지 말고 git praise 합시다. 🙇", "color:#656d76;font-size:12px");
|
|
console.log("%cps. 댓글에 LGTM 한 번 쳐보세요.", "color:#8b949e;font-size:11px");
|
|
} catch (e) {}
|
|
}
|
|
|
|
function boot() {
|
|
initTheme();
|
|
initUserMenu();
|
|
initLogoEgg();
|
|
initReactions();
|
|
initModals();
|
|
initComments();
|
|
initFeed();
|
|
initMyFilter();
|
|
initSignals();
|
|
consoleArt();
|
|
}
|
|
|
|
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", boot);
|
|
else boot();
|