$(function () { $('[src]').each(function () { const src = $(this).attr('src'); if (src && src.indexOf('../') === 0) { $(this).attr('src', src.replace(/^\.\.\//, '/publish/usr/')); } }); /* ================================================== Sub Visual SNB Navigation - 파일명 기준 자동 활성 - 대메뉴 클릭 시 첫 하위 페이지 이동 - 모바일/PC 공통 구조 ================================================== */ const BREAK_POINT = 1280; const $snbWrap = $(".snb_wrap"); const currentSection = $("h2.sub_title").data("section"); const currentFile = location.pathname.split("/").pop(); const MENU_MAP = { company: { base: "/web/content.do?proFn=", pages: [{ text: "설립배경", file: "999110005" }, { text: "연혁", file: "9989200" }, { text: "조직도", file: "9989400" }, { text: "오시는길", file: "9989300" } ] }, platform_tech: { base: "/web/content.do?proFn=", pages: [{ text: "연구배경", file: "9988100" }, { text: "Organelle Selective Autophagy", file: "9988200" } ] }, major_result: { base: "/web/content.do?proFn=", pages: [{ text: "Mitophagy", file: "9986100" }, { text: "Pexophagy", file: "9986200" }, { text: "Melanophagy", file: "9986300" }, { text: "Ciliogenesis", file: "9986400" }, { text: "Anti Cancer", file: "9986500" }, { text: "Pipeline Summary", file: "9986600" }, { text: "R&D", file: "9986700" } ] } }; /* ========================= 연혁 ========================= */ const BREAKPOINT = 1280; function bindHistoryScroll() { // 기존 이벤트 제거 (resize 대비) $('.history_month').off('scroll.history'); $(window).off('scroll.history'); if ($(window).width() < BREAKPOINT) return; // 1️⃣ history_month 내부 스크롤 → 연도 active $('.history_month').on('scroll.history', function () { let currentId = null; $('.month_ul').each(function () { if ($(this).position().top <= 1) { currentId = this.id; } }); if (currentId) { $('.year_item, .month_ul').removeClass('active'); $('#' + currentId).addClass('active'); $('#' + currentId.replace('year_', 'year')).addClass('active'); } }); // 2️⃣ body 스크롤 719 ± 20 → history_month active const TARGET = 719; const RANGE = 20; const $history = $('.history_month'); $(window).on('scroll.history', function () { const scrollTop = $(this).scrollTop(); if (scrollTop >= TARGET - RANGE && scrollTop <= TARGET + RANGE) { $history.addClass('active'); } else { $history.removeClass('active'); } }); } // 최초 실행 bindHistoryScroll(); // 리사이즈 대응 $(window).on('resize', function () { bindHistoryScroll(); }); /* ========================= SNB 렌더링 ========================= */ function renderSNB() { // 🔹 현재 URL에서 proFn 숫자만 추출 const currentFile = (function () { const match = location.search.match(/proFn=(\d+)/); return match ? match[1] : null; })(); $snbWrap.each(function (index) { const $wrap = $(this); const $title = $wrap.find(".snb_title"); const $list = $wrap.find(".snb_select"); function toTitleCase(str) { return str .replace(/_/g, " ") .replace(/\b\w/g, char => char.toUpperCase()); } /* ========================= 1️⃣ 첫 번째 SNB (대메뉴) ========================= */ if (index === 0) { if (currentSection) { $title.text(toTitleCase(currentSection)); } return; } /* ========================= 2️⃣ 두 번째 SNB (하위메뉴) ========================= */ const data = MENU_MAP[currentSection]; if (!data) return; $list.empty(); let matchedPage = null; data.pages.forEach(page => { const isActive = currentFile && page.file === currentFile; if (isActive) { matchedPage = page; } $list.append(`