$(function () { /* ================================================== container.sub 클래스 (있을 때만) ================================================== */ const $container = $(".container.sub"); const section = $("h2.sub_title").data("section"); if ($container.length && section) { $container .removeClass("company major_result platform_tech") .addClass(section); } /* ================================================== src 경로 보정 ================================================== */ $("[src]").each(function () { const src = $(this).attr("src"); if (src && src.startsWith("../")) { $(this).attr("src", src.replace(/^\.\.\//, "/publish/usr/")); } }); /* ================================================== Sub Visual SNB 기본 세팅 ================================================== */ $(".icon.home").closest("a").attr("href", "/web/main/mainPage.do"); const $wraps = $(".sub_visual_nav .snb_wrap"); if ($wraps.length < 2) return; const $snbDepth01 = $wraps.eq(0).find(".snb_select"); const $snbDepth02 = $wraps.eq(1).find(".snb_select"); if ($snbDepth01.data("init")) return; $snbDepth01.data("init", true); const params = new URLSearchParams(location.search); const proFn = params.get("proFn"); const bbsId = params.get("bbsId"); const pathname = location.pathname; const isCommunity = pathname.includes("/bbsWeb/"); const isCommunityDetail = pathname.includes("selectBoardDetail.do"); const $gnb = $(".gnb").first(); /* ================================================== 현재 depth01 / depth02 결정 ================================================== */ let $currentDepth01Li = $(); let $currentDepth02 = $(); if (isCommunity) { $currentDepth01Li = $gnb.find("> li").filter(function () { return $(this).find("> .depth01").text().trim().toLowerCase() === "community"; }).first(); } else if (proFn) { $currentDepth02 = $gnb.find(`.depth02[href*="proFn=${proFn}"]`).first(); $currentDepth01Li = $currentDepth02.closest(".depth02_container").closest("li"); } if (!$currentDepth01Li.length) { $currentDepth01Li = $gnb.find("> li").first(); } const currentDepth01Text = $currentDepth01Li.find("> .depth01").text().trim(); /* ================================================== SNB depth01 생성 (대표 링크 = 첫 depth02) ================================================== */ $snbDepth01.empty(); $gnb.find("> li").each(function () { const text = $(this).find("> .depth01").text().trim(); if (!text) return; const firstHref = $(this).find(".depth02").first().attr("href") || "#"; const isActive = text === currentDepth01Text; $snbDepth01.append(`