PageSourceSearch

https://dona-d.com/ind-script/optimizer_user.php?filename=hY5BDsIw…8a9a6eaca6fe50947153991&t=1744962167&user=T

js dona-d.com collected 2026-09-29 03:32:22 UTC 65,866 bytes, 1,712 lines download raw bytes

1/////////////////////////////////
2// plp-only.js - Desktop (Kor) //
3/////////////////////////////////
4
5//정렬 select onchange
6const plpSort = (select) => {
7  const defaultUrl = location.href.split("?")[0];
8  location.href = defaultUrl + select.value;
9};
10
11//사이트 로딩 시 selcet option selected 표시
12const plpSortDefaultState = () => {
13  const currentUrl = location.href;
14
15  document.querySelectorAll("#type option").forEach((item) => {
16    if (currentUrl.indexOf(item.value) > -1) {
17      item.setAttribute("selected", true);
18    }
19  });
20};
21plpSortDefaultState();
22
23document.querySelectorAll(".menuCategory > li").length < 1 ? document.querySelector(".menuCategory").classList.add("displaynone") : undefined;
24
25/*plp-sorting layout 변경*/
26const plpLayout = (layoutBtn, layoutType) => {
27  if (layoutType === "small") {
28    if (document.querySelector(".plp-card-container")) {
29      document.querySelector(".plp-card-container").classList.remove("grid-6");
30      document.querySelector(".plp-card-container").classList.add("grid-4");
31    }
32    Cookies.set("plpLayoutType", "small", { expires: 1 });
33  } else if (layoutType === "big") {
34    if (document.querySelector(".plp-card-container")) {
35      document.querySelector(".plp-card-container").classList.remove("grid-4");
36      document.querySelector(".plp-card-container").classList.add("grid-6");
37    }
38    Cookies.set("plpLayoutType", "big", { expires: 1 });
39  }
40
41  document.querySelector(".plp-layout li.selected").classList.remove("selected");
42  layoutBtn.classList.add("selected");
43};
44
45const moPlpLayout = (mLayoutBtn, moLayoutType) => {
46  if (moLayoutType === "moSmall") {
47    if (document.querySelector(".plp-card-container")) {
48      document.querySelector(".plp-card-container").classList.remove("grid-6");
49      document.querySelector(".plp-card-container").classList.add("grid-4");
50    }
51    document.querySelector("#m-layout-wide").classList.remove("selected");
52    document.querySelector("#m-layout-standard").classList.add("selected");
53    Cookies.set("plpLayoutType", "small", { expires: 1 });
54  } else if (moLayoutType === "moBig") {
55    if (document.querySelector(".plp-card-container")) {
56      document.querySelector(".plp-card-container").classList.remove("grid-4");
57      document.querySelector(".plp-card-container").classList.add("grid-6");
58    }
59    document.querySelector("#m-layout-standard").classList.remove("selected");
60    document.querySelector("#m-layout-wide").classList.add("selected");
61    Cookies.set("plpLayoutType", "big", { expires: 1 });
62  }
63};
64
65const loadCookie = () => {
66  const getCookie = Cookies.get("plpLayoutType");
67  if (getCookie === "small") {
68    if (document.querySelector(".plp-card-container")) {
69      document.querySelector(".plp-card-container").classList.remove("grid-6");
70      document.querySelector(".plp-card-container").classList.add("grid-4");
71    }
72    document.getElementById("layout-wide").classList.remove("selected");
73    document.getElementById("layout-standard").classList.add("selected");
74    Cookies.set("plpLayoutType", "small", { expires: 1 });
75  } else if (getCookie === "big") {
76    if (document.querySelector(".plp-card-container")) {
77      document.querySelector(".plp-card-container").classList.remove("grid-4");
78      document.querySelector(".plp-card-container").classList.add("grid-6");
79    }
80    document.getElementById("layout-standard").classList.remove("selected");
81    document.getElementById("layout-wide").classList.add("selected");
82    Cookies.set("plpLayoutType", "big", { expires: 1 });
83  }
84  // document.querySelector('.plp-card-container').classList.add('cookie-loaded');
85};
86loadCookie();
87/*// plp-sorting layout 변경*/
88
89/*plp 종류 구분 - styling인 경우 */
90if (!document.getElementById("drmvsn-plp-container").classList.contains("category-no-940")) {
91  const lazyImgs = document.querySelectorAll(".thumbnail-slider .lazy");
92  lazyImgs.forEach((lazy) => {
93    const img = lazy.querySelector("img");
94    if (img.dataset.src === null || img.dataset.src === "") {
95      const parent = img.closest(".swiper-wrapper");
96      parent.removeChild(lazy);
97    }
98  });
99  /* 썸네일 슬라이드*/
100  const plpThumbnailSwiper = new Swiper(".thumbnail-slider", {
101    loop: true,
102    navigation: {
103      nextEl: ".thumbnail-slider .swiper-button-next",
104      prevEl: ".thumbnail-slider .swiper-button-prev",
105    },
106    scrollbar: {
107      el: ".thumbnail-slider .swiper-scrollbar",
108    },
109  });
110  /*// 썸네일 슬라이드*/
111  const plpProjectSwiper = new Swiper(".shop-project-plp .thumbnail-slider", {
112    loop: true,
113    navigation: {
114      nextEl: ".shop-project-plp .thumbnail-slider .swiper-button-next",
115      prevEl: ".shop-project-plp .thumbnail-slider .swiper-button-prev",
116    },
117    scrollbar: {
118      el: ".shop-project-plp .thumbnail-slider .swiper-scrollbar",
119    },
120  });
121}
122
123/*plp-listmore 로드모어 added by yeonsu 231129*/
124//TODO
125if (document.querySelector(".typeMoreview") !== null) {
126  var loadMore = 0;
127  var loadMorePos = 0;
128
129  const targetNode = document.querySelector(".plp-card-container");
130  const config = { attributes: false, childList: true, subtree: false };
131  const callback = function (mutationsList, observer) {
132    for (const mutation of mutationsList) {
133      // imagesLoaded(document.querySelector('.prdList'), function (instance) {
134      var readyImg = document.querySelectorAll(".plp-card-container >li");
135      for (var i = 0; i < readyImg.length; i++) {
136        // readyImg[i].classList.add('xans-record-');
137      }
138      // });
139
140      //이미지 레이지 로드
141      drmvsnImageLazyLoad();
142
143      if (!document.getElementById("drmvsn-plp-container").classList.contains("category-no-940")) {
144        const lazyImgs = document.querySelectorAll(".thumbnail-slider .lazy");
145        lazyImgs.forEach((lazy) => {
146          const img = lazy.querySelector("img");
147          if (img.dataset.src === null || img.dataset.src === "") {
148            const parent = img.closest(".swiper-wrapper");
149            parent.removeChild(lazy);
150          }
151        });
152        /* 썸네일 슬라이드*/
153        const plpThumbnailSwiper = new Swiper(".thumbnail-slider", {
154          loop: true,
155          navigation: {
156            nextEl: ".thumbnail-slider .swiper-button-next",
157            prevEl: ".thumbnail-slider .swiper-button-prev",
158          },
159          scrollbar: {
160            el: ".thumbnail-slider .swiper-scrollbar",
161          },
162        });
163        /*// 썸네일 슬라이드*/
164        const plpProjectSwiper = new Swiper(".shop-project-plp .thumbnail-slider", {
165          loop: true,
166          navigation: {
167            nextEl: ".shop-project-plp .thumbnail-slider .swiper-button-next",
168            prevEl: ".shop-project-plp .thumbnail-slider .swiper-button-prev",
169          },
170          scrollbar: {
171            el: ".shop-project-plp .thumbnail-slider .swiper-scrollbar",
172          },
173        });
174      }
175    }
176  };
177  if (targetNode) {
178    const observer = new MutationObserver(callback);
179    observer.observe(targetNode, config);
180  }
181}
182/*//plp-listmore 로드모어 added by yeonsu 231129*/
183
184// const stylingCatP = GLOBAL_VARIABLES_DRMVSN.catP[0]
185// if (stylingCatP.split('?cate_no=')[1] == '940') { //스타일링(940)
186//     document.body.classList.add('styling-plp')
187// } else {
188//     document.body.classList.add('norm-plp');
189
190// }
191/*//plp 종류 구분 - styling인 경우 */
192
193/* 쇼핑 큐레이션 */
194const toggleCuration = () => {
195  document.body.classList.toggle("curation-opened");
196  const targetElement = document.querySelector("#searchSidebar");
197  if (document.body.classList.contains("curation-opened")) {
198    bodyScrollLock.disableBodyScroll(targetElement);
199  } else {
200    bodyScrollLock.clearAllBodyScrollLocks();
201  }
202};
203
204function curationTab(element) {
205  var tabBox = document.querySelectorAll(".xans-product-searchfilterlist");
206  if (element.parentElement.className.indexOf("selected") < 0) {
207    for (var i = 0; i < tabBox.length; i++) {
208      tabBox[i].classList.remove("selected");
209    }
210    element.parentElement.classList.add("selected");
211  } else {
212    for (var i = 0; i < tabBox.length; i++) {
213      tabBox[i].classList.remove("selected");
214    }
215  }
216}
217/* //쇼핑 큐레이션 */
218
219/* 모바일 sort by */
220const closePlpSort = () => document.getElementById("mobile-sorting").classList.remove("opened");
221const openPlpSort = () => document.getElementById("mobile-sorting").classList.add("opened");
222/* //모바일 sort by */
223
224//상품정렬 셀렉트에 외부텍스트 집어넣기
225const returnCurrentPlpId = () => {
226  if (!GLOBAL_VARIABLES_DRMVSN.catP) return;
227  const currentGroup = GLOBAL_VARIABLES_DRMVSN.catP.filter((cat) => cat !== "").slice(-1);
228  return Number(currentGroup[0].split("?cate_no=")[1]);
229};
230
231const donadPlpHeader = async () => {
232  //NAME 으로 검증하므로 동명 메뉴 있을 경우 고려 (같은 child내나 grandchild내)
233  const searchParams = new URLSearchParams(window.location.search);
234  const sortId = searchParams.get("sort_method");
235  const plpSelect = document.querySelector("#Product_ListMenu .select select");
236  const sortBy = document.createElement("option");
237  sortBy.selected = true;
238  sortBy.disabled = true;
239  sortBy.textContent = "추천순";
240  if (typeof returnCurrentPlpId() !== "undefined") {
241    plpSelect.prepend(sortBy);
242  }
243  plpSelect.classList.remove("displaynone");
244  if (sortId === null) {
245    plpSelect.classList.add("default");
246  }
247};
248donadPlpHeader();
249
250//styling move up animation
251
252gsap.registerPlugin(ScrollTrigger);
253
254const stylingMotion = () => {
255  const moveAndOpacity = gsap.utils.toArray(".category-no-940.shop-only-plp .xans-product-listnormal .flex.grid-4>li");
256  moveAndOpacity.forEach((elem, i) => {
257    if (elem.classList.contains("gsap-loaded")) return;
258    elem.classList.add("gsap-loaded");
259    elem.classList.contains("less") ? gsap.set(elem, { yPercent: 1 }) : gsap.set(elem, { yPercent: 10 });
260    gsap.to(elem, {
261      y: 0,
262      yPercent: 0,
263      opacity: 1,
264      duration: 1,
265      id: `id-${i}`,
266      scrollTrigger: { trigger: elem, start: "top bottom-=100" },
267      delay: elem.dataset.delay ? (Number(elem.dataset.delay) - 1) * 0.05 : 0,
268    });
269  });
270};
271stylingMotion();
272
273const pandassiPromiseForPlp = loadScript("//dona-d.com/web/upload/appfiles/0zdpAngaKBFnlCcCqpCU4A/5ca2e6666839d1c79485dd2962299c43.js?v=" + GLOBAL_VARIABLES_DRMVSN.now); // 현재시간가져와서 버전 업데이트
274
275pandassiPromiseForPlp.then(async function () {
276  const catNo = GLOBAL_VARIABLES_DRMVSN.catP;
277  const filteredCatNo = catNo.filter((cat) => cat !== "");
278
279  const plpBanners = pandassiBannerManage.i["_9c034500eb04479966e0"].banners["98a3a65395e72a3d75a0"].banner;
280  const plpBannersM = pandassiBannerManage.i["_9c034500eb04479966e0"].banners["01d4f136405f299fbedb"].banner;
281
282  const currentPlp = plpBanners.filter(({ linkURL }) => {
283    return linkURL === filteredCatNo.slice(-1)[0].split("cate_no=")[1];
284  })[0];
285
286  const currentPlpM = plpBannersM.filter(({ linkURL }) => {
287    return linkURL === filteredCatNo.slice(-1)[0].split("cate_no=")[1];
288  })[0];
289
290  // console.log(currentPlpM);
291
292  if (currentPlp) {
293    const template = `
294            <div class="plp-banner-img"><img src="//${currentPlp.imageURL}" /></div>
295            <div class="plp-banner-text">${currentPlp.html}</div>
296            `;
297    document.getElementById("plp-head-container").innerHTML = template;
298  }
299
300  if (currentPlpM) {
301    const template = `
302            <div class="plp-banner-img"><img src="//${currentPlpM.imageURL}" /></div>
303            <div class="plp-banner-text">${currentPlpM.html}</div>
304            `;
305    document.getElementById("plp-head-container-mobile").innerHTML = template;
306  }
307}); 
308const plpOptionsDisplay = {
309  presetInactive: false, //true 인 경우, 하단 option에 없는 항목들은 display:none 적용
310  options: [
311    //{
312    //     title: "상품정보표시관리에서 사용하는 이름",
313    //     customClass : "부여할 클래스명",
314    //     showFilteredView: filtered-sorted-product-options에 따로 보여줘야 하는 경우 true
315    // },
316    { title: "상품명", customClass: "prd-name" },
317    { title: "판매가", customClass: "prd-price" },
318    { title: "할인가", customClass: "prd-sale-price" },
319    { title: "상품요약정보", customClass: "prd-summary" },
320    { title: "상품요약설명", customClass: "prd-summary" },
321    { title: "상품간략설명", customClass: "prd-desc" },
322    { title: "소비자가", customClass: "prd-customer-price" },
323    { title: "등급할인가", customClass: "prd-member-sale-price" },
324
325    // 아래 두 obj 사용 시 pdp-menu-order.js 코드 참고
326    // { title: "소비자가", customClass: "prd-customer-price", showFilteredView: false },
327    // { title: "등급할인가", customClass: "prd-member-sale-price", showFilteredView: false },
328  ],
329};
330
331function percentageCul(target, priceElement, discountElement) {
332  if (target.querySelector('li[data-name="할인가"]')) {
333    target.closest(".prd-card").classList.add("on-sale");
334  }
335  let iCustomPrice = target.querySelector("li.prd-customer-price > span") ? parseInt(target.querySelector("li.prd-customer-price > span").textContent.split("원")[0].replace(",", "")) : 0, //소비자가
336    iPrice = target.querySelector("li.prd-price > span") ? parseInt(target.querySelector("li.prd-price > span").textContent.split("원")[0].replace(",", "")) : 0; //판매가
337
338  let iSalePrice = target.querySelector("li.prd-sale-price > span") ? parseInt(target.querySelector("li.prd-sale-price > span").textContent.split("원")[0].replace(",", "")) : 0; //할인판매가 (등급?)
339  let iOfftoFixed = 0; // 할인율 소수점 자릿수
340  //on-sale -> 소/판 할인
341  //on-extra-sale => 판/할 할인
342  // console.log(iSalePrice, '할인가-iSalePrice', iPrice, '판매가-iPrice', iCustomPrice, '소비자가-iCu
342stomPrice')
343  if (iPrice <= 0) return;
344  if (iPrice < iCustomPrice) {
345    //판매가가 소비자가 보다 적을때 : 판매가가 할인가
346    // console.log('기본가:소비자가')
347    //소비자가 대비 판매가의 할인율 표기
348    // console.log('1할인가:판매가')
349    const sSaleText = (((iCustomPrice - iPrice) / iCustomPrice) * 100).toFixed(iOfftoFixed) + "%";
350    const span = document.createElement("span");
351    span.classList.add("drmvsn-price", "custom-discount-rate");
352    span.textContent = sSaleText;
353    priceElement ? priceElement.append(span) : undefined;
354    target.closest(".prd-card").classList.add("on-sale");
355
356    if (iSalePrice < iPrice && iSalePrice > 0) {
357      //할인가가 판매가보다 적을때 : 판매가 = 할인가, 할인가 = 프로모션(ex. 등급할인가 적용)
358      // console.log('[소]2할인가:프로모션 or 등급 할인가')
359      const sPromoDiscountText = (((iCustomPrice - iSalePrice) / iCustomPrice) * 100).toFixed(iOfftoFixed) + "%"; //소비자가 대비 할인율
360
361      const span = document.createElement("span");
362      span.classList.add("drmvsn-member-price", "custom-discount-rate");
363      span.textContent = sPromoDiscountText;
364      // discountElement ? discountElement.append(span) : undefined
365      target.closest(".prd-card").classList.add("on-extra-sale");
366    }
367  } else {
368    // 판매가가 소비자가랑 같거나 판매가가 소비자보다 적을때 : 소비자가 무효, 판매가를 기본 가격으로
369    // console.log('기본가:판매가')
370    // document.querySelector('.infoArea .info-basic').classList.add('price-as-target-price')
371    if (!document.querySelector(".xans-myshop-wishlist")) {
372      //위시리스트 카드는 예외처리
373      target.querySelector("li.prd-customer-price") !== null ? target.querySelector("li.prd-customer-price").classList.add("displaynone") : undefined;
374    }
375    if (iSalePrice < iPrice) {
376      // console.log('[판]2할인가:프로모션 or 등급 할인가')
377      // document.querySelector("#sidebar .infoArea").classList.add("on-sale")
378      const sPromoDiscountText = (((iPrice - iSalePrice) / iPrice) * 100).toFixed(iOfftoFixed) + "%"; // 소비자가 무효 -> 판맨가 대비 할인율
379      const span = document.createElement("span");
380      span.classList.add("drmvsn-member-price");
381      span.textContent = sPromoDiscountText;
382      // discountElement ? discountElement.append(span) : undefined
383      target.closest(".prd-card").classList.add("on-extra-sale");
384    }
385  }
386}
387
388const initPrdOptions = () => {
389  const prdOptionRow = document.querySelectorAll(".ec-base-product .spec > li");
390  prdOptionRow.forEach((row) => {
391    plpOptionsDisplay.presetInactive ? (row.style.display = "none") : undefined;
392    const rowName = row.querySelector("strong > span") ? row.querySelector("strong > span").textContent : "";
393    plpOptionsDisplay.options.forEach((filterOption) => {
394      if (rowName == filterOption.title) {
395        row.classList.add(filterOption.customClass);
396      }
397    });
398  });
399};
400initPrdOptions();
401
402const allCardsSpecs = () => {
403  const cardsSpecs = document.querySelectorAll(".ec-base-product ul li .spec");
404  cardsSpecs.forEach((spec) => {
405    if (!spec.classList.contains("applied")) {
406      percentageCul(spec, spec.querySelector(".prd-price") ? spec.querySelector(".prd-price") : undefined, spec.querySelector(".prd-sale-price") ? spec.querySelector(".prd-sale-price") : undefined);
407      spec.classList.add("applied");
408    }
409  });
410};
411allCardsSpecs();
412
413/* 할인기간 append */
414const salePeriodAppend = () => {
415  const prdCards = document.querySelectorAll(".ec-base-product .prd-card");
416
417  prdCards.forEach((item) => {
418    if (!item.querySelector('li[data-name="할인가"]')) return;
419
420    if (item.querySelector(".period")) return;
421    const periodHTML = item.querySelector(".sale-period").innerHTML;
422    const periodTag = document.createElement("div");
423    periodTag.classList.add("period");
424
425    if (item.querySelector(".sale-period .text").textContent == "") periodTag.classList.add("displaynone");
426
427    periodTag.innerHTML = periodHTML;
428
429    item.querySelector('li[data-name="할인가"]').append(periodTag);
430  });
431};
432salePeriodAppend();
433/* //할인기간 append */
434
435/**
436 * 조건별 검색 기능 스크립트
437 */
438$(document).ready(function()
439{
440    var sParentElement = 'select.SecondSelect';
441    $('select.FirstSelect').change(function()
442    {
443        var iGroupNo = $(this).find('option:selected').val();
444        if (iGroupNo > 0) {
445            $.ajax({
446                url : '/product/provider/selectsearch.xml?GroupNo=' + iGroupNo,
447                dataType : 'text',
448                success : function(data){
449                    if ( window.DOMParser ) {
450                        tmp = new DOMParser();
451                        xml = tmp.parseFromString( data , "text/xml" );
452                    } else {
453                        xml = new ActiveXObject( "Microsoft.XMLDOM" );
454                        xml.async = "false";
455                        xml.loadXML( data );
456                    }
457
458                    $(sParentElement).html('');
459                    getOptionElement('','-세부항목선택-').appendTo(sParentElement);
460                    var nodes = $(xml).find('searchkey');
461                    for ( var x = 0 ; x < nodes.length ; x++) {
462                        getOptionElement($(nodes[x]).find('search_value').text(),$(nodes[x]).find('search_value').text()).appendTo(sParentElement);
463                    }
464                }
465            });
466        }
467    });
468    $('a.SelectSearch').click(function()
469    {
470        var sGroup = $('select.FirstSelect').val();
471        var sItem = $('select.SecondSelect').val();
472        if (!sGroup) {
473            alert('조건을 선택해 주세요.');
474            return false;
475        }
476        if (!sItem) {
477            alert('세부 항목을 선택해 주세요.');
478            return false;
479        }
480        location.href = document.location.href.split('?')[0].split(document.domain)[1] + '?' + sSSUrl + '&sGroup=' + sGroup + '&sItem=' + sItem;
481    });
482
483    function getOptionElement(sVal, sTitle)
484    {
485        return $("<option value='" + sVal + "'>" + sTitle + "</option>");
486    }
487});
488/**
489 *  tooltip
490 */
491$(".eTooltip").each(function (i) {
492  $(this).find(".btnClose").attr("tabIndex", "-1");
493});
494//tooltip input focus
495$(".eTooltip")
496  .find("input")
497  .focus(function () {
498    var targetName = returnTagetName(this);
499    targetName.siblings(".ec-base-tooltip").show();
500  });
501$(".eTooltip")
502  .find("input")
503  .focusout(function () {
504    var targetName = returnTagetName(this);
505    targetName.siblings(".ec-base-tooltip").hide();
506  });
507function returnTagetName(_this) {
508  var ePlacename = $(_this).parent().attr("class");
509  var targetName;
510  if (ePlacename == "ePlaceholder") {
511    //ePlaceholder 대응
512    targetName = $(_this).parents();
513  } else {
514    targetName = $(_this);
515  }
516  return targetName;
517}
518
519/**
520 *  eTab
521 */
522$("body").delegate(".eTab a", "click", function (e) {
523  // 클릭한 li 에 selected 클래스 추가, 기존 li에 있는 selected 클래스는 삭제.
524  var _li = $(this)
525      .parent("li")
526      .addClass("selected")
527      .siblings()
528      .removeClass("selected"),
529    _target = $(this).attr("href"),
530    _siblings = $(_target).attr("class"),
531    _arr = _siblings.split(" "),
532    _classSiblings = "." + _arr[0];
533
534  //클릭한 탭에 해당하는 요소는 활성화, 기존 요소는 비활성화 함.
535  $(_target).show().siblings(_classSiblings).hide();
536
537  //preventDefault 는 a 태그 처럼 클릭 이벤트 외에 별도의 브라우저 행동을 막기 위해 사용됨.
538  e.preventDefault();
539});
540
541
542
543$(document).ready(function(){
544  // 토글
545  $('div.eToggle .title').click(function(){
546      var toggle = $(this).parent('.eToggle');
547      if(toggle.hasClass('disable') == false){
548          $(this).parent('.eToggle').toggleClass('selected')
549      }
550  });
551
552  $('dl.eToggle dt').click(function(){
553      $(this).toggleClass('selected');
554      $(this).next('dd').toggleClass('selected');
555  });
556
557  //장바구니 페이지 수량폼 Type 변경
558  $('[id^="quantity"]').each(function() {
559      $(this).get(0).type = 'tel';
560  });
561
562  // 모바일에서 공급사 테이블 th 강제조절
563  $('.xans-mall-supplyinfo, .supplyInfo').find('table > colgroup').find('col').eq(0).width(98);
564  $('.xans-mall-supplyinfo, .supplyInfo').find('th, td').css({padding:'13px 10px 12px'});
565
566  /**
567   *  메인카테고리 toggle
568   */
569  $('.xans-product-listmain h2').toggle(function(){
570      $(this).css('background-image', 'url("//img.echosting.cafe24.com/skin/mobile_ko_KR/layout/bg_title_open.gif")');
571      $(this).siblings().hide();
572      $(this).parent().find('div.ec-base-paginate').hide();
573      $(this).parent().next('div.xans-product-listmore').hide();
574  }, function() {
575      $(this).css('background-image', 'url("//img.echosting.cafe24.com/skin/mobile_ko_KR/layout/bg_title_close.gif")');
576      $(this).siblings().show();
577      $(this).parent().find('div.ec-base-paginate').show();
578      $(this).parent().next('div.xans-product-listmore').show();
579  });
580
581  /* base header 검색 레이어 */
582  $('#layout .header').find('.search .btnSearch').bind('click', function(){
583      var $baseHeader = $('#layout .header');
584      $baseHeader.addClass('open');
585      $('#dimmedSlider').one('click', function(){
586          $baseHeader.removeClass('open');
587      });
588  });
589  
590  /**
591   *  구매버튼
592   */
593  var globalBuyBtnScrollFunc = function() {
594      // 구매버튼 관련변수
595      var sFixId = $('#orderFixItem').size() > 0  ? 'orderFixItem' : 'fixedActionButton',
596          $area = $('#orderFixArea'),
597          $item = $('#' + sFixId + '').not($area);
598
599      $(window).scroll(function(){
600          try {
601              // 구매버튼 관련변수
602              var iCurrentHeightPos = $(this).scrollTop() + $(this).height(),
603                  iButtonHeightPos = $item.offset().top;
604
605              if (iCurrentHeightPos > iButtonHeightPos || iButtonHeightPos < $(this).scrollTop() + $item.height()) {
606                  if (iButtonHeightPos < $(this).scrollTop() - $item.height()) {
607                      $area.fadeIn('fast');
608                  } else {
609                      $area.hide();
610                  }
611              } else {
612                  $area.fadeIn('fast');
613              }
614          } catch(e) { }
615      });
616  };
617
618  globalBuyBtnScrollFunc();
619});
620
621// 공통레이어팝업 오픈
622var globalLayerOpenFunc = function(_this) {
623  this.id = $(_this).data('id');
624  this.param = $(_this).data('param');
625  this.basketType = $('#basket_type').val();
626  this.url = $(_this).data('url');
627  this.layerId = 'ec_temp_mobile_layer';
628  this.layerIframeId = 'ec_temp_mobile_iframe_layer';
629
630  var _this = this;
631
632  function paramSetUrl() {
633      if (this.param) {
634          // if isset param
635      } else {
636          this.url = this.basketType ?  this.url + '?basket_type=' + this.basketType : this.url;
637      }
638  };
639
640  if (this.url) {
641      window.ecScrollTop = $(window).scrollTop();
642      $.ajax({
643          url : this.url,
644          success : function (data) {
645              if (data.indexOf('404 페이지 없음') == -1) {
646                  // 있다면 삭제
647                  try { $(_this).remove(); } catch ( e ) { }
648
649                  var $layer = $('<div>', {
650                      html: $("<iframe>", { src: _this.url, id: _this.layerIframeId, scrolling: 'auto', css: { width: '100%', height: '100%', overflowY: 'auto', border: 0 } } ),
651                      id: _this.layerId,
652                      css : { position: 'absolute', top: 0, left:0, width: '100%', height: $(window).height(), 'z-index': 9999 }
653                  });
654
655                  $('body').append($layer);
656                  $('html, body').css({'overflowY': 'hidden', height: '100%', width: '100%'});
657                  $('#' + this.layerId).show();
658              }
659          }
660      });
661  }
662};
663
664// 공통레이어팝업 닫기
665var globalLayerCloseFunc = function() {
666  this.layerId = 'ec_temp_mobile_layer';
667
668  if (window.parent === window)
669      self.clse();
670  else {
671      parent.$('html, body').css({'overflowY': 'auto', height: 'auto', width: '100%'});
672      parent.$('html, body').scrollTop(parent.window.ecScrollTop);
673      parent.$('#' + this.layerId).remove();
674  }
675};
676
677/**
678* document.location.href split
679* return array Param
680*/
681var getQueryString = function(sKey)
682{
683  var sQueryString = document.location.search.substring(1);
684  var aParam = {};
685
686  if (sQueryString) {
687      var aFields = sQueryString.split("&");
688      var aField  = [];
689      for (var i=0; i<aFields.length; i++) {
690          aField = aFields[i].split('=');
691          aParam[aField[0]] = aField[1];
692      }
693  }
694
695  aParam.page = aParam.page ? aParam.page : 1;
696  return sKey ? aParam[sKey] : aParam;
697};
698
699/* 도움말 */
700$('body').delegate('.ec-base-tooltip-area .eTip', 'click', function(e){
701  var findArea = $($(this).parents('.ec-base-tooltip-area'));
702  var findTarget = $($(this).siblings('.ec-base-tooltip'));
703  var findTooltip = $('.ec-base-tooltip');
704  $('.ec-base-tooltip-area').removeClass('show');
705  $(this).parents('.ec-base-tooltip-area:first').addClass('show');
706  findTooltip.hide();
707  findTarget.show();
708  e.preventDefault();
709});
710
711$('body').delegate('.ec-base-tooltip-area .eClose', 'click', function(e){
712  var findTarget = $(this).parents('.ec-base-tooltip:first');
713  $('.ec-base-tooltip-area').removeClass('show');
714  findTarget.hide();
715  e.preventDefault();
716});
717
718$('.ec-base-tooltip-area').find('input').focusout(function() {
719  var findTarget = $(this).parents('.ec-base-tooltip-area').find('.ec-base-tooltip');
720  $('.ec-base-tooltip-area').removeClass('show');
721  findTarget.hide();
722});
723
724/**
725* 팝업창에 리사이즈 관련
726*/
727
728function setResizePopup() {
729
730  if(!$('#popup').length) return;
731
732  var iWrapWidth    = $('#popup').width();
733  var iWrapHeight   = $('#popup').height();
734
735  var iWindowWidth  = $(window).width();
736  var iWindowHeight = $(window).height();
737
738  window.resizeBy(iWrapWidth - iWindowWidth, iWrapHeight - iWindowHeight);
739}
740// isMobile
741(function () {
742  var f = {};
743  var g = /iPhone/i,
744    i = /iPod/i,
745    j = /iPad/i,
746    k = /\biOS-universal(?:.+)Mac\b/i,
747    h = /\bAndroid(?:.+)Mobile\b/i,
748    m = /Android/i,
749    c = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,
750    d = /Silk/i,
751    b = /Windows Phone/i,
752    n = /\bWindows(?:.+)ARM\b/i,
753    p = /BlackBerry/i,
754    q = /BB10/i,
755    s = /Opera Mini/i,
756    t = /\b(CriOS|Chrome)(?:.+)Mobile/i,
757    u = /Mobile(?:.+)Firefox\b/i,
758    v = function (l) {
759      return void 0 !== l && "MacIntel" === l.platform && "number" == typeof l.maxTouchPoints && l.maxTouchPoints > 1 && "undefined" == typeof MSStream;
760    };
761  function w(l) {
762    return function ($) {
763      return $.test(l);
764    };
765  }
766  function x(l) {
767    var $ = { userAgent: "", platform: "", maxTouchPoints: 0 };
768    l || "undefined" == typeof navigator
769      ? "string" == typeof l
770        ? ($.userAgent = l)
771        : l && l.userAgent && ($ = { userAgent: l.userAgent, platform: l.platform, maxTouchPoints: l.maxTouchPoints || 0 })
772      : ($ = { userAgent: navigator.userAgent, platform: navigator.platform, maxTouchPoints: navigator.maxTouchPoints || 0 });
773    var a = $.userAgent,
774      e = a.split("[FBAN");
775    void 0 !== e[1] && (a = e[0]), void 0 !== (e = a.split("Twitter"))[1] && (a = e[0]);
776    var r = w(a),
777      o = {
778        apple: { phone: r(g) && !r(b), ipod: r(i), tablet: !r(g) && (r(j) || v($)) && !r(b), universal: r(k), device: (r(g) || r(i) || r(j) || r(k) || v($)) && !r(b) },
779        amazon: { phone: r(c), tablet: !r(c) && r(d), device: r(c) || r(d) },
780        android: { phone: (!r(b) && r(c)) || (!r(b) && r(h)), tablet: !r(b) && !r(c) && !r(h) && (r(d) || r(m)), device: (!r(b) && (r(c) || r(d) || r(h) || r(m))) || r(/\bokhttp\b/i) },
781        windows: { phone: r(b), tablet: r(n), device: r(b) || r(n) },
782        other: { blackberry: r(p), blackberry10: r(q), opera: r(s), firefox: r(u), chrome: r(t), device: r(p) || r(q) || r(s) || r(u) || r(t) },
783        any: !1,
784        phone: !1,
785        tablet: !1,
786      };
787    return (o.any = o.apple.device || o.android.device || o.windows.device || o.other.device), (o.phone = o.apple.phone || o.android.phone || o.windows.phone), (o.tablet = o.apple.tablet || o.android.tablet || o.windows.tablet), o;
788  }
789  f = x();
790  if (typeof exports === "object" && typeof module !== "undefined") {
791    module.exports = f;
792  } else if (typeof define === "function" && define.amd) {
793    define(function () {
794      return f;
795    });
796  } else {
797    this["isMobile"] = f;
798  }
799})();
800// //isMobile
801
802///////////////////////////////
803// Common.js - Resoponsive (Kor) //
804///////////////////////////////
805//search placeholder 적용
806document.getElementById("keyword") ? document.getElementById("keyword").setAttribute("placeholder", GLOBAL_VARIABLES_DRMVSN.stringArray.searchPlaceholder) : undefined;
807
808// 카테고리 정보
809GLOBAL_VARIABLES_DRMVSN.firstLevel = [];
810
811async function returnNavs() {
812  // revalidate 기법 사용
813  const now = new Date();
814  const currentTime = now.getTime();
815  const revalidate = 10;
816
817  let loadAPI = true;
818
819  if (localStorage.getItem("drmvsn-custom-nav-update") === null) {
820    localStorage.setItem("drmvsn-custom-nav-update", currentTime);
821  } else {
822    const savedTime = localStorage.getItem("drmvsn-custom-nav-update");
823    const difference = Math.abs((savedTime - currentTime) / 1000);
824
825    if (difference > revalidate) {
826      localStorage.setItem("drmvsn-custom-nav-update", currentTime);
827    } else {
828      loadAPI = false;
829    }
830  }
831
832  if (!loadAPI && localStorage.getItem("drmvsn-custom-nav") !== null) {
833    const result2ndLocal = localStorage.getItem("drmvsn-custom-nav");
834    console.log("NO API, LOCALSTORAGE ONLY");
835    return JSON.parse(result2ndLocal);
836  }
837
838  // 네비게이션 출력
839  const response = await fetch("/exec/front/Product/SubCategory");
840  const navJson = await response.json();
841
842  let currentCAT = 0;
843
844  if (GLOBAL_VARIABLES_DRMVSN.catP) {
845    const currentCatFromCatP = [...GLOBAL_VARIABLES_DRMVSN.catP].reverse().find((x) => x !== "");
846    currentCAT = parseInt(currentCatFromCatP.split("cate_no=")[1]);
847  }
848
849  // 1. 전체 오브젝트 배열 필요한 것만 정리
850  const rendered = navJson.map(({ cate_no, parent_cate_no, name, link_product_list }) => ({
851    children: [],
852    cat_id: cate_no,
853    parent_id: parent_cate_no,
854    link: link_product_list,
855    name: name,
856    current: currentCAT === cate_no && currentCAT !== 0 ? true : false,
857  }));
858  // 2. 최상단과 나머지 분류
859  const firstOnly = rendered.filter((item) => item.parent_id === 1);
860  const theirChildren = rendered.filter((item) => item.parent_id !== 1);
861
862  // 3. 하위 분류들을 그 바로 상위 분류에 삽입 (2=>1)
863  const result = theirChildren.reduce((acc, cur) => {
864    const navigationObj = {
865      children: [],
866      cat_id: cur.cat_id,
867      parent_id: cur.parent_id,
868      link: cur.link,
869      name: cur.name,
870      current: currentCAT === cur.cate_id && currentCAT !== 0 ? true : false,
871    };
872    const found2nd = acc.find((a) => a.cat_id === cur.parent_id);
873    found2nd !== undefined ? found2nd["children"].push(navigationObj) : null;
874
875    return acc;
876  }, firstOnly);
877
878  // 4. 하위 분류들을 그 바로 상위 분류에 삽입 (3=>2)
879  const result2nd = theirChildren.reduce((acc, cur) => {
880    const navigationObj = {
881      children: [],
882      cat_id: cur.cat_id,
883      parent_id: cur.parent_id,
884      link: cur.link,
885      name: cur.name,
886      current: currentCAT === cur.cate_id && currentCAT !== 0 ? true : false,
887    };
888    acc.forEach((a) => {
889      const found3rd = a.children.find((second) => second.cat_id === cur.parent_id);
890      found3rd !== undefined ? found3rd["children"].push(navigationObj) : null;
891    });
892    return acc;
893  }, result);
894
895  if (localStorage.getItem("drmvsn-custom-nav") !== null) {
896    const result2ndLocal = localStorage.getItem("drmvsn-custom-nav");
897
898    if (result2ndLocal === JSON.stringify(result2nd)) {
899      console.log("API ONCE, LOCALSTORAGE NOT CHANGED");
900      return JSON.parse(result2ndLocal);
901    } else {
902      console.log("API ONCE, LOCALSTORAGE CHANGED");
903      localStorage.setItem("drmvsn-custom-nav", JSON.stringify(result2nd));
904      return result2nd;
905    }
906  } else {
907    localStorage.setItem("drmvsn-custom-nav", JSON.stringify(result2nd));
908    console.log("API ONCE, API ONLY");
909    return result2nd;
910  }
911}
912
913async function asyncNavigation(theUrl) {
914  const targetLi = document.querySelectorAll("#async-nav > li");
915
916  const response = await fetch(theUrl);
917  const navJson = await response.json();
918
919  let currentCAT = 0;
920
921  if (GLOBAL_VARIABLES_DRMVSN.catP) {
922    const currentCatFromCatP = [...GLOBAL_VARIABLES_DRMVSN.catP].reverse().find((x) => x !== "");
923    if((currentCatFromCatP) !== undefined){
924      currentCAT = parseInt(currentCatFromCatP.split("cate_no=")[1]);
925    }
926  }
927
928  // 1. 전체 오브젝트 배열 필요한 것만 정리
929  const rendered = navJson.map(({ cate_no, parent_cate_no, name, link_product_list }) => ({
930    children: [],
931    cat_id: cate_no,
932    parent_id: parent_cate_no,
933    link: link_product_list,
934    name: name,
935    current: currentCAT === cate_no && currentCAT !== 0 ? true : false,
936  }));
937
938  // 2. 최상단과 나머지 분류
939  let firstOnly = rendered.filter((item) => item.parent_id === 1);
940
941  const theirChildren = rendered.filter((item) => item.parent_id !== 1);
942
943  // 3. 하위 분류들을 그 바로 상위 분류에 삽입 (2=>1)
944  const result = theirChildren.reduce((acc, cur) => {
945    const navigationObj = {
946      children: [],
947      cat_id: cur.cat_id,
948      parent_id: cur.parent_id,
949      link: cur.link,
950      name: cur.name,
951      current: currentCAT === cur.cate_id && currentCAT !== 0 ? true : false,
952    };
953    const found2nd = acc.find((a) => a.cat_id === cur.parent_id);
954    found2nd !== undefined ? found2nd["children"].push(navigationObj) : null;
955    return acc;
956  }, firstOnly);
957
958  // 4. 하위 분류들을 그 바로 상위 분류에 삽입 (3=>2)
959  const result2nd = theirChildren.reduce((acc, cur) => {
960    const navigationObj = {
961      children: [],
962      cat_id: cur.cat_id,
963      parent_id: cur.parent_id,
964      link: cur.link,
965      name: cur.name,
966      current: currentCAT === cur.cate_id && currentCAT !== 0 ? true : false,
967    };
968    acc.forEach((a) => {
969      const found3rd = a.children.find((second) => second.cat_id === cur.parent_id);
970      found3rd !== undefined ? found3rd["children"].push(navigationObj) : null;
971    });
972    return acc;
973  }, result);
974
975  GLOBAL_VARIABLES_DRMVSN.firstLevel = result2nd;
976
977  //start create html elements for DESKTOP VIEW & Mobile view Together
978  //changed to template literal - 23.09
979
980  const navigationObjects = GLOBAL_VARIABLES_DRMVSN.firstLevel;
981
982  const templateLiterals = navigationObjects
983    .map((nav, idx) => {
984      const firstLvLITagInnerHTML = `
985        <a ${nav.children.length > 0 ? `onclick="navBgOn(this,event,1)"` : `onclick="navBgOn(this,event,4)"`} href="${nav.link}" data-name="${nav.name.toLowerCase()}">${nav.name}</a>
986            ${
987              nav.children.length > 0
988                ? `
989            <div class="sub-nav-cate second-depth">
990                <a class="mobile-only" href="#" onclick="goBackCate(this,event)"><span class="back"></span>${nav.name}</a>
991                <ul class="sub-nav" id="async-second">
992                ${nav.children
993                  .map((child, sIdx) => {
994                    return `
995                        <li ${child.children.length > 0 ? `class="has-child"` : ``}>
996                            <a ${child.children.length > 0 ? `class="third-yes"` : ``} href="${child.link}" data-name="${child.name.toLowerCase()}">${child.name}</a>
997                            ${
998                              child.children.length > 0
999                                ? `
1000                                <div class="sub-nav-cate third-depth">
1001                                  <a class="mobile-only" href="#" onclick="goBackCate(this,event)"><span class="back"></span>${child.name}</a>
1002                                  <ul class="sub-nav">
1003                                  ${child.children
1004                                    .map((gChild, tIdx) => {
1005                                      return `
1006                                          <li><a href="${gChild.link}">${gChild.name}</a></li>
1007                                          `;
1008                                    })
1009                                    .join("")}
1010                                  </ul>
1011                                </div>
1012                                `
1013                                : ""
1014                            }
1015                        </li>
1016                        `;
1017                  })
1018                  .join("")}
1019                </ul>
1020            </div>
1021            `
1022                : ""
1023            }
1024        `;
1025      nav.html = firstLvLITagInnerHTML;
1026      return ` 
1027            <li data-target="?cate_no=${nav.cat_id}" ${nav.children.length > 0 ? `class="has-child"` : undefined}>
1028                ${firstLvLITagInnerHTML}
1029            </li>
1030
1031            `;
1032    })
1033    .join("");
1034
1035  //생성 후 실행할 함수
1036  const functionAfterMakingNavigation = () => {
1037    GLOBAL_VARIABLES_DRMVSN.firstLevel.forEach((first, i) => {
1038      if (targetLi[i] !== undefined) {
1039        const filtered = GLOBAL_VARIABLES_DRMVSN.firstLevel.filter((lvl) => lvl.cat_id === parseInt(targetLi[i].dataset.target.split("?cate_no=")[1]));
1040        if (filtered.length < 1) return;
1041        targetLi[i].classList.add("has-child");
1042        targetLi[0].classList.add("child-opened");
1043        // targetLi[i].setAttribute("onmouseleave", "navBgOff()");
1044        // targetLi[i].setAttribute("onmouseenter", "customLinkLeft(this)");
1045        targetLi[i].innerHTML = filtered[0].html;
1046
1047        // if(first.cat_id === 468){ //collection 
1048        //   const beforeElm = targetLi[i];
1049        //   const navLi = document.createElement('li');
1050        //   navLi.classList.add('displaynone');
1051  
1052        //   const navTemplate = `
1053        //   <a href="/board/gallery/8">ARCHIVE</a>
1054        //   `;
1055        //   navLi.innerHTML = navTemplate;
1056
1057        // }
1058      }
1059    });
1060    headerMaxHeight();
1061  };
1062  functionAfterMakingNavigation();
1063}
1064asyncNavigation("/exec/front/Product/SubCategory");
1065
1066function navBgOn(element, event, status) {
1067  if (document.body.classList.contains("intro-ready")) {
1068    // const tl = gsap.timeline({ duration: 0.5 });
1069    // tl.to("#header .inner", { backgroundColor: "#fff", borderBottom: "1p
1069x solid #ddd" }, 0)
1070    //   .to("#main.intro-ready .inner-nav.nav-left ul a", { color: "#000" }, 0)
1071    //   .to("#main.intro-ready #mall-basic-nav svg .fill", { fill: "#000" }, 0)
1072    //   .to("#main.intro-ready #mall-basic-nav svg .stroke", { stroke: "#000" }, 0)
1073    //   .to(
1074    //     "#main.intro-ready li.basket a .count",
1075    //     {
1076    //       opacity: 1,
1077    //     },
1078    //     0
1079    //   )
1080    //   .to("h1.logo", {
1081    //     opacity: 1,
1082    //     onComplete: () => {
1083    //       document.body.classList.remove("intro-ready");
1084    //     },
1085    //   });
1086    // .to('#main #main-vertical-banner', {
1087    //   height: 38,
1088    //
1089    // })
1090
1091    // return
1092  }
1093
1094  const classDepth = element.nextElementSibling.className;
1095
1096  if (window.innerWidth < 1080) {
1097    event.preventDefault();
1098    document.body.classList.add("nav-move");
1099    console.log(classDepth);
1100    if (classDepth.indexOf("second-depth") > -1) {
1101      element.parentElement.classList.add("secondary");
1102      //배너 표시
1103      const navBanners = document.querySelectorAll(".nav-banner .depth-1-img a");
1104      navBanners.forEach((banner) => {
1105        const cateN = element.parentElement.dataset.target.split("=")[1];
1106        banner.parentElement.classList.remove("show");
1107        if (banner.dataset.name === cateN) {
1108          banner.parentElement.classList.add("show");
1109        }
1110      });
1111    }
1112    if (classDepth.indexOf("third-depth") > -1) {
1113      document.body.classList.add("nav-move-twice");
1114      element.parentElement.classList.add("third");
1115    }
1116
1117    document.body.classList.remove("main-color-white");
1118
1119  } else {
1120    let depth1Width = document.querySelector(".first-depth ul").clientWidth;
1121    let depth2Width = document.querySelector(".second-depth ul").clientWidth;
1122    let depth3Width = document.querySelector(".third-depth ul").clientWidth;
1123
1124    const root = document.querySelector(":root");
1125
1126    if (status === 0) {
1127      // 1depth -- 커스텀 1depth
1128      event.preventDefault();
1129      element.parentElement.classList.toggle("child-opened");
1130      
1131
1132      // root.style.setProperty("--navigation-width", `${depth1Width}px`); // 231115변경됨
1133      root.style.setProperty("--navigation-width", `${depth1Width + depth2Width}px`);
1134      if (document.body.classList.contains("search-opened")) document.body.classList.remove("search-opened");
1135
1136      if (document.body.classList.contains("header-opened")) {
1137        document.body.classList.remove("header-opened");
1138        document.body.classList.add("main-color-white");
1139      } else {
1140        document.body.classList.add("header-opened");
1141        document.body.classList.remove("main-color-white");
1142        
1143      }
1144    }
1145
1146    if (status === 1) {
1147      // 2depth -- shop 1depth
1148      event.preventDefault();
1149      root.style.setProperty("--navigation-width", `${depth1Width + depth2Width}px`);
1150
1151      document.querySelectorAll("#async-nav .has-child").forEach((first) => {
1152        if (first.classList.contains("child-opened")) {
1153          first.classList.remove("child-opened");
1154          element.parentElement.classList.add("child-opened");
1155        } else {
1156          element.parentElement.classList.add("child-opened");
1157        }
1158      });
1159
1160      //배너 표시
1161      const navBanners = document.querySelectorAll(".header-opened .nav-banner .depth-1-img a");
1162      navBanners.forEach((banner) => {
1163        const cateN = element.parentElement.dataset.target.split("=")[1];
1164        banner.parentElement.classList.remove("show");
1165        if (banner.dataset.name === cateN) {
1166          banner.parentElement.classList.add("show");
1167        }
1168      });
1169    }
1170    if (status === 4) {
1171      // 2depth -- shop 1depth만 있으면서 배너 표시 되는 분류
1172      //배너 표시
1173      const navBanners = document.querySelectorAll(".header-opened .nav-banner .depth-1-img a");
1174      navBanners.forEach((banner) => {
1175        const cateN = element.parentElement.dataset.target.split("=")[1];
1176        banner.parentElement.classList.remove("show");
1177        if (banner.dataset.name === cateN) {
1178          banner.parentElement.classList.add("show");
1179        }
1180      });
1181    }
1182
1183    if (status === 2) {
1184      // 3depth
1185      //클라이언트 요청으로 3뎁스 하위메뉴 삭제함 > third-yes >>
1185 onclick 삭제함 240105 added by yeonsu
1186      event.preventDefault();
1187
1188      root.style.setProperty("--navigation-width", `${depth1Width + depth2Width + depth3Width}px`);
1189
1190      document.querySelectorAll("#async-second > .has-child").forEach((second) => {
1191        if (second.classList.contains("child-opened")) {
1192          second.classList.remove("child-opened");
1193          element.parentElement.classList.add("child-opened");
1194        } else {
1195          element.parentElement.classList.add("child-opened");
1196        }
1197      });
1198    }
1199
1200    var backdrop = document.querySelector(".sub-nav-bg-backdrop");
1201    backdrop.classList.remove("default");
1202
1203    // document.body.classList.remove("main-color-white");
1204    // if (document.body.classList.contains("main-color-white")) {
1205    //   document.body.classList.remove("main-color-white");
1206    // } else {
1207    //   document.body.classList.add("main-color-white");
1208    // }
1209  }
1210
1211  if (document.querySelector(".search-trigger.search-opened") !== null) {
1212    document.querySelector(".search-trigger.search-opened").classList.remove("search-opened");
1213    // if (document.body.classList.contains("main-color-white")) {
1214    //   document.body.classList.remove("main-color-white");
1215    // } else {
1216    //   document.body.classList.add("main-color-white");
1217    // }
1218  }
1219
1220
1221
1222}
1223
1224function navBgOff() {
1225  if (document.querySelector("#nav-from-shop").classList.contains("child-opened")) document.querySelector("#nav-from-shop").classList.remove("child-opened");
1226  // document.querySelectorAll("li.has-child").forEach((all) => {
1227  //   if (all.className.indexOf('child-opened')) {
1228  //     all.classList.remove('child-opened');
1229  //   }
1230  // })
1231
1232  var backdrop = document.querySelector(".sub-nav-bg-backdrop");
1233  backdrop.classList.add("default");
1234
1235  document.body.classList.remove("header-opened");
1236
1237  document.querySelector(".sub-nav-bg").classList.remove("no-transition");
1238
1239  document.body.classList.add("main-color-white");
1240}
1241
1242function navBgOnM(element, event, number) {
1243  if (window.innerWidth > 1080) return;
1244  event.preventDefault();
1245  //category 노출
1246  document.body.classList.add("nav-move");
1247
1248  var navCates = document.querySelectorAll("li.has-child");
1249  for (var i = 0; i < navCates.length; i++) {
1250    navCates[i].classList.remove("secondary");
1251  }
1252  element.parentElement.classList.add("secondary");
1253}
1254
1255function goBackCate(element, event) {
1256  event.preventDefault();
1257  if (element.closest(".sub-nav-cate").classList.contains("second-depth")) {
1258    document.body.classList.remove("nav-move");
1259    element.closest(".has-child").classList.remove("secondary");
1260  }
1261  if (element.closest(".has-child").classList.contains("third")) {
1262    document.body.classList.remove("nav-move-twice");
1263    element.closest(".has-child").classList.remove("third");
1264  }
1265}
1266
1267// Get header sub-nav height
1268const headerMaxHeight = () => {
1269  const eachHeight = 50; // height + padding
1270  const bgPadding = 80;
1271  const navigationList = document.querySelectorAll("#async-nav > li ");
1272  let maxHeight = 0;
1273
1274  navigationList.forEach((menu) => {
1275    if (menu.querySelectorAll(".second-depth > ul > li").length > 0) {
1276      // console.log(menu.querySelectorAll(".second-depth > ul > li").length)
1277    }
1278    menu.querySelectorAll(".second-depth > ul > li") && menu.querySelectorAll(".second-depth > ul > li").length * eachHeight > maxHeight ? (maxHeight = menu.querySelectorAll(".second-depth > ul > li").length * eachHeight) : undefined;
1279  });
1280  const root = document.querySelector(":root");
1281  root.style.setProperty("--navigation-height", `${maxHeight + bgPadding}px`);
1282};
1283
1284// const communityActive = (event, element) => {
1285//   event.preventDefault();
1286//   element.parentElement.classList.toggle("child-active");
1287// };
1288
1289//헤더 ver.2
1290//sidebar open
1291const asideActive = (event) => {
1292  event.preventDefault();
1293
1294  const navigationArea = document.querySelector(".aside-wrap");
1295  if (document.body.classList.contains("aside-opened")) {
1296    bodyScrollLock.enableBodyScroll(navigationArea);
1297    document.body.classList.remove("aside-opened");
1298    document.body.classList.add("main-color-white");
1299  } else {
1300    document.body.classList.add("aside-opened");
1301    document.body.classList.remove("main-color-white");
1302    bodyScrollLock.disableBodyScroll(navigationArea);
1303  }
1304
1305  if (document.querySelector("body.search-opened") !== null) {
1306    document.querySelector("body.search-opened").classList.remove("search-opened");
1307  }
1308  // if (document.querySelector(".sub-nav-bg-backdrop.default") !== null) {
1309  //   var backdrop = document.querySelector(".sub-nav-bg-backdrop.default");
1310  //   backdrop.classList.remove("default");
1311
1312  // if (document.body.classList.contains("main-color-white")) {
1313  //   document.body.classList.remove("main-color-white");
1314  // } else {
1315  //   document.body.classList.add("main-color-white");
1316  // }
1317  // }
1318};
1319
1320const mobileAsideReady = () => {
1321  document.getElementById("aside").classList.contains("ready") ? document.getElementById("aside").classList.remove("ready") : undefined;
1322};
1323const desktopAsideReady = () => {
1324  document.getElementById("aside").classList.contains("remove-afterimage") ? document.getElementById("aside").classList.remove("remove-afterimage") : undefined;
1325};
1326
1327//search 검색
1328function searchOpen(element, event) {
1329  event.preventDefault();
1330
1331  if (document.getElementById("main")) document.body.classList.remove("intro-ready");
1332
1333  if (document.querySelector(".inner-nav ul>li.has-child.child-opened") !== null) {
1334    var activeNavbg = document.querySelector(".inner-nav ul>li.has-child.child-opened");
1335    activeNavbg.classList.remove("child-opened");
1336    if (document.querySelector(".nav-banner.show") !== null) {
1337      document.querySelector(".nav-banner.show").classList.remove("show");
1338    }
1339  }
1340
1341  if (document.body.classList.contains("header-opened")) {
1342    document.body.classList.remove("header-opened");
1343  } 
1344
1345  if (document.body.classList.contains("aside-opened")) {
1346    document.body.classList.remove("aside-opened");
1347  }
1348  document.body.classList.toggle("search-opened");
1349  
1350
1351  if (document.body.classList.contains("search-opened")) {
1352    document.body.classList.remove("main-color-white");
1353  } else {
1354    document.body.classList.add("main-color-white");
1355  }
1356}
1357
1358function searchClose() {
1359  document.body.classList.remove("search-opened");
1360  // document.querySelectorAll(".search-trigger").forEach((single) => single.classList.remove("search-opened"));
1361
1362  document.body.classList.add("main-color-white");
1363}
1364
1365//회원가입, 회원정보, 주소록, 주소록수정 폼 필수
1366function reQuired() {
1367  if (document.querySelector(".common-required") !== null) {
1368    var reqTh = document.querySelectorAll(".common-required .ec-base-table table tbody th img");
1369
1370    for (var i = 0; i < reqTh.length; i++) {
1371      var reqTxt = document.createElement("span");
1372      reqTxt.className = "require-text";
1373
1374      if (reqTh[i].getAttribute("alt") === "필수") {
1375        reqTh[i].classList.add("displaynone");
1376        reqTxt.textContent = "(필수)";
1377      } else {
1378        reqTxt.textContent = "(선택)";
1379      }
1380      reqTh[i].parentElement.append(reqTxt);
1381    }
1382  }
1383}
1384
1385// 판다씨 팝업 닫기
1386// const newPopupClose = (e) => {
1387//     e.preventDefault();
1388//     document.getElementById('hide_till_tmr').checked ? Cookies.set('hide_till_tmr', '23aa53b7e603c56836ef', { expires: 1 }) : undefined;
1389//     document.getElementById('popup_carin_new_2023').classList.add('closed');
1390// }
1391
1392const pandassiPromiseForHeader = loadScript("//dona-d.com/web/upload/appfiles/0zdpAngaKBFnlCcCqpCU4A/d862d623bbf716b1136c8eac1d2933e8.js?v=" + GLOBAL_VARIABLES_DRMVSN.now); // 현재시간가져와서 버전 업데이트
1393
1394//검색어 삭제하기
1395const removeSearchTerm = () => {
1396  document.querySelectorAll(".search-control #keyword").forEach((single) => (single.value = ""));
1397};
1398
1399//responsive-table-scroll 형식 모바일에서 안내문 보여주는 코드
1400const mobileRTS = () => {
1401  if (document.querySelectorAll(".responsive-table-scroll").length < 1) return;
1402  if (isMobile.phone || isMobile.tablet) {
1403    const rts = document.querySelectorAll(".responsive-table-scroll");
1404    rts.forEach((table) => {
1405      table.classList.add("is-mobile");
1406      table.addEventListener("touchstart", () => table.classList.add("touched"));
1407    });
1408  }
1409};
1410
1411const minicartToggle = () => {
1412  if (window.location.href.indexOf("/order/basket.html") > -1) return;
1413  const miniCart = document.getElementById("mini-cart");
1414  if (miniCart.classList.contains("active")) {
1415    bodyScrollLock.enableBodyScroll(miniCart);
1416    miniCart.classList.remove("active");
1417  } else {
1418    miniCart.querySelector("iframe").contentWindow.location.reload();
1419    bodyScrollLock.disableBodyScroll(miniCart);
1420    miniCart.querySelector("iframe").addEventListener("load", () => {
1421      miniCart.classList.add("active");
1422    });
1423  }
1424};
1425
1426const ftInfoToggle = (element) => {
1427  if (window.innerWidth > 1080) return;
1428  element.parentElement.classList.toggle("ft-on");
1429};
1430
1431const gotoTop = (e) => {
1432  e.preventDefault();
1433  window.scrollTo({ top: 0, left: 0, behavior: `smooth` });
1434};
1435const gotoBottom = (e) => {
1436  e.preventDefault();
1437  const sHeight = document.body.innerHeight;
1438  window.scrollTo({ top: 99999, left: 0, behavior: `smooth` });
1439};
1440
1441// 뒤로가기 버튼
1442const historyBackForMobile = () => {
1443  window.history.back();
1444};
1445
1446//이미지 레이지 로드
1447const drmvsnImageLazyLoad = () => {
1448  const observerOptions = {
1449    root: null,
1450    threshold: 0.5,
1451  };
1452  const observer = new IntersectionObserver(function (entries, observer) {
1453    entries.forEach((entry) => {
1454      if (entry.isIntersecting) {
1455        if (entry.target.dataset.src !== undefined && entry.target.dataset.src !== "") {
1456          entry.target.src = entry.target.dataset.src;
1457        }
1458        entry.target.classList.add("loaded");
1459        observer.unobserve(entry.target);
1460      }
1461    });
1462  }, observerOptions);
1463
1464  const observeImgs = document.querySelectorAll("img");
1465  observeImgs.forEach((img) => {
1466    observer.observe(img);
1467  });
1468};
1469drmvsnImageLazyLoad();
1470
1471const debounce = (func) => {
1472  let timer;
1473  return (event) => {
1474    if (timer) clearTimeout(timer);
1475    timer = setTimeout(func, 100, event);
1476  };
1477};
1478recentKeyword = () => {
1479  const toolsSearchForm = document.querySelector("#searchBarForm");
1480  const toolsSearchInput = toolsSearchForm.querySelector("#keyword");
1481  const recentKeywordList = document.querySelector(".recent-keyword .recent-keyword-list");
1482  const removeAll = document.querySelector(".recent-keyword .remove-all");
1483  let rKeywords = localStorage.getItem("DRMVSN_RECENT_KEYWORDS") === null ? [] : JSON.parse(localStorage.getItem("DRMVSN_RECENT_KEYWORDS"));
1484  const limitCnt = 5; // 갯수 제한
1485
1486  function saveRecentKeywords() {
1487    if (typeof Storage === "undefined") return;
1488    localStorage.setItem("DRMVSN_RECENT_KEYWORDS", JSON.stringify(rKeywords));
1489    if (rKeywords.length > limitCnt) {
1490      const startIndex = rKeywords.length - limitCnt;
1491      const sliced = rKeywords.slice(startIndex, startIndex + limitCnt);
1492      rKeywords = sliced;
1493      localStorage.setItem("DRMVSN_RECENT_KEYWORDS", JSON.stringify(rKeywords));
1494    }
1495  }
1496
1497  function removeAllKeyword() {
1498    localStorage.clear(rKeywords);
1499    recentKeywordList.innerHTML = `<li class="is-no-data">최근 검색어가 없습니다.</li>`;
1500    rKeywords = [];
1501  }
1502  removeAll.addEventListener("click", removeAllKeyword);
1503
1504  function renderRecentKeyword(newTodo) {
1505    const { id, text } = newTodo;
1506    const item = document.createElement("li");
1507    item.classList.add("mb-10");
1508    const anchor = document.createElement("a");
1509    anchor.href = `/product/search.html?banner_action=&keyword=${text}`;
1510    item.id = `unique${id}`;
1511    anchor.textContent = text;
1512
1513    item.appendChild(anchor);
1514    recentKeywordList.appendChild(item);
1515    newTodo !== null && removeAll.classList.remove("off");
1516  }
1517
1518  function handleRecentSubmit(event) {
1519    //form 전송
1520    event.preventDefault();
1521    const newRecentKeyword = toolsSearchInput.value;
1522
1523    const newObj = {
1524      id: Date.now(),
1525      text: newRecentKeyword,
1526    };
1527
1528    let dupleCheck = false;
1529    rKeywords.forEach((obj) => {
1530      if (obj.text == newRecentKeyword) return (dupleCheck = true);
1531    });
1532
1533    if (newRecentKeyword !== "" && dupleCheck == false) {
1534      rKeywords.push(newObj);
1535    }
1536    saveRecentKeywords();
1537  }
1538  document.querySelector(".search-action").addEventListener("click", handleRecentSubmit);
1539  toolsSearchForm.addEventListener("keydown", (e) => {
1540    if (e.keyCode == 13) {
1541      handleRecentSubmit(e);
1542      toolsSearchForm.submit();
1543    }
1544  });
1545  if (localStorage.getItem("DRMVSN_RECENT_KEYWORDS") === null) {
1546    recentKeywordList.innerHTML = `<li class="is-no-data">최근 검색어가 없습니다.</li>`;
1547    return;
1548  }
1549  let reverse = JSON.parse(localStorage.getItem("DRMVSN_RECENT_KEYWORDS"));
1550
1551  reverse.reverse();
1552
1553  reverse.forEach((item, idx) => {
1554    if (idx < limitCnt) {
1555      renderRecentKeyword(item);
1556    }
1557  });
1558};
1559recentKeyword();
1560
1561const preventDflt = (event) => {
1562  event.preventDefault();
1563};
1564
1565/* 레이어 팝업 백드롭 처리 */
1566const baseLayerOpen = (elem) => {
1567  const targetElement = elem ? elem : document.body;
1568  bodyScrollLock.disableBodyScroll(targetElement);
1569  document.body.classList.add("layer-opened");
1570};
1571const baseLayerClose = () => {
1572  bodyScrollLock.clearAllBodyScrollLocks();
1573  document.body.classList.remove("layer-opened");
1574};
1575
1576//레이어가 iframe으로 열릴 경우 gist_select.html에서 사용
1577window.addEventListener("message", function (event) {
1578  if (event.data === "popup-layer-close") {
1579    bodyScrollLock.clearAllBodyScrollLocks();
1580  }
1581});
1582
1583document.addEventListener("click", function (e) {
1584  const target = e.target.closest(".prd-card .cart-icon");
1585
1586  if (target) {
1587    baseLayerOpen();
1588  }
1589});
1590
1591/* 레이어 팝업 백드롭 처리 */
1592
1593//*********  EVENT LISTENER
1594
1595//minicart communication
1596window.onmessage = (e) => {
1597  if (e.data.row && e.data.row >= 0) {
1598    document.querySelectorAll(".EC-Layout-Basket-count").forEach((cartCount) => (cartCount.textContent = e.data.row));
1599  }
1600};
1601
1602window.addEventListener(
1603  "resize",
1604  debounce(() => {
1605    //when viewport changes
1606    const w = window.innerWidth;
1607    const breakPoint = 1080;
1608    if (w > breakPoint) {
1609      //when desktop
1610      document.getElementById("aside").classList.add("ready"); // 반응형 전환시, blink 현상 제거
1611      document.getElementById("aside").classList.add("remove-afterimage"); // 반응형 전환시, blink 현상 제거
1612      document.body.classList.remove("aside-opened");
1613      if (document.querySelector("body.search-opened") !== null) {
1614        document.querySelector("body.search-opened").classList.remove("search-opened");
1615      }
1616    }
1617  })
1618);
1619
1620window.addEventListener("DOMContentLoaded", () => {
1621  //실제모바일기기 전용
1622  isMobile.phone || isMobile.tablet ? document.getElementById("aside").classList.remove("ready") : undefined;
1623  //RTS 테이블
1624  mobileRTS();
1625});
1626
1627$(document).ready(function(){
1628    if (typeof(EC_SHOP_MULTISHOP_SHIPPING) != "undefined") {
1629        var sShippingCountryCode4Cookie = 'shippingCountryCode';
1630        var bShippingCountryProc = false;
1631
1632        // 배송국가 선택 설정이 사용안함이면 숨김
1633        if (EC_SHOP_MULTISHOP_SHIPPING.bMultishopShippingCountrySelection === false) {
1634            $('.xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist').hide();
1635            $('.xans-layout-multishoplist .xans-layout-multishoplistmultioption .xans-layout-multishoplistmultioptioncountry').hide();
1636        } else {
1637            $('.thumb .xans-layout-multishoplistitem').hide();
1638            var aShippingCountryCode = document.cookie.match('(^|;) ?'+sShippingCountryCode4Cookie+'=([^;]*)(;|$)');
1639            if (typeof(aShippingCountryCode) != 'undefined' && aS
1639hippingCountryCode != null && aShippingCountryCode.length > 2) {
1640                var sShippingCountryValue = aShippingCountryCode[2];
1641            }
1642
1643            // query string으로 넘어 온 배송국가 값이 있다면, 그 값을 적용함
1644            var aHrefCountryValue = decodeURIComponent(location.href).split("/?country=");
1645
1646            if (aHrefCountryValue.length == 2) {
1647                var sShippingCountryValue = aHrefCountryValue[1];
1648            }
1649
1650            // 메인 페이지에서 국가선택을 안한 경우, 그 외의 페이지에서 셋팅된 값이 안 나오는 현상 처리
1651            if (location.href.split("/").length != 4 && $(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist").val()) {
1652                $(".xans-layout-multishoplist .xans-layout-multishoplistmultioption a .ship span").text(" : "+$(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist option:selected").text().split("SHIPPING TO : ").join(""));
1653
1654                if ($("#f_country").length > 0 && location.href.indexOf("orderform.html") > -1) {
1655                    $("#f_country").val($(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist").val());
1656                }
1657            }
1658            if (typeof(sShippingCountryValue) != "undefined" && sShippingCountryValue != "" && sShippingCountryValue != null) {
1659                sShippingCountryValue = sShippingCountryValue.split("#")[0];
1660                var bShippingCountryProc = true;
1661
1662                $(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist").val(sShippingCountryValue);
1663                $(".xans-layout-multishoplist .xans-layout-multishoplistmultioption a .ship span").text(" : "+$(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist option:selected").text().split("SHIPPING TO : ").join(""));
1664                var expires = new Date();
1665                expires.setTime(expires.getTime() + (30 * 24 * 60 * 60 * 1000)); // 30일간 쿠키 유지
1666                document.cookie = sShippingCountryCode4Cookie+'=' + $(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist").val() +';path=/'+ ';expires=' + expires.toUTCString();
1667                if ($("#f_country").length > 0 && location.href.indexOf("orderform.html") > -1) {
1668                    $("#f_country").val(sShippingCountryValue).change();;
1669                }
1670            }
1671        }
1672        // 언어선택 설정이 사용안함이면 숨김
1673        if (EC_SHOP_MULTISHOP_SHIPPING.bMultishopShippingLanguageSelection === false) {
1674            $('.xans-layout-multishopshipping .xans-layout-multishopshippinglanguagelist').hide();
1675            $('.xans-layout-multishoplist .xans-layout-multishoplistmultioption .xans-layout-multishoplistmultioptionlanguage').hide();
1676        } else {
1677            $('.thumb .xans-layout-multishoplistitem').hide();
1678        }
1679
1680        // 배송국가 및 언어 설정이 둘 다 사용안함이면 숨김
1681        if (EC_SHOP_MULTISHOP_SHIPPING.bMultishopShipping === false) {
1682            $(".xans-layout-multishopshipping").hide();
1683            $('.xans-layout-multishoplist .xans-layout-multishoplistmultioption').hide();
1684        } else if (bShippingCountryProc === false && location.href.split("/").length == 4) { // 배송국가 값을 처리한 적이 없고, 메인화면일 때만 선택 레이어를 띄움
1685            var sShippingCountryValue = $(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist").val();
1686            $(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist").val(sShippingCountryValue);
1687            $(".xans-layout-multishoplist .xans-layout-multishoplistmultioption a .ship span").text(" : "+$(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist option:selected").text().split("SHIPPING TO : ").join(""));
1688            // 배송국가 선택을 사용해야 레이어를 보이게 함
1689            if (EC_SHOP_MULTISHOP_SHIPPING.bMultishopShippingCountrySelection === true) {
1690                $(".xans-layout-multishopshipping").show();
1691            }
1692        }
1693
1694        $(".xans-layout-multishopshipping .close").bind("click", function() {
1695            $(".xans-layout-multishopshipping").hide();
1696        });
1697
1698        $(".xans-layout-multishopshipping .ec-base-button a").bind("click", function() {
1699            var expires = new Date();
1700            expires.setTime(expires.getTime() + (30 * 24 * 60 * 60 * 1000)); // 30일간 쿠키 유지
1701            document.cookie = sShippingCountryCode4Cookie+'=' + $(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist").val() +';path=/'+ ';expires=' + expires.toUTCString();
1702
1703            // 도메인 문제로 쿠키로 배송국가 설정이 안 되는 경우를 위해 query string으로 배송국가 값
1703을 넘김
1704            var sQuerySting = (EC_SHOP_MULTISHOP_SHIPPING.bMultishopShippingCountrySelection === false) ? "" : "/?country="+encodeURIComponent($(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist").val());
1705
1706            location.href = '//'+$(".xans-layout-multishopshipping .xans-layout-multishopshippinglanguagelist").val()+sQuerySting;
1707        });
1708        $(".xans-layout-multishoplist .xans-layout-multishoplistmultioption a").bind("click", function() {
1709            $(".xans-layout-multishopshipping").show();
1710        });
1711    }
1712});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.