PageSourceSearch

https://hdbcstore.com/ind-script/optimizer_user.php?filename=ldHBD…06133e3caaf104e31b86fad&t=1788928161&user=T

js hdbcstore.com collected 2026-09-30 11:18:38 UTC 61,141 bytes, 1,765 lines download raw bytes

1(() => {
2    // 탭 슬라이드
3    const tabItemsSwiper = new Swiper(".tab__lists", {
4        slidesPerView: 'auto',
5        spaceBetween: 4,
6    });
7    
8  const tabSwiper = new Swiper(".tab01_swiper", {
9    slidesPerView: 1,
10    spaceBetween: 8,
11    scrollbar: {
12      el: ".tab_swiper .swiper-scrollbar.list-scrollbar",
13    },
14    observer: true,
15    observeParents: true,
16  });
17  const tabSwiper02 = new Swiper(".tab02_swiper", {
18    slidesPerView: 1,
19    spaceBetween: 8,
20    scrollbar: {
21      el: ".tab02_swiper .swiper-scrollbar.list-scrollbar",
22    },
23    observer: true,
24    observeParents: true,
25  });
26  const tabSwiper03 = new Swiper(".tab03_swiper", {
27    slidesPerView: 1,
28    spaceBetween: 8,
29    scrollbar: {
30      el: ".tab03_swiper .swiper-scrollbar.list-scrollbar",
31    },
32    observer: true,
33    observeParents: true,
34  });
35  const tabSwiper04 = new Swiper(".tab04_swiper", {
36    slidesPerView: 1,
37    spaceBetween: 8,
38    scrollbar: {
39      el: ".tab04_swiper .swiper-scrollbar.list-scrollbar",
40    },
41    observer: true,
42    observeParents: true,
43  });
44  const tabSwiper05 = new Swiper(".tab05_swiper", {
45    slidesPerView: 1,
46    spaceBetween: 8,
47    scrollbar: {
48      el: ".tab05_swiper .swiper-scrollbar.list-scrollbar",
49    },
50    observer: true,
51    observeParents: true,
52  });
53
54  // tab
55  const tabsItems = document.querySelectorAll(".tab__item");
56  const tabLists = document.querySelectorAll(".tab__cont");
57
58  tabsItems.forEach((tab) => {
59    tab.addEventListener("click", () => {
60      const target = tab.getAttribute("data-tab");
61
62      tabsItems.forEach((t) => t.classList.remove("active"));
63      tabLists.forEach((c) => c.classList.remove("active"));
64
65      tab.classList.add("active");
66      document
67        .querySelector(`.tab__cont[data-content="${target}"]`)
68        .classList.add("active");
69    });
70  });
71})();
72// 상품이 1개일 경우 one-item클래스 추가
73document.addEventListener('DOMContentLoaded', function () {
74    const productBlocks = document.querySelectorAll('.xans-product-listmain');
75
76    productBlocks.forEach(function (block) {
77        const items = block.querySelectorAll('.list li.items');
78
79        if (items.length === 1) {
80            block.classList.add('one-item');
81            //console.log('one-item 클래스가 추가된 블록:', block);
82        } else {
83            //console.log('해당 블록의 li.items 개수:', items.length);
84        }
85    });
86});
87
88// 상품 태그 스크립트
89const addTags = () => {
90    const tagBox = document.querySelectorAll('.tag_box:not(.tag_done)');
91    // console.log(tagBox.length);
92
93    tagBox.forEach((el) => {
94        const tagInfo = el.querySelector('.listitem_메인_프로모션');
95
96        // console.log(tagInfo);
97        if (tagInfo) {
98            const text = tagInfo.innerText.split(';');
99            text.forEach((els) => {
100                // 부모 요소를 선택합니다.
101                const parentElement = el;
102                // 새로운 태그를 생성합니다.
103                const tagList = document.createElement('li');
104                const tag = document.createElement('p');
105
106                tagList.classList.add('tag_list');
107                tag.classList.add('tags');
108
109                el.appendChild(tagList).appendChild(tag);
110
111                tag.innerText = els;
112            });
113        }
114        el.classList.add('tag_done');
115    });
116};    
117
118(()=>{
119    // 혈당 관리를 위한 첫걸음
120    var setTypeSwiper02 = new Swiper(".jdbw_product_wrap .listmain_swiper", {
121        slidesPerView: 1,
122        autoplay: {
123            delay: 2500,
124            disableOnInteraction: false,
125        },
126        loop: true,
127    });
128
129    // 메인페이지 Product Set
130    var setTypeSwiper = new Swiper(".set_type_swiper", {
131        slidesPerView: 2.4,
132        spaceBetween: 8,
133        scrollbar: {
134            el: ".set_type_scrollbar",
135        },
136    });
137    
138    // 메인페이지 베스트셀러
139    const best = document.querySelector(".best_list");
140    if(best) {
141        // 베스트 슬라이드
142        const bestSwiper = new Swiper(".best_swiper",{
143            spaceBetween: 8,
144            slidesPerView: 2.4,
145            scrollbar: {
146                el: ".best-scrollbar",
147            },
148        });
149        
150        const best_item = best.querySelectorAll(".list_content .list .items:not(.best_done)");
151
152        best_item.forEach(function (els, index) {
153            var listCount = els.querySelector('.list_count');
154            listCount.textContent = (index + 1).toString();
155
156            // 첫 번째, 두 번째, 세 번째 아이템에 클래스 부여
157            if (index < 3) {
158                let className;
159                switch (index) {
160                    case 0:
161                        className = "first";
162                        break;
163                    case 1:
164                        className = "second";
165                        break;
166                    case 2:
167                        className = "thrid";
168                        break;
169                }
170                els.classList.add(className);
171            } 
172            els.classList.add("best_done");
173        });
174    }
175    
176    // 타임딜 아이템 순서 변경
177    const tsWrap = document.querySelector('.event_sale');
178    const tsList = tsWrap?.querySelector('.timeSale-swiper .list');
179    if (tsList) {
180    	const tsItems = Array.from(tsList.querySelectorAll('.items'));
181
182    	if (tsItems.length > 0) {
183            const tdNow = dayjs(); // 타임딜 기준 현재 시간
184
185            const getTdInfo = (item) => {
186                const tdPromoEl = item.querySelector('.promotion');
187                if (!tdPromoEl) return { phase: 3, startMs: 0 }; // 정보 없으면 맨 뒤
188
189                const tdStartAttr = tdPromoEl.dataset.start; // data-start
190                const tdEndAttr = tdPromoEl.dataset.end;     // data-end
191
192                let tdPhase = 3;          // 0:진행, 1:예정, 2:종료, 3:기타
193                let tdStartMoment = null; // dayjs 객체
194
195                if (tdStartAttr) {
196                    tdStartMoment = dayjs(tdStartAttr, "YYYY-MM-DD HH:mm");
197                }
198
199                if (tdStartAttr && tdEndAttr) {
200                    const tdStartTime = dayjs(tdStartAttr, "YYYY-MM-DD HH:mm");
201                    const tdEndTime = dayjs(tdEndAttr, "YYYY-MM-DD HH:mm");
202
203                    if (tdNow.isBefore(tdStartTime)) {
204                        tdPhase = 1; // 예정
205                    } else if (tdNow.isBefore(tdEndTime)) {
206                        tdPhase = 0; // 진행중
207                    } else {
208                        tdPhase = 2; // 종료
209                    }
210                } else if (tdPromoEl.classList.contains('timeout')) {
211                    tdPhase = 2; // timeout 표시된 종료
212                }
213
214                return {
215                    phase: tdPhase,
216                    startMs: tdStartMoment ? tdStartMoment.valueOf() : 0
217                };
218            };
219
220            tsItems.sort((a, b) => {
221                const infoA = getTdInfo(a);
222                const infoB = getTdInfo(b);
223
224                // 1순위: 진행상태(phase) 기준 정렬
225                if (infoA.phase !== infoB.phase) return infoA.phase - infoB.phase;
226
227                // 둘 다 종료(phase 2)면 → 최근 종료된 순서대로 (startMs 큰 게 앞으로)
228                if (infoA.phase === 2 && infoB.phase === 2) {
229                    return infoB.startMs - infoA.startMs;
230                }
231
232                // 나머지는 시작 시간 이른 순으로
233                return infoA.startMs - infoB.startMs;
234            });
235
236            tsItems.forEach((item) => tsList.appendChild(item));
237        }
238    }
239
240    
241    // 메인페이지 타임딜 
242    const timeSaleSlide = document.querySelectorAll(
243        ".timeSale-swiper .swiper-slide"
244    ).length;
245
246    if(timeSaleSlide > 0) {
247        let timeSaleOptions = {};
248
249        if (timeSaleSlide == 1) {
250            timeSaleOptions = {
251                spaceBetween: 0,
252                slidesPerView: 1,
253            };
254        } else {
255            timeSaleOptions = {
256                spaceBetween: 10,
257                slidesPerView: 1.3,
258                /*autoplay: {
259                delay: 2500,
260                disableOnInteraction: false,
261            },
262            loop: true,*/
263            };
264        }
265
266        const timeSaleSwiper = new Swiper(".timeSale-swiper", timeSaleOptions);
267    }
268    
269    
270    // 메인페이지 혜택 1 배너
271    const benefitSlide = document.querySelectorAll('.benefit_swiper .swiper-slide').length;
272    
273    if(benefitSlide > 0) {
274       let benefitOptions = {};
275
276        if(benefitSlide == 1) {
277            benefitOptions = {
278                loop: false,
279                pagination: {
280                    el: ".benefit-pagination",
281                    type: "bullets",
282                },
283            }
284        } else {
285            benefitOptions = {
286                loop: true,
287                pagination: {
288                    el: ".benefit-pagination",
289                    type: "bullets",
290                },
291                autoplay: {
292                    delay:2500,
293                    disableOnInteraction: false,
294                },
295            }
296        }
297
298        const benefitSwiper = new Swiper(".benefit_swiper", benefitOptions);
299    }
300    
301
302    // 메인페이지 혜택 2 배너
303    const benefitSlide2 = document.querySelectorAll('.benefit_swiper2 .swiper-slide').length;
304
305    if(benefitSlide2 > 0) {
306        let benefitOptions2 = {};
307
308        if(benefitSlide2 == 1) {
309            benefitOptions2 = {
310                loop: false,
311                pagination: {
312                    el: ".benefit-pagination2",
313                    type: "bullets",
314                },
315            }
316        } else {
317            benefitOptions2 = {
318                loop: true,
319                autoplay: {
320                    delay:2500,
321                    disableOnInteraction: false,
322                },
323                pagination: {
324                    el: ".benefit-pagination2",
325                    type: "bullets",
326                },
327            }
328        }
329
330        const benefitSwiper2 = new Swiper(".benefit_swiper2", benefitOptions2);
331    }
332    
333    
334    // 메인페이지 매거진 배너
335    const mazSlide = document.querySelectorAll('.maz_board_swiper .swiper-slide').length;
336
337    if(mazSlide > 0) {
338        let mazOption = {};
339
340        if(mazSlide == 1) {
341            mazOption = {
342                loop: false,
343            }
344        } else {
345            mazOption = {
346                slidesPerView: 1.5,
347                loop: false,
348                spaceBetween: 12,
349                autoplay: false,
350            }
351        }
352
353        const mazSwiper = new Swiper(".maz_board_swiper", mazOption);
354    }
355
356    
357
358    // 메인 상단 상품 배너
359    const mainSwiper = new Swiper(".main_banner_swiper",{
360        pagination: {
361            el: ".swiper-main-pagination",
362        },
363        loop: true,
364        autoplay: {
365            delay:2500,
366            disableOnInteraction: false,
367        },
368    });
369    
370      // 홈쇼핑에서 봤던 그 제품 
371    const charllaSlide = document.querySelectorAll(
372        ".charlla_swiper .swiper-slide"
373    ).length;
374    let charllaOptions = {};
375
376    if (charllaSlide == 1) {
377        charllaOptions = {
378            loop: false,
379        };
380    } else {
381        charllaOptions = {
382            slidesPerView: 1.5,
383            loop: false,
384            spaceBetween: 8,
385            autoplay: false,
386        };
387    }
388
389    const charllaSwiper = new Swiper(".charlla_swiper", charllaOptions);
390    
391     // 메인 video 섹션
392    const mainVideoSwiper = new Swiper(".main_video_swiper",{
393        pagination: {
394            el: ".video_swiper-main-pagination",
395            type: "fraction",
396        },
397        loop: true,
398    });
399    
400    
401
402    // listmain 할인율 제작.
403
404    var regex = /[^0-9]/g;
405    var comma = /\B(?=(\d{3})+(?!\d))/g;
406
407    // 문자열 => 숫자만 출력 => replace(regex, "");
408    // 숫자 => 세자리 콤마 => replace(comma, "");
409    // mobile - 할인된 가격 9,500원
410    // pc - 할인되는 가격 500원
411    // custom - 소비자가 10000 - 기본가격 (할인전가격)
412    // price - 판매가 10000 - 할인된가격 (금액조정한가격)
413    // salePrice - 할인된가격 9500
414    // discount - 할인율 5%
415
416    const items = document.querySelectorAll(".list .items .price_box");
417    items.forEach((el) => {
418
419
420        let promotionMobile = Number(el.dataset.mobile.replace(regex, ""));
421        let promotionPc = Number(el.dataset.pc.replace(regex, ""));
422        let promotionTest = el.dataset.test;
423        let custom = Number(el.dataset.custom);
424        let price = Number(el.dataset.price);
425
426        if(!custom) {
427            custom = price;
428        }
429        if (promotionTest) {
430            if(price === custom) {
431                const salePrice = Number(promotionTest.replace(regex,"")); // 할인된 가격
432                const discount = (100 - Math.round(salePrice/price*100)).toString() + "%"; // 할인율
433                const per = document.createElement("p");
434                const customPrice = document.createElement("p");
435                customPrice.classList.add("custom");
436                customPrice.innerText = custom.toString().replace(comma, ",") + "원";
437                per.classList.add("per");
438                per.innerText = discount;
439                el.querySelector(".prices").appendChild(customPrice);
440                el.querySelector(".prices").appendChild(per);
441                el.querySelector(".prices .price").innerText = salePrice.toString().replace(comma, ",") + "원";
442            } else {
443                const salePrice = Number(promotionTest.replace(regex,""));  // 할인된 가격
444                const discount = (100 - Math.round(salePrice/custom*100)).toString() + "%"; // 할인율
445                const customPrice = document.createElement("p");
446                customPrice.classList.add("custom");
447                customPrice.innerText = custom.toString().replace(comma, ",") + "원";
448                const per = document.createElement("p");
449                per.classList.add("per");
450                per.innerText = discount;
451                el.querySelector(".prices").appendChild(customPrice);
452                el.querySelector(".prices").appendChild(per);
453                el.querySelector(".prices .price").innerText = salePrice.toString().replace(comma, ",") + "원";
454            }
455        } else {
456            if(price === custom) { // 판매가 소비자가 차이 없을 경우.
457                if(!promotionMobile && !promotionPc) {
458                    return;
459                }
460                if(promotionMobile) { // 모바일 할인가.
461                    const salePrice = promotionMobile; // 할인된 가격
462                    const discount = (100 - Math.round(salePrice/price*100)).toString() + "%"; // 할인율
463                    const per = document.createElement("p");
464                    const customPrice = document.createElement("p");
465                    customPrice.classList.add("custom");
466                    customPrice.innerText = custom.toString().replace(comma, ",") + "원";
467                    per.classList.add("per");
468                    per.innerText = discount;
469                    el.querySelector(".prices").appendChild(customPrice);
470                    el.querySelector(".prices").appendChild(per);
471                    el.querySelector(".prices .price").innerText = salePrice.toString().replace(comma, ",") + "원";
472                } else { // PC 할인가 - 이 부분 수정했습니다.
473                    /*const salePrice = price - promotionPc; // 할인된 가격
474                        const discount = (100 - Math.round(salePrice/price*100)).toString() + "%";
475                        const customPrice = document.createElement("p");
476                        customPrice.classList.add("custom");
477                        customPrice.innerText = custom.toString().replace(comma, ",") + "원";
478                        const per = document.createElement("p");
479                        per.classList.add("per");
480                        per.innerText = discount;
481                        el.querySelector(".prices").appendChild(customPrice);
482                        el.querySelector(".prices").appendChild(per);
483                        el.querySelector(".prices .price").innerText = salePrice.toString().replace(comma, ",") + "원";*/
484                    const salePrice = price;
485                    el.querySelector(".prices .price").innerText = salePrice.toString().replace(comma, ",") + "원";
486                }
487            } else if (price !== custom) { // 판매가 소비자가 차이 있을 경우.
488                if(promotionMobile) { // 모바일 할인가.
489                    const salePrice = promotionMobile; // 할인된 가격
490                    const discount = (100 - Math.round(salePrice/custom*100)).toString() + "%"; // 할인율
491                    const customPrice = document.createElement("p");
492                    customPrice.classList.add("custom");
493                    customPrice.innerText = custom.toString().replace(comma, ",") + "원";
494                    const per = document.createElement("p");
495                    per.classList.add("per");
496                    per.innerText = discount;
497                    el.querySelector(".prices").appendChild(customPrice);
498                    el.querySelector(".prices").appendChild(per);
499                    el.querySelector(".prices .price").innerText = salePrice.toString().replace(comma, ",") + "원";
500                } else { // PC 할인가
501                    //const salePrice = price - promotionPc; // 할인된 가격
502                    const salePrice = price; // 할인된 가격
503                    const discount = (100 - Math.round(salePrice/custom*100)).toString() + "%";
504                    const customPrice = document.createElement("p");
505                    customPrice.classList.add("custom");
506                    customPrice.innerText = custom.toString().replace(comma, ",") + "원";
507                    const per = document.createElement("p");
508                    per.classList.add("per");
509                    per.innerText = discount;
510                    el.querySelector(".prices").appendChild(customPrice);
511                    el.querySelector(".prices").appendChild(per);
512                    el.querySelector(".prices .price").innerText = salePrice.toString().replace(comma, ",") + "원";
513                }
514            }
515        }
516    });
517
518
519    // 타임딜 시간 계산
520    const times = []; 
521    const calc = (seconds) => { // 초를 일,시,분,초 로 계산
522        const allHour = parseInt(seconds / 3600);
523        const day = String(Math.floor(allHour / 24)).padStart(2, "0");
524        const hour = String((allHour % 24) + parseInt(day) * 24).padStart(2, "0");
525        const min = String(Math.floor((seconds % 3600) / 60)).padStart(2, "0");
526        const sec = String(seconds % 60).padStart(2, "0");
527        return `${hour} : ${min} : ${sec}`;
528    };
529    const promotion = document.querySelectorAll(".list .items .promotion"); // 상품의 promotion class
530
531
532    const currentDate = dayjs();
533
534    if (promotion && promotion.length > 0) {
535        promotion.forEach((el, index) => {
536            const start = el.dataset.start; // 시작일 data 값
537            const end = el.dataset.end; // 종료일 data값
538            const startTime = dayjs(start, "YYYY-MM-DD HH:mm");
539            const endTime = dayjs(end, "YYYY-MM-DD HH:mm");
540
541            // 오늘 날짜가 이벤트 시작 날짜 이전인지 확인
542            if (currentDate.isBefore(startTime)) {
543                const dateTime = dayjs(startTime, { format: 'YYYY-MM-DD HH:mm' });
544                const startMonth = dateTime.format('M');
545                const startDay = dateTime.format('D');
546
547                el.querySelector('.timer').textContent = startMonth + "/" + startDay + ' OPEN';
548                el.classList.add("timeout");
549
550                // 시작 전인 경우 price_box 미노출
551                const itemsElement = el.closest('.items'); // promotion 클래스의 가장 가까운 items 조상 요소 찾기
552                if (itemsElement) {
553                    const priceBoxElement = itemsElement.querySelector('.price_box');
554                    if (priceBoxElement) {
555                        priceBoxElement.style.display = 'none';
556                    }
557                }
558            } else if (currentDate.isBefore(endTime)) {
559                // 이벤트가 시작 중인 경우
560                const remaining = endTime.diff(currentDate, "s");
561
562                times[index] = {
563                    elementL: el,
564                    remaining: remaining,
565                    interval: null,
566                };
567
568                times[index].interval = setInterval(() => {
569                    const startTime = el.dataset.start; // 시작일 data값
570                    let start = Math.abs(dayjs(startTime, "YYYY-MM-DD HH:mm").diff(dayjs(), "s")); // 시작일
571                    let full = remaining + start; // 총 프로모션 기간 (초단위)
572                    times[index].remaining -= 1;
572 // 1초가 지날때마다 1초씩 감소하기위해 -1
573                    let text = ''; // 남은 시간 text
574
575                    if (times[index].remaining > 0) { // 프로모션 기간 진행중
576                        text = calc(times[index].remaining); // 초단위의 남은시간을 일 시 분 초로 문자열
577                    } else { // 프로모션 기간 종료
578                        el.querySelector(".timer").innerHTML = `타임딜 종료! <span>다음 기회에 만나요 :)</span>`; // 프로모션 없을 시
579                        el.classList.add("timeout");
580                        el.closest('.items').querySelector(".basket_icons").classList.add('timeOut');
581                        /*장바구니 미노출*/
582                        // el.parentNode.querySelectorAll(".basket_icons")[0].style.display = "none";
583                        clearInterval(times[index].interval);
584                    }
585                    el.querySelector(".timer").innerHTML = `${text}<span>남음</span>`;
586                }, 1000);
587            } else {
588                // 이벤트가 종료된 경우
589                console.log(el);
590                el.querySelector(".timer").innerHTML = `타임딜 종료! <span>다음 기회에 만나요 :)</span>`; // 프로모션 없을 시
591                el.classList.add("timeout");
592                el.closest('.items').querySelector(".basket_icons").classList.add('timeOut');
593            }
594        });
595    }
596
597    // 상품 태그 스크립트
598    addTags();
599})();
600(() => {
601    var regex = /[^0-9]/g;
602    var comma = /\B(?=(\d{3})+(?!\d))/g;
603    const items = document.querySelectorAll(".list_content .items:not(.one_done)");
604
605    
606    items.forEach(el => {
607        const name = el.querySelector(".name");  // 상품 이름
608        const one_price = el.querySelector(".day_price:not(.displaynone) .one_price"); // 상품 하나당 가격
609
610    	// 상품 이름 [] 부분 색상변경
611        if (name) {
612            // 요소 내부의 HTML 내용을 가져옵니다.
613            let htmlContent = name.innerHTML;
614
615            // [ ] 안에 있는 텍스트를 회색으로 변경합니다.
616            htmlContent = htmlContent.replace(/\[(.*?)\]/g, '<span style="color: #212121">[$1]</span>');
617
618            // 변경된 내용을 요소에 다시 할당합니다.
619            name.innerHTML = htmlContent;
620        }
621        
622        if(one_price) {
623        	let one_number = Number(one_price.innerText.replace(regex, ""));
624            
625            // 상품 가격
626            let price = el.querySelector(".price");
627            price = Number(price.innerText.replace(regex, ""));
628            
629            // 하나당 가격
630           let day_price = price / one_number
631           day_price = Math.floor(day_price); // 소수점 이하를 버린 정수로 변환
632            
633           one_price.innerHTML = day_price.toString().replace(comma, ",") + "원";
634        }
635        
636        el.classList.add('one_done');
637    });
638})();
639(() => {
640  let wish = $(".wishIcon");
641  let wish_popup_content = $(".xans-myshop-layerwish");
642  let wish_popup_text = wish_popup_content.find(".wish_popup .content > p");
643
644
645  wish_popup_content.css("display", "none");
646
647  wish.each(function () {
648  
649    $(this).click(function() {
650      let wish_pop = $(this).find("img").attr("icon_status");
651
652      if (wish_pop === "on") {
653        wish_popup_text.text("관심상품 목록에서 삭제되었습니다.");
654        wish_popup_content.css("display", "block");
655      } else {
656        wish_popup_text.text("상품이 관심상품에 저장되었습니다.");
657        wish_popup_content.css("display", "block");
658      }
659    })
660  })
661}) ();
662
663(() => {
664    var keyword = $("#keyword");
665    var keyword_class = $(".inputTypeText");
666    keyword.attr("placeholder", "‘신상품'을 검색해보세요!");
667    
668
669    // url을 가져오기
670    // decodeURI = 키워드가 한글일 경우 한글로 변환
671    var keyword_href = decodeURI(window.location.href);
672    const url = new URL(keyword_href);
673    const urlParams = url.searchParams;
674
675    // 검색어(키워드) 찾기
676    let keyword_item = urlParams.get('keyword')
677
678
679    if ((urlParams.has('keyword'))) {
680        // 검색어(키워드) value에 추가
681        keyword_class.val(keyword_item)
682    } else {
683        return
684    }
685    
686    
687    /* 알약 하나당 가격 */
688    const dayPrice = () => {
689        var regex = /[^0-9]/g;
690        var comma = /\B(?=(\d{3})+(?!\d))/g;
691        const items = document.querySelectorAll(".search_items >li");
692
693        items.forEach(el => {
694            const name = el.querySelector(".name");  // 상품 이름
695            const one_price = el.querySelector(".day_price:not(.displaynone) .one_price"); // 상품 하나당 가격
696
697            // 상품 이름 [] 부분 색상변경
698            if (name) {
699                // 요소 내부의 HTML 내용을 가져옵니다.
700                let htmlContent = name.innerHTML;
701
702                // [ ] 안에 있는 텍스트를 회색으로 변경합니다.
703                htmlContent = htmlContent.replace(/\[(.*?)\]/g, '<span style="color: #212121">[$1]</span>');
704
705                // 변경된 내용을 요소에 다시 할당합니다.
706                name.innerHTML = htmlContent;
707            }
708
709            if(one_price) {
710                let one_number = Number(one_price.innerText.replace(regex, ""));
711
712                // 상품 가격
713                let price = el.querySelector(".price");
714
715                price = Number(price.innerText.replace(regex, ""));
716
717
718                // 하나당 가격
719                let day_price = price / one_number
720                day_price = Math.floor(day_price); // 소수점 이하를 버린 정수로 변환
721
722                one_price.innerHTML = day_price.toString().replace(comma, ",") + "원";
723            }
724
725            el.classList.add('done');
726        });
727    };
728    
729    // 알약 하나당 가격 스크립트
730    dayPrice();
731})();
732
733
734$(function(){
735	const searchBtn = $("button.search");
736    const searchPop = $(".search_popup");
737    const searchCont = $(".search_content");
738    const searchClose = $("#header .search_close");
739    
740    searchBtn.click(function(){
741        $("#header .search").hide();
742        searchClose.show();
743        searchPop.fadeIn(300,function(){
744	        $("body").addClass("lock");
745        }).addClass("on");
746        searchCont.slideDown(500);
747    });
748    
749    searchPop.click(function(event) {
750        if (!searchCont.is(event.target) && searchCont.has(event.target).length === 0) {
751	    	searchCont.slideUp(500);
752            searchPop.fadeOut(300,function(){
753                $(this).removeClass("on");
754                $("body").removeClass("lock");
755            });
756            $("#header .search").show();
757            searchClose.hide();
758        }
759    });
760    
761    searchClose.click(function(){
762		searchCont.slideUp(500);
763        searchPop.fadeOut(300,function(){
764            $(this).removeClass("on");
765            $("body").removeClass("lock");
766        });
767        $("#header .search").show();
768        searchClose.hide();
769    });
770});
771
772document.addEventListener("DOMContentLoaded",()=>{
773    
774    // 최근검색어
775    const search = document.getElementById("keyword");
776    const searchForm = document.getElementById("searchForm");
777    const searchDelAll = document.querySelector(".btnDeleteAll");
778    let recentArr = JSON.parse(localStorage.getItem("recent_keywords") || "[]");
779    
780    const recentList = document.querySelector(".recent_list");
781    const recentEmpty = document.querySelector(".empty");
782    
783    if(recentList){
784        
785        if(recentArr.length > 0){
786            recentArr = recentArr.slice(0,10);
787            recentArr.forEach(el => {
788            	const keyword = document.createElement("li");
789                const link = document.createElement("a");
790                const delBtn = "<button class=\"btnDelete\"></button>";
791
792                keyword.className = "recent_keyword";
793                link.href = "/product/search.html?keyword=" + el.replace(" ", "+");
794                link.textContent = el;
795                keyword.append(link);
796                keyword.innerHTML += delBtn;
797                recentList.append(keyword);            
798            });
799        }else{
800            recentEmpty.classList.remove("displaynone");
801            recentList.classList.add("displaynone");
802            searchDelAll.classList.add("displaynone");
803        }
804        
805		recentList.querySelectorAll(".recent_keyword").forEach(el => {
806            el.addEventListener("click", ()=>{
807                const thisText = el.querySelector("a").textContent;
808                const idx = recentArr.indexOf(thisText);
809                if (idx > -1) recentArr.splice(idx, 1);
810                recentArr.unshift(thisText);
811                const recentArrString = JSON.stringify(recentArr);
812                localStorage.setItem("recent_keywords", recentArrString);
813            });
814        });
815
816        recentList.querySelectorAll(".btnDelete").forEach(el => {
817            el.addEventListener("click", (e)=>{
818                e.stopPropagation();
819                el.closest("li.recent_keyword").remove();
820                const thisText = el.closest("li.recent_keyword").querySelector("a").textContent;
821                const idx = recentArr.indexOf(thisText);
822                if (idx > -1) {
823                    recentArr.splice(idx, 1);
824                    localStorage.setItem("recent_keywords", JSON.stringify(recentArr));
825                }
826
827                if(recentArr.length === 0){
828                    recentEmpty.classList.remove("displaynone");
829                    recentList.classList.add("displaynone");
830                    searchDelAll.classList.add("displaynone");
831                }
832            });
833        });
834
835        searchDelAll.addEventListener("click",()=>{
836
837            document.querySelectorAll(".recent_keyword").forEach(el => {
838                el.remove();
839            });
840
841            recentArr = [];
842            localStorage.setItem("recent_keywords", JSON.stringify(recentArr));
843            recentEmpty.classList.remove("displaynone");
844            recentList.classList.add("displaynone");
845            searchDelAll.classList.add("displaynone");
846
847        });
848    
849    }
850
851    
852//    searchForm.addEventListener("submit",()=>{
853
854    if(search.value && search.value !== ""){
855    	if(recentArr.length > 0){
856            if(recentArr.includes(search.value)){
857	          const idx = recentArr.indexOf(search.value);
858              if (idx > -1) recentArr.splice(idx, 1);
859            }
860            recentArr.unshift(search.value);
861        }else{
862            recentArr.push(search.value);
863        }
864        
865        const recentArrString = JSON.stringify(recentArr);
866        localStorage.setItem("recent_keywords", recentArrString);
867    }
868        
869//    });
870    
871    
872    // 인기검색어 순위
873	const hotKeywordsList = document.querySelector(".xans-search-hotkeyword");
874    if(hotKeywordsList){
875    	const hotKeywords = hotKeywordsList.querySelectorAll(".tag_list");
876        if(hotKeywords.length > 0){
877            if(hotKeywords.length === 1 && hotKeywords[0].textContent.replace(" ","") === ""){
878            	hotKeywordsList.closest(".mark_box").classList.add("displaynone");
879            }else{
880                hotKeywords.forEach((el, idx) => {
881                    el.setAttribute("data-index", idx + 1);
882                });
883            }
884        }
885    }
886});
887(function($){
888    $.fn.extend({
889        center: function() {
890            this.each(function() {
891                var
892                    $this = $(this),
893                    $w = $(window);
894                $this.css({
895                    position: "absolute",
896                    top: ~~(($w.height() - $this.outerHeight()) / 2) + $w.scrollTop() + "px",
897                    left: ~~(($w.width() - $this.outerWidth()) / 2) + $w.scrollLeft() + "px"
898                });
899            });
900            return this;
901        }
902    });
903    $(function() {
904        var $container = function(){/*
905    <div id="modalContainer">
906        <iframe id="modalContent" scroll="0" scrolling="no" frameBorder="0"></iframe>
907    </div>');
908    */}.toString().slice(14,-3);
909        $('body')
910        .append($('<div id="modalBackpanel"></div>'))
911        .append($($container));
912        function closeModal () {
913            $('#modalContainer').hide();
914            $('#modalBackpanel').hide();
915        }
916        $('#modalBackpanel').on('click',closeModal);
917        zoom = function ($piProductNo, $piCategoryNo, $piDisplayGroup) {
918            var $url = '/product/image_zoom.html?product_no=' + $piProductNo + '&cate_no=' + $piCategoryNo + '&display_group=' + $piDisplayGroup;
919            $('#modalContent').attr('src', $url);
920            $('#modalContent').on("load",function(){
921                $(".header .close",this.contentWindow.document.body).on("click", closeModal);
922            });
923            $('#modalBackpanel').css({width:$("body").width(),height:$("body").height(),opacity:.4}).show();
924            $('#modalContainer').center().show();
925        }
926    });
927})(jQuery);
928//window popup script
929function winPop(url) {
930    window.open(url, "popup", "width=300,height=300,left=10,top=10,resizable=no,scrollbars=no");
931}
932/**
933 * document.location.href split
934 * return array Param
935 */
936function getQueryString(sKey)
937{
938    var sQueryString = document.location.search.substring(1);
939    var aParam       = {};
940
941    if (sQueryString) {
942        var aFields = sQueryString.split("&");
943        var aField  = [];
944        for (var i=0; i<aFields.length; i++) {
945            aField = aFields[i].split('=');
946            aParam[aField[0]] = aField[1];
947        }
948    }
949
950    aParam.page = aParam.page ? aParam.page : 1;
951    return sKey ? aParam[sKey] : aParam;
952};
953
954$(function(){
955    // tab
956    $.eTab = function(ul){
957        $(ul).find('a').on('click', function(){
958            var _li = $(this).parent('li').addClass('selected').siblings().removeClass('selected'),
959                _target = $(this).attr('href'),
960                _siblings = '.' + $(_target).attr('class');
961            $(_target).show().siblings(_siblings).hide();
962            return false
963        });
964    }
965    if ( window.call_eTab ) {
966        call_eTab();
967    };
968});
969
970document.addEventListener("DOMContentLoaded",()=>{
971	document.body.childNodes.forEach(node => {
972    	if (node.nodeType === Node.TEXT_NODE && node.textContent.trim() === '>'){
973            //node.remove();
974        }
975    });
976});
977// 썸네일 이미지 엑박일경우 기본값 설정
978$(window).on('load', function() {
979
980    $(".thumbnail img, img.thumbImage, img.bigImage").each(function($i,$item){
981        var $img = new Image();
982        $img.onerror = function () {
983            $item.src="//img.echosting.cafe24.com/thumb/img_product_big.gif";
984        }
985        $img.src = this.src;
986    });
987
988});
989
990$(function(){
991    // 토글
992    $('div.eToggle .title').off('click').on('click', function(){
993        var toggle = $(this).parent('.eToggle');
994        if(toggle.hasClass('disable') === false){
995            $(this).parent('.eToggle').toggleClass('selected')
996        }
997    });
998
999    $('dl.eToggle dt').on('click', function(){
1000        $(this).toggleClass('selected');
1001        $(this).next('dd').toggleClass('selected');
1002    });
1003
1004    //장바구니 페이지 수량폼 Type 변경
1005    $('[id^="quantity"]').each(function() {
1006        $(this).get(0).type = 'tel';
1007    });
1008
1009    // 모바일에서 공급사 테이블 th 강제조절
1010    $('.xans-mall-supplyinfo, .supplyInfo').find('table > colgroup').find('col').eq(0).width(98);
1011    $('.xans-mall-supplyinfo, .supplyInfo').find('th, td').css({padding:'13px 10px 12px'});
1012
1013    /**
1014     *  메인카테고리 toggle
1015     */
1016    $('.xans-product-listmain h2').on('click', function() {
1017        var bClosed = !!$(this).data('is_closed');
1018        var sUrl;
1019        if (bClosed) {
1020            sUrl = "//img.echosting.cafe24.com/skin/mobile_ko_KR/layout/bg_title_close.gif";
1021        } else {
1022            sUrl = "//img.echosting.cafe24.com/skin/mobile_ko_KR/layout/bg_title_open.gif";
1023        }
1024        $(this).css('background-image', 'url("'+ sUrl +'")');
1025        $(this).siblings().toggle();
1026        $(this).parent().find('div.ec-base-paginate').toggle();
1027        $(this).parent().next('div.xans-product-listmore').toggle();
1028        $(this).data('is_closed', !bClosed);
1029    });
1030
1031    /* base header 검색 레이어 */
1032    $('#layout .header').find('.search .btnSearch').on('click', function(){
1033        var $baseHeader = $('#layout .header');
1034        $baseHeader.addClass('open');
1035        $('#dimmedSlider').one('click', function(){
1036            $baseHeader.removeClass('open');
1037        });
1038    });
1039
1040    /**
1041     *  상단탑버튼
1042     */
1043    var globalTopBtnScrollFunc = function() {
1044        // 탑버튼 관련변수
1045        var $btnTop = $('#btnTop');
1046
1047        $(window).on('scroll', function() {
1048            try {
1049                var iCurScrollPos = $(this).scrollTop();
1050
1051                if (iCurScrollPos > ($(this).height() / 2)) {
1052                    $btnTop.fadeIn('fast');
1053                } else {
1054                    $btnTop.fadeOut('fast');
1055                }
1056            } catch(e) { }
1057        });
1058    };
1059
1060    /**
1061     *  구매버튼
1062     */
1063    var globalBuyBtnScrollFunc = function() {
1064        // 구매버튼 관련변수
1065        var sFixId = $('#orderFixItem').length > 0  ? 'orderFixItem' : 'fixedActionButton',
1066            $area = $('#orderFixArea'),
1067            $item = $('#' + sFixId + '').not($area);
1068
1069        $(window).on('scroll', function(){
1070            try {
1071                // 구매버튼 관련변수
1072                var iCurrentHeightPos = $(this).scrollTop() + $(this).height(),
1073                    iButtonHeightPos = $item.offset().top;
1074
1075                if (iCurrentHeightPos > iButtonHeightPos || iButtonHeightPos < $(this).scrollTop() + $item.height()) {
1076                    if (iButtonHeightPos < $(this).scrollTop() - $item.height()) {
1077                        $area.fadeIn('fast');
1078                    } else {
1079                        $area.hide();
1080                    }
1081                } else {
1082                    $area.fadeIn('fast');
1083                }
1084            } catch(e) { }
1085        });
1086    };
1087
1088    globalTopBtnScrollFunc();
1089    globalBuyBtnScrollFunc();
1090});
1091
1092// 공통레이어팝업 오픈
1093var globalLayerOpenFunc = function(_this) {
1094    this.id = $(_this).data('id');
1095    this.param = $(_this).data('param');
1096    this.basketType = $('#basket_type').val();
1097    this.url = $(_this).data('url');
1098    this.layerId = 'ec_temp_mobile_layer';
1099    this.layerIframeId = 'ec_temp_mobile_iframe_layer';
1100
1101    var _this = this;
1102
1103    function paramSetUrl() {
1104        if (this.param) {
1105            // if isset param
1106        } else {
1107            this.url = this.basketType ?  this.url + '?basket_type=' + this.basketType : this.url;
1108        }
1109    };
1110
1111    if (this.url) {
1112        window.ecScrollTop = $(window).scrollTop();
1113        $.ajax({
1114            url : this.url,
1115            success : function (data) {
1116                if (data.indexOf('404 페이지 없음') == -1) {
1117                    // 있다면 삭제
1118                    try { $(_this).remove(); } catch ( e ) { }
1119
1120                    var $layer = $('<div>', {
1121                        html: $("<iframe>", { src: _this.url, id: _this.layerIframeId, scrolling: 'auto', css: { width: '100%', height: '100%', overflowY: 'auto', border: 0 } } ),
1122                        id: _this.layerId,
1123                        css : { position: 'absolute', top: 0, left:0, width: '100%', height: $(window).height(), 'z-index': 9999 }
1124                    });
1125
1126                    $('body').append($layer);
1127                    $('html, body').css({'overflowY': 'hidden', height: '100%', width: '100%'});
1128                    $('#' + this.layerId).show();
1129                }
1130            }
1131        });
1132    }
1133};
1134
1135// 공통레이어팝업 닫기
1136var globalLayerCloseFunc = function() {
1137    this.layerId = 'ec_temp_mobile_layer';
1138
1139    if (window.parent === window)
1140        self.close();
1141    else {
1142        parent.$('html, body').css({'overflowY': 'auto', height: 'auto', width: '100%'});
1143        parent.$('html, body').scrollTop(parent.window.ecScrollTop);
1144        parent.$('#' + this.layerId).remove();
1145    }
1146};
1147
1148/**
1149 * document.location.href split
1150 * return array Param
1151 */
1152var getQueryString = function(sKey)
1153{
1154    var sQueryString = document.location.search.substring(1);
1155    var aParam = {};
1156
1157    if (sQueryString) {
1158        var aFields = sQueryString.split("&");
1159        var aField  = [];
1160        for (var i=0; i<aFields.length; i++) {
1161            aField = aFields[i].split('=');
1162            aParam[aField[0]] = aField[1];
1163        }
1164    }
1165
1166    aParam.page = aParam.page ? aParam.page : 1;
1167    return sKey ? aParam[sKey] : aParam;
1168};
1169
1170// PC버전 바로 가기
1171var isPCver = function() {
1172    var sUrl = window.location.hostname;
1173    var aTemp = sUrl.split(".");
1174
1175    var pattern = /^(mobile[\-]{2}shop[0-9]+)$/;
1176
1177    if (aTemp[0] == 'm' || aTemp[0] == 'skin-mobile' || aTemp[0] == 'mobile') {
1178        sUrl = sUrl.replace(aTemp[0]+'.', '');
1179    } else if (pattern.test(aTemp[0]) === true) {
1180        var aExplode = aTemp[0].split('--');
1181        aTemp[0] = aExplode[1];
1182        sUrl = aTemp.join('.');
1183    }
1184    window.location.href = '//'+sUrl+'/?is_pcver=T';
1185};
1186
1187/* 도움말 */
1188$('body').on('click', '.ec-base-tooltip-area .eTip', function(e){
1189    var findArea = $($(this).parents('.ec-base-tooltip-area'));
1190    var findTarget = $($(this).siblings('.ec-base-tooltip'));
1191    var findTooltip = $('.ec-base-tooltip');
1192    $('.ec-base-tooltip-area').removeClass('show');
1193    $(this).parents('.ec-base-tooltip-area').first().addClass('show');
1194    findTooltip.hide();
1195    findTarget.show();
1196    e.preventDefault();
1197});
1198
1199$('body').on('click', '.ec-base-tooltip-area .eClose', function(e){
1200    var findTarget = $(this).parents('.ec-base-tooltip').first();
1201    $('.ec-base-tooltip-area').removeClass('show');
1202    findTarget.hide();
1203    e.preventDefault();
1204});
1205
1206$('.ec-base-tooltip-area').find('input').on('focusout', function() {
1207    var findTarget = $(this).parents('.ec-base-tooltip-area').find('.ec-base-tooltip');
1208    $('.ec-base-tooltip-area').removeClass('show');
1209    findTarget.hide();
1210});
1211
1212/**
1213 * 팝업창에 리사이즈 관련
1214 */
1215
1216function setResizePopup() {
1217
1218    if(!$('#popup').length) return;
1219
1220    var iWrapWidth    = $('#popup').width();
1221    var iWrapHeight   = $('#popup').height();
1222
1223    var iWindowWidth  = $(window).width();
1224    var iWindowHeight = $(window).height();
1225
1226    window.resizeBy(iWrapWidth - iWindowWidth, iWrapHeight - iWindowHeight);
1227}
1228setResizePopup();
1229
1230// 팝업 페이지 로드가 완료된 후에 리사이징 함수를 다시 호출
1231$( window ).on('load', function() {
1232    setResizePopup();
1233});
1234/**
1235 * 움직이는 배너 Jquery Plug-in
1236 * @author  cafe24
1237 */
1238
1239(function($){
1240
1241    $.fn.floatBanner = function(options) {
1242        options = $.extend({}, $.fn.floatBanner.defaults , options);
1243
1244        return this.each(function() {
1245            var aPosition = $(this).position();
1246            var jbOffset = $(this).offset();
1247            var node = this;
1248
1249            $(window).on('scroll', function() {
1250                var _top = $(document).scrollTop();
1251                _top = (aPosition.top < _top) ? _top : aPosition.top;
1252
1253                setTimeout(function () {
1254                    var newinit = $(document).scrollTop();
1255
1256                    if ( newinit >
1256 jbOffset.top ) {
1257                        _top -= jbOffset.top;
1258                        var container_height = $("#wrap").height();
1259                        var quick_height = $(node).height();
1260                        var cul = container_height - quick_height;
1261                        if(_top > cul){
1262                            _top = cul;
1263                        }
1264                    } else {
1265                        _top = 0;
1266                    }
1267
1268                    $(node).stop().animate({top: _top}, options.animate);
1269                }, options.delay);
1270            });
1271        });
1272    };
1273
1274    $.fn.floatBanner.defaults = {
1275        'animate'  : 500,
1276        'delay'    : 500
1277    };
1278
1279})(jQuery);
1280
1281/**
1282 * 문서 구동후 시작
1283 */
1284$(function(){
1285    $('#banner:visible, #quick:visible').floatBanner();
1286
1287    //placeholder
1288    $(".ePlaceholder input, .ePlaceholder textarea").each(function(i){
1289        var placeholderName = $(this).parents().attr('title');
1290        $(this).attr("placeholder", placeholderName);
1291    });
1292    /* placeholder ie8, ie9 */
1293    $.fn.extend({
1294        placeholder : function() {
1295            //IE 8 버전에는 hasPlaceholderSupport() 값이 false를 리턴
1296           if (hasPlaceholderSupport() === true) {
1297                return this;
1298            }
1299            //hasPlaceholderSupport() 값이 false 일 경우 아래 코드를 실행
1300            return this.each(function(){
1301                var findThis = $(this);
1302                var sPlaceholder = findThis.attr('placeholder');
1303                if ( ! sPlaceholder) {
1304                   return;
1305                }
1306                findThis.wrap('<label class="ePlaceholder" />');
1307                var sDisplayPlaceHolder = $(this).val() ? ' style="display:none;"' : '';
1308                findThis.before('<span' + sDisplayPlaceHolder + '>' + sPlaceholder + '</span>');
1309                this.onpropertychange = function(e){
1310                    e = event || e;
1311                    if (e.propertyName == 'value') {
1312                        $(this).trigger('focusout');
1313                    }
1314                };
1315                //공통 class
1316                var agent = navigator.userAgent.toLowerCase();
1317                if (agent.indexOf("msie") != -1) {
1318                    $(".ePlaceholder").css({"position":"relative"});
1319                    $(".ePlaceholder span").css({"position":"absolute", "padding":"0 4px", "color":"#878787"});
1320                    $(".ePlaceholder label").css({"padding":"0"});
1321                }
1322            });
1323        }
1324    });
1325
1326    $(':input[placeholder]').placeholder(); //placeholder() 함수를 호출
1327
1328    //클릭하면 placeholder 숨김
1329    $('body').on('click', '.ePlaceholder span', function(){
1330        $(this).hide();
1331    });
1332
1333    //input창 포커스 인 일때 placeholder 숨김
1334    $('body').on('focusin', '.ePlaceholder :input', function(){
1335        $(this).prev('span').hide();
1336    });
1337
1338    //input창 포커스 아웃 일때 value 가 true 이면 숨김, false 이면 보여짐
1339    $('body').on('focusout', '.ePlaceholder :input', function(){
1340        if (this.value) {
1341            $(this).prev('span').hide();
1342        } else {
1343            $(this).prev('span').show();
1344        }
1345    });
1346
1347    //input에 placeholder가 지원이 되면 true를 안되면 false를 리턴값으로 던져줌
1348    function hasPlaceholderSupport() {
1349        if ('placeholder' in document.createElement('input')) {
1350            return true;
1351        } else {
1352            return false;
1353        }
1354    }
1355});
1356
1357/**
1358 *  썸네일 이미지 엑박일경우 기본값 설정
1359 */
1360$(window).on('load', function() {
1361    $("img.thumb,img.ThumbImage,img.BigImage").each(function($i,$item){
1362        var $img = new Image();
1363        $img.onerror = function () {
1364            $item.src="//img.echosting.cafe24.com/thumb/img_product_big.gif";
1365        }
1366        $img.src = this.src;
1367    });
1368});
1369
1370/**
1371 *  tooltip
1372 */
1373$('.eTooltip').each(function(i){
1374    $(this).find('.btnClose').attr('tabIndex','-1');
1375});
1376//tooltip input focus
1377$('.eTooltip').find('input').on('focus', function() {
1378    var targetName = returnTagetName(this);
1379    targetName.siblings('.ec-base-tooltip').show();
1380});
1381$('.eTooltip').find('input').on('focusout', function() {
1382    var targetName = returnTagetName(this);
1383    targetName.siblings('.ec-base-tooltip').hide();
1384});
1385function returnTagetName(_this){
1386    var ePlacename = $(_this).parent().attr("class");
1387    var targetName;
1388    if(ePlacename == "ePlaceholder"){ //ePlaceholder 대응
1389        targetName = $(_this).parents();
1390    }else{
1391        targetName = $(_this);
1392    }
1393    return targetName;
1394}
1395
1396/**
1397 *  eTab
1398 */
1399$("body").on("click", ".eTab a", function(e){
1400    // 클릭한 li 에 selected 클래스 추가, 기존 li에 있는 selected 클래스는 삭제.
1401    var _li = $(this).parent("li").addClass("selected").siblings().removeClass("selected"),
1402    _target = $(this).attr("href"),
1403    _siblings = $(_target).attr("class"),
1404    _arr = _siblings.split(" "),
1405    _classSiblings = "."+_arr[0];
1406
1407    //클릭한 탭에 해당하는 요소는 활성화, 기존 요소는 비활성화 함.
1408    $(_target).show().siblings(_classSiblings).hide();
1409
1410
1411    //preventDefault 는 a 태그 처럼 클릭 이벤트 외에 별도의 브라우저 행동을 막기 위해 사용됨.
1412    e.preventDefault();
1413});
1414
1415
1416
1417(() => {
1418	
1419    function adjustContentsHeight() {
1420        const headerHeight = document.getElementById('header')?.offsetHeight || 0;
1421        const navHeight = document.querySelector('.bottom_nav')?.offsetHeight || 0;
1422        const footerHeight = document.getElementById('footer')?.offsetHeight || 0;
1423        const container = document.getElementById('contents');
1424        
1425        if(!container) {
1426        	return;
1427        }
1428
1429            const viewportHeight = window.innerHeight;
1430
1431            const containerMinHeight = viewportHeight - headerHeight - navHeight - footerHeight;
1432
1433            container.style.minHeight = containerMinHeight + 'px';
1434        }
1435
1436        // 페이지 로드 시 초기 뷰포트 조정 작업 수행
1437        window.addEventListener('load', adjustContentsHeight);
1438
1439    
1440})();
1441(()=>{
1442    let loading = $(".loading");
1443
1444    loading.fadeOut(1000,"linear");
1445})();
1446(() => {
1447    var lastScroll = 0;
1448    var headerInner = $("#header").innerHeight();
1449    const linearBanner = $(".linear_banner");
1450
1451    if(linearBanner.length > 0) {
1452        $('#wrap').addClass('hasBanner');
1453    } else {
1454        $('#wrap').removeClass('hasBanner');
1455    }
1456
1457    $(window).scroll(function(event){
1458        var st = $(this).scrollTop();
1459
1460        // 맨위에서 1px만 움직여도 header가 화면에서 사라지는 현상 방지
1461        if ( st < headerInner) {
1462            $('#wrap').removeClass('up');
1463        }
1464        //내려갈때
1465        else if (st > lastScroll) {
1466            $('#wrap').addClass('up');
1467        }
1468        //올라갈때
1469        else {
1470            $('#wrap').removeClass('up');
1471        }
1472
1473        lastScroll = st;
1474    });
1475
1476    /* 띠배너 토글*/
1477    const bannerClose = $(".banner_close");
1478    bannerClose.click(function () {
1479        linearBanner.slideToggle(400);
1480        linearBanner.toggleClass('nonDisplay');
1481        $('#wrap').toggleClass('nonBanner');
1482    });
1483
1484    /* navigation swiper */
1485    var navSwiper = new Swiper(".nav_swiper", {
1486        slidesPerView: "auto",
1487        freeMode: true,
1488    });
1489
1490    /* linearSwiper */
1491    const topBanner = document.querySelectorAll(".linear_banner");
1492    
1493    if(topBanner.length > 0){
1494    
1495    	topBanner.forEach(el => {
1496            if(el.querySelectorAll(".swiper-slide").length > 1) {
1497                var linearSwiper = new Swiper(el,{
1498                    direction: 'vertical',
1499                    slidesPerVIew: 1,
1500                    loop: true,
1501                    autoplay : { 
1502                        delay : 3000,  
1503                      disableOnInteraction : false, 
1504                    },
1505                    speed: 500,
1506                });
1507            }
1508        });
1509    }
1510    /* navigation on 기능 */
1511    const hrefs = window.location.href;
1512    const naviList = document.querySelectorAll(".navigation .list .items");
1513    console.log("url : " +hrefs);
1514
1515    naviList.forEach(el => {
1516        const el_link = el.querySelector("a").href;
1517        console.log("link : " +el_link);
1518
1519        if(hrefs.includes(el_link)) {
1520            el.classList.add("on");
1521        }
1522    });
1523}) ();
1524(()=>{
1525    /* 사이드메뉴 on/off */
1526    let menu = $("aside.sidemenu");
1527    let sideContent = $(".side_content");
1528    let bottomMenu = $(".bottom_nav .link.category");
1529    let menuClose = menu.find(".menu_close");
1530    let headerMenu = $(".header_menu");
1531
1532    menu.click(function(event) {
1533        if (!sideContent.is(event.target) && sideContent.has(event.target).length === 0) {
1534            menu.fadeOut(300);
1535            menu.find(".side_content").animate({left: '-100%'});
1536            $("body").removeClass("lock");
1537        }
1538    });
1539
1540    menuClose.click(function(){
1541        menu.fadeOut(300);
1542        menu.find(".side_content").animate({left: '-100%'});
1543        $("body").removeClass("lock");
1544    });
1545
1546    bottomMenu.click(function(){
1547        menu.fadeIn(300);
1548        menu.find(".side_content").animate({left: '0%'}, 500);
1549        $("body").addClass("lock");
1550    });
1551
1552    headerMenu.click(function(){
1553        menu.fadeIn(300);
1554        menu.find(".side_content").animate({left: '0%'}, 500);
1555        $("body").addClass("lock");
1556    });
1557})();
1558
1559
1560/* 2depth 까지만 노출 */
1561$(function(){
1562
1563    var methods = {
1564        aCategory    : [],
1565        aSubCategory : {},
1566
1567        get: function()
1568        {
1569            $.ajax({
1570                url : '/exec/front/Product/SubCategory',
1571                dataType: 'json',
1572                success: function(aData) {
1573                    if (aData == null || aData == 'undefined') return;
1574                    for (var i=0; i<aData.length; i++)
1575                    {
1576                        var sParentCateNo = aData[i].parent_cate_no;
1577
1578                        if (!methods.aSubCategory[sParentCateNo]) {
1579                            methods.aSubCategory[sParentCateNo] = [];
1580                        }
1581
1582                        methods.aSubCategory[sParentCateNo].push( aData[i] );
1583                    }
1584                    // 서브 카테고리를 생성한 후에도 첫 ë²
1584ˆì§¸ 카테고리를 표시하도록 아래 코드 추가
1585                    methods.generateSubCategory();
1586                }
1587            });
1588        },
1589
1590        generateSubCategory: function() {
1591            // 이 함수는 서브 카테고리를 미리 생성합니다.
1592            // 페이지가 로드될 때 호출됩니다.
1593            // 모든 카테고리에 대한 서브 카테고리를 생성하도록 수정
1594
1595            $('.xans-layout-category li').each(function() {
1596                var $this = $(this);
1597                var iCateNo = Number(methods.getParam($this.find('a').attr('href'), 'cate_no'));
1598
1599                if (!iCateNo) {
1600                    iCateNo = Number(methods.getParamSeo($this.find('a').attr('href')));
1601                }
1602
1603                if (iCateNo) {
1604                    methods.show($this, iCateNo);
1605                }
1606            });
1607        },
1608
1609        getParam: function(sUrl, sKey) {
1610            var aUrl         = sUrl.split('?');
1611            var sQueryString = aUrl[1];
1612            var aParam       = {};
1613
1614            if (sQueryString) {
1615                var aFields = sQueryString.split("&");
1616                var aField  = [];
1617                for (var i=0; i<aFields.length; i++) {
1618                    aField = aFields[i].split('=');
1619                    aParam[aField[0]] = aField[1];
1620                }
1621            }
1622            return sKey ? aParam[sKey] : aParam;
1623        },
1624
1625        getParamSeo: function(sUrl) {
1626            var aUrl = sUrl.split('/');
1627            var len  = aUrl.length-2;
1628
1629            return aUrl[len] ? aUrl[len] : null;
1630        },
1631
1632        show: function (overNode, iCateNo) {
1633
1634            if (methods.aSubCategory.hasOwnProperty(iCateNo) === false) {
1635                return;
1636            }
1637
1638            var aHtml = [];
1639            aHtml.push('<ul>');
1640            $(methods.aSubCategory[iCateNo]).each(function() {
1641                aHtml.push('<li><a href="/' + this.design_page_url + this.param + '">'+this.name+'</a></li>');
1642            });
1643            aHtml.push('</ul>');
1644
1645
1646            var offset = $(overNode).offset();
1647            $('<div class="sub-category"></div>')
1648                .appendTo(overNode)
1649                .html(aHtml.join(''))
1650                .find('li').on({
1651                mouseover: function(e) {
1652                    $(this).addClass('over');
1653                },
1654                mouseout: function(e) {
1655                    $(this).removeClass('over');
1656                }
1657            });
1658        },
1659
1660        close: function() {
1661            $('.sub-category').remove();
1662        }
1663    };
1664
1665    // 초기에 서브 카테고리를 생성
1666    methods.get();
1667
1668    // 페이지 로드 시 모든 서브 카테고리를 생성
1669    methods.generateSubCategory();
1670    
1671    
1672    var regex = /[^0-9]/g;
1673    var comma = /\B(?=(\d{3})+(?!\d))/g;
1674    const items = document.querySelectorAll(".list_content.sidemenu_list_content .items:not(.one_done)");
1675
1676    
1677    items.forEach(el => {
1678        const name = el.querySelector(".name");  // 상품 이름
1679        const one_price = el.querySelector(".day_price:not(.displaynone) .one_price"); // 상품 하나당 가격
1680
1681    	// 상품 이름 [] 부분 색상변경
1682        if (name) {
1683            // 요소 내부의 HTML 내용을 가져옵니다.
1684            let htmlContent = name.innerHTML;
1685
1686            // [ ] 안에 있는 텍스트를 회색으로 변경합니다.
1687            htmlContent = htmlContent.replace(/\[(.*?)\]/g, '<span style="color: #929292">[$1]</span>');
1688
1689            // 변경된 내용을 요소에 다시 할당합니다.
1690            name.innerHTML = htmlContent;
1691        }
1692        
1693        if(one_price) {
1694        	let one_number = Number(one_price.innerText.replace(regex, ""));
1695            
1696            // 상품 가격
1697            let price = el.querySelector(".price");
1698            price = Number(price.innerText.replace(regex, ""));
1699            
1700            // 하나당 가격
1701           let day_price = price / one_number
1702           day_price = Math.floor(day_price); // 소수점 이하를 버린 정수로 변환
1703            
1704           one_price.innerHTML = day_price.toString().replace(comma, ",") + "원";
1705        }
1706        
1707        el.classList.add('one_done');
1708    });
1709});
1710(() => {
1711    /* 1depth toggle */
1712    $('.custom_category').not($('.menu_title.active').siblings('.custom_category')).hide(); 
1713    $('.menu_title').click(function(event){
1714        if($(this).next('.custom_category').length > 0) {
1715            event.preventDefault();
1716
1717            $('.menu_title').not(this).removeClass('active');
1718            $(this).toggleClass('active');
1719
1720            $(this).next('.custom_category').slideToggle(400);  
1721            $('.custom_category').not($(this).siblings('.custom_category')).slideUp();
1722        }
1723    });
1724    
1725    $('.side_title, .toggle_img').click(function(e) {
1726        if (!$(this).siblings('.sub-category').length) return;
1727
1728        // .side_title에 속한 .side_list에 'active' 클래스 추가/제거
1729        $(this).closest('.side_list').toggleClass('active');
1730
1731        // 다른 .side_list에서 'active' 클래스 제거
1732        $('.side_list').not($(this).closest('.side_list')).removeClass('active');
1733
1734        e.preventDefault();
1735        $(this).siblings('.sub-category').slideToggle();
1736        $('.sub-category').not($(this).siblings('.sub-category')).slideUp();
1737
1738    });
1739    setTimeout(function() {
1740        document.querySelectorAll('.side_list').forEach(function(sideList) {
1741            var subElement = sideList.querySelector('.sub-category');
1742            var toggleImg = sideList.querySelector('.toggle_img');
1743
1744            // .sub-category 요소가 있으면 toggle_img의 display: block
1745            if (subElement && toggleImg) {
1746                toggleImg.style.display = 'block';
1747            }
1748        });
1749    }, 500);
1750})();
1751
1752(() => {
1753   const company = $("#footer .company");
1754    company.find(".tit").on("click", function () {
1755        company.find(".tit").toggleClass("on");
1756        company.find(".info").slideToggle(500);
1757    });
1758
1759    // 상단 스크롤
1760    const topBtn = document.querySelector(".upBtn");
1761
1762    topBtn?.addEventListener("click", function () {
1763        window.scrollTo({ top: 0, behavior: "smooth" });
1764    });
1765})();

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.