File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
$(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(`
<li>
<a href="${data.base + page.file}"
class="${isActive ? 'active' : ''}">
${page.text}
</a>
</li>
`);
});
/* =========================
3️⃣ snb_title 최종 결정
========================= */
if (matchedPage) {
// 현재 URL과 매칭되는 페이지
$title.text(matchedPage.text);
} else if (data.pages.length) {
// 매칭 없으면 첫 번째 메뉴
$title.text(data.pages[0].text);
}
});
}
/* =========================
Toggle 동작
========================= */
$(".snb_title").on("click", function () {
const $wrap = $(this).closest(".snb_wrap");
const $currentList = $wrap.find(".snb_select");
// 다른 메뉴 닫기
$(".snb_wrap").not($wrap).removeClass("active")
.find(".snb_select").stop(true, true).slideUp(200);
// 현재 메뉴 토글
if ($wrap.hasClass("active")) {
$wrap.removeClass("active");
$currentList.stop(true, true).slideUp(200);
} else {
$wrap.addClass("active");
$currentList.stop(true, true).slideDown(250);
}
});
/* =========================
대메뉴 클릭 시 첫 페이지 이동
========================= */
$(".snb_wrap").eq(0).find(".snb_select").on("click", "a", function (e) {
e.preventDefault();
const section = $(this).text().toLowerCase().replace(/\s/g, "_");
const data = MENU_MAP[section];
if (!data) return;
location.href = data.base + data.pages[0].file;
});
/* =========================
외부 클릭 시 닫기
========================= */
$(document).on("click", function (e) {
if (!$(e.target).closest(".snb_wrap").length) {
$(".snb_wrap").removeClass("active")
.find(".snb_select").stop(true, true).slideUp(200);
}
});
/* =========================
초기 실행
========================= */
renderSNB();
if (currentSection) {
$(".container.sub").addClass(currentSection);
}
})