(() => { const { EventManager, utils } = ShopbySkin; const { isMobileDevice } = utils; // 외부스크립트 등록 기능. 삭제금지 ShopbyExternalScript?.initialize({ apiOption: { platform: 'MOBILE_WEB', }, }).then(() => { EventManager.fire('QUERY_PAGE_SCRIPTS', ShopbyExternalScript?.scripts); }); EventManager.on('PAGE_LOAD_COMPLETED', ({ profile }) => { // 외부스크립트 등록 기능. 삭제금지 ShopbyExternalScript?.setGlobalObjectSb({ getPlatform: () => (isMobileDevice ? 'MOBILE_WEB' : 'PC'), profile, }); /* --- GNB 커스텀 기능 수정 버전 --- */ const currentPath = window.location.pathname; const currentParams = new URLSearchParams(window.location.search); const PLAN_HREF = '/pages/event/event-detail.html?event=80477&pageSize=20&pageNumber=1&sortType=ADMIN_SETTING&soldOut=true&includeStopProduct=true§ionNo=1354060'; const applyActiveGnb = () => { const currentEvent = currentParams.get('event'); // 현재 URL의 event 번호 추출 const gnbLinks = document.querySelectorAll('.new-gnb a'); if (gnbLinks.length === 0) { setTimeout(applyActiveGnb, 200); return; } // 1. 마이페이지 체크 if (window.location.href.includes('my-page') || currentPath.includes('/my/')) { const gnb = document.querySelector('.new-gnb'); if (gnb) gnb.style.display = 'none'; } // 2. 기획전 링크 강제 교체 (Shopby가 덮어쓰는 것 방지) gnbLinks.forEach((link) => { if (link.textContent.trim() === '기획전') { link.setAttribute('href', PLAN_HREF); } }); // 3. 현재 페이지 메뉴 Active 처리 gnbLinks.forEach((link) => { const menuPath = link.pathname; const menuParams = new URLSearchParams(link.search); const menuEvent = menuParams.get('event'); // 메뉴 링크의 event 번호 추출 link.classList.remove('active'); // 홈(/) 처리 if (menuPath === '/') { if (currentPath === '/') link.classList.add('active'); } // 이벤트 상세 페이지 처리 else if (currentPath.includes('event-detail.html') && menuPath.includes('event-detail.html')) { // event 번호까지 비교해서 정확하게 active 처리 if (currentEvent && menuEvent && currentEvent === menuEvent) { link.classList.add('active'); } } // 일반 페이지 처리 else { if (currentPath === menuPath && window.location.search.includes(link.search)) { link.classList.add('active'); } } }); // 4. MutationObserver로 Shopby가 다시 덮어써도 즉시 재교체 const gnb = document.querySelector('.new-gnb'); if (gnb) { const gnbObserver = new MutationObserver(() => { const link = gnb.querySelector('a[href*="event-detail"]'); if (link && !link.getAttribute('href').includes('event=80477')) { link.setAttribute('href', PLAN_HREF); } }); gnbObserver.observe(gnb, { subtree: true, attributes: true, attributeFilter: ['href'] }); } }; setTimeout(applyActiveGnb, 300); /* --- 로고 페이지별 분기 처리 시작 (최종) --- */ const headerLogo = document.querySelector('.header__logo'); const isMainPage = currentPath === '/' || currentPath.includes('index.html'); if (headerLogo) { if (isMainPage) { // 메인이면 is-sub 클래스 제거 -> CSS에 의해 메인 로고만 보임 headerLogo.classList.remove('is-sub'); } else { // 서브면 is-sub 클래스 추가 -> CSS에 의해 서브 로고만 보임 headerLogo.classList.add('is-sub'); } } /* --- 로고 페이지별 분기 처리 끝 --- */ }); const searchParams = new URLSearchParams(location.search); const trackingKey = searchParams.get('trackingKey'); const channelType = searchParams.get('channelType'); const { setTrackingKey, setChannelType } = ShopbySkin.utils; setTrackingKey(trackingKey); // NOTE: 네이트 로그인 전환으로 sign-in-form을 통한 직접 로그인이 제거되어 주석처리 // const requireMarketingPrivacyAgreeNotification = sessionStorage.getItem( // constants.REQUIRE_MARKETING_PRIVACY_AGREE_NOTIFICATION // ); // if (requireMarketingPrivacyAgreeNotification) { // sessionStorage.removeItem(constants.REQUIRE_MARKETING_PRIVACY_AGREE_NOTIFICATION); // if (!utils.isSignIn()) return; // const excludePages = new Set(['/pages/sign-in/expired-password-change-form.html', '/pages/my/modify-member.html']); // if (excludePages.has(location.pathname)) return; // EventManager.fire('MODAL_ALERT_OPEN', { // noticeType: '', // message: '이메일 및 SMS 수신을 위해
마케팅 목적의 개인정보 수집·이용에 동의해 주세요.', // onClose: () => { // const nextUrl = `${location.origin}/pages/my/modify-member.html`; // location.replace(nextUrl); // }, // }); // } })();