1const storesPage = document.querySelector("#stores-page"); 2const swiper = storesPage.querySelector(".swiper"); 3 4const getStoreImages = () => { 5 try { 6 const baseUrl = "/web/upload/stores"; 7 const extension = "jpg"; 8 let checkImageLoop = true; 9 let index = 1; 10 const images = []; 11 12 while (checkImageLoop) { 13 const imagePath = `${baseUrl}/${index}.${extension}`; 14 var http = new XMLHttpRequest(); 15 http.open("HEAD", imagePath, false); 16 http.send(); 17 if (http.status != 404) { 18 index = index + 1; 19 images.push(imagePath); 20 } else { 21 checkImageLoop = false; 22 } 23 } 24 return images; 25 } catch (error) { 26 return []; 27 } 28}; 29 30const drawStoreImages = (images) => { 31 const swiperWrapper = swiper.querySelector(".swiper-wrapper"); 32 const template = swiperWrapper.querySelector(".swiper-slide.template"); 33 images.forEach((image) => { 34 const cloned = template.cloneNode(true); 35 cloned.classList.remove("template"); 36 const imageTag = cloned.querySelector("img"); 37 imageTag.setAttribute("src", image); 38 swiperWrapper.appendChild(cloned); 39 }); 40 template.remove(); 41}; 42 43const setSlider = () => { 44 new Swiper(swiper, { 45 // speed: 400, 46 // spaceBetween: 0, 47 48 // Optional parameters 49 // direction: "horizontal", 50 // initialSlide: index, 51 centeredSlides: true, 52 loop: true, 53 // // Navigation arrows 54 navigation: { 55 nextEl: ".button-navigation.next", 56 prevEl: ".button-navigation.prev", 57 }, 58 }); 59}; 60 61const initStores = () => { 62 const images = getStoreImages(); 63 drawStoreImages(images); 64 setSlider(); 65}; 66 67initStores(); 68 69/** 70 * ìì§ì´ë ë°°ë Jquery Plug-in 71 * @author cafe24 72 */ 73 74(function ($) { 75 $.fn.floatBanner = function (options) { 76 options = $.extend({}, $.fn.floatBanner.defaults, options); 77 78 return this.each(function () { 79 var aPosition = $(this).position(); 80 var jbOffset = $(this).offset(); 81 var node = this; 82 83 $(window).on("scroll", function () { 84 var _top = $(document).scrollTop(); 85 _top = aPosition.top < _top ? _top : aPosition.top; 86 87 setTimeout(function () { 88 var newinit = $(document).scrollTop(); 89 90 if (newinit > jbOffset.top) { 91 _top -= jbOffset.top; 92 var container_height = $("#wrap").height(); 93 var quick_height = $(node).height(); 94 var cul = container_height - quick_height; 95 if (_top > cul) { 96 _top = cul; 97 } 98 } else { 99 _top = 0; 100 } 101 102 $(node).stop().animate({ top: _top }, options.animate); 103 }, options.delay); 104 }); 105 }); 106 }; 107 108 $.fn.floatBanner.defaults = { 109 animate: 500, 110 delay: 500, 111 }; 112})(jQuery); 113 114/** 115 * 문ì 구ëí ìì 116 */ 117$(function () { 118 $("#banner:visible, #quick:visible").floatBanner(); 119 120 //placeholder 121 $(".xans-product-addoption .ePlaceholder input").each(function (i) { 122 var Area = $(this).parents(".ePlaceholder").siblings(".optionTit").text(); 123 $(this).attr("placeholder", Area); 124 }); 125 126 //placeholder 127 $(".ePlaceholder input, .ePlaceholder textarea").each(function (i) { 128 var placeholderName = $(this).parents().attr("title"); 129 $(this).attr("placeholder", placeholderName); 130 }); 131 132 /* placeholder ie8, ie9 */ 133 $.fn.extend({ 134 placeholder: function () { 135 //IE 8 ë²ì ìë hasPlaceholderSupport() ê°ì´ false를 ë¦¬í´ 136 if (hasPlaceholderSupport() === true) { 137 return this; 138 } 139 //hasPlaceholderSupport() ê°ì´ false ì¼ ê²½ì° ìë ì½ë를 ì¤í 140 return this.each(function () { 141 var findThis = $(this); 142 var sPlaceholder = findThis.attr("placeholder"); 143 if (!sPlaceholder) { 144 return; 145 } 146 findThis.wrap('<label class="ePlaceholder" />'); 147 var sDisplayPlaceHolder = $(this).val() ? ' style="display:none;"' : ""; 148 findThis.before("<span" + sDisplayPlaceHolder + ">" + sPlaceholder + "</span>"); 149 this.onpropertychange = function (e) { 150 e = event || e; 151 if (e.propertyName == "value") { 152 $(this).trigger("focusout"); 153 } 154 }; 155 //ê³µíµ class 156 var agent = navigator.userAgent.toLowerCase(); 157 if (agent.indexOf("msie") != -1) { 158 $(".ePlaceholder").css({ position: "relative" }); 159 $(".ePlaceholder span").css({ position: "absolute", padding: "0 4px", color: "#878787" }); 160 $(".ePlaceholder label").css({ padding: "0" }); 161 } 162 }); 163 }, 164 }); 165 166 $(":input[placeholder]").placeholder(); //placeholder() í¨ì를 í¸ì¶ 167 168 //í´ë¦íë©´ placeholder ì¨ê¹ 169 $("body").on("click", ".ePlaceholder span", function () { 170 $(this).hide(); 171 }); 172 173 //inputì°½ í¬ì»¤ì¤ ì¸ ì¼ë placeholder ì¨ê¹ 174 $("body").on("focusin", ".ePlaceholder :input", function () { 175 $(this).prev("span").hide(); 176 }); 177 178 //inputì°½ í¬ì»¤ì¤ ìì ì¼ë value ê° true ì´ë©´ ì¨ê¹, false ì´ë©´ ë³´ì¬ì§ 179 $("body").on("focusout", ".ePlaceholder :input", function () { 180 if (this.value) { 181 $(this).prev("span").hide(); 182 } else { 183 $(this).prev("span").show(); 184 } 185 }); 186 187 //inputì placeholderê° ì§ìì´ ëë©´ true를 ìëë©´ false를 리í´ê°ì¼ë¡ ëì ¸ì¤ 188 function hasPlaceholderSupport() { 189 if ("placeholder" in document.createElement("input")) { 190 return true; 191 } else { 192 return false;
193 } 194 } 195 196 // íì íì 197 $(".ec-base-product .prdList > li .icon img").each(function () { 198 var alt = $(this).attr("alt"); 199 if (alt == "íì ") { 200 $(this).parents(".ec-base-product .prdList > li").find(".soldout").show(); 201 } 202 }); 203 204 // 리ì¤í íì 205 $(".ec-base-product .prdList > li").each(function () { 206 var restock = $(this).find('.description li .title:contains("ìì½")').siblings("span").addClass("restock"); 207 var soldout = $(this).find(".soldout"); 208 restock.insertAfter(soldout).show(); 209 }); 210 211 // ë°°ëê´ë¦¬ img ë§ì°ì¤ì¤ë²ì íì´í ë ¸ì¶ ì·¨ì 212 $(".xans-bannermanage2 a img").attr("title", ""); 213 214 // ì¸ë¤ì¼ ìì´ì½ .button ì .buttonIn ì½ì 215 //$(".ec-base-product .prdList .thumbnail .button li img").wrap('<div class="buttonIn"></div>'); 216 217 // ë°ì¤ ì¤íì¼ ì¹´í ê³ ë¦¬ ì¤ ë´ê° ì íí ì¹´í ê³ ë¦¬ì seleted í´ëì¤ ì½ì í기 - company, shop 218 var li = $(".box_menu > ul > li"); 219 li.find("a").each(function (i, e) { 220 var a_link = $(this).attr("href"); 221 if (0 <= location.href.indexOf(a_link)) { 222 $(this).parent().addClass("selected"); 223 } 224 }); 225 226 // BEST ìí ë²í¸ 227 var bestLi = $(".xans-product-listrecommend > .prdList > li"); 228 bestLi.each(function (e) { 229 var no = $(this).index() + 1; 230 $(this).find(".best_cnt i").text(no); 231 }); 232 233 // NEW ìí ë²í¸ 234 var bestLi = $(".xans-product-listnew > .prdList > li"); 235 bestLi.each(function (e) { 236 var no = $(this).index() + 1; 237 $(this).find(".new_cnt i").text(no); 238 }); 239 240 // ê²ìí ë´ ì¹´í ê³ ë¦¬ select를 lië¡ ë³ê²½í기 241 /*$('.xans-board-listpackage #board_category option').each(function(i, e){ 242 var option = $(this).attr("value"); 243 $(this).wrapInner('<li><a alt='+option+'></a></li>'); 244 $('option[selected=selected]').find('li').addClass('selected'); //ë°ì¤ ì¤íì¼ ì¹´í ê³ ë¦¬ ì¤ ë´ê° ì íí ì¹´í ê³ ë¦¬ì seleted í´ëì¤ ì½ì í기 - ê²ìí 245 $(this).find('li').unwrap(); 246 $('.xans-board-listpackage .boardSort select li').unwrap(); 247 $('.box_menu > ul').css('display','inline-block'); 248 249 // ê²ìí ë´ ì¹´í ê³ ë¦¬ ë§í¬ option ê°ì ì´ì©íì¬ ë§í¬í기 250 $(".boardSort li a").click(function(){ 251 var path = $(location).attr('pathname'); 252 var search = $(location).attr('search'); 253 var i = $(this).attr("alt"); 254 var link = path + search + '&category_no=' + i; 255 $(this).attr("href",link); 256 }); 257 });*/ 258}); 259 260/** 261 * ì¸ë¤ì¼ ì´ë¯¸ì§ ìë°ì¼ê²½ì° ê¸°ë³¸ê° ì¤ì 262 */ 263$(window).on("load", function () { 264 $("img.thumb,img.ThumbImage,img.BigImage").each(function ($i, $item) { 265 var $img = new Image(); 266 $img.onerror = function () { 267 $item.src = "//img.echosting.cafe24.com/thumb/img_product_big.gif"; 268 }; 269 $img.src = this.src; 270 }); 271}); 272 273/** 274 * tooltip 275 */ 276$(".eTooltip").each(function (i) { 277 $(this).find(".btnClose").attr("tabIndex", "-1"); 278}); 279//tooltip input focus 280$(".eTooltip") 281 .find("input") 282 .on("focus", function () { 283 var targetName = returnTagetName(this); 284 targetName.siblings(".ec-base-tooltip").show(); 285 }); 286$(".eTooltip") 287 .find("input") 288 .on("focusout", function () { 289 var targetName = returnTagetName(this); 290 targetName.siblings(".ec-base-tooltip").hide(); 291 }); 292function returnTagetName(_this) { 293 var ePlacename = $(_this).parent().attr("class"); 294 var targetName; 295 if (ePlacename == "ePlaceholder") { 296 //ePlaceholder ëì 297 targetName = $(_this).parents(); 298 } else { 299 targetName = $(_this); 300 } 301 return targetName; 302} 303 304/** 305 * eTab 306 */ 307$("body").on("click", ".eTab a", function (e) { 308 // í´ë¦í li ì selected í´ëì¤ ì¶ê°, 기존 liì ìë selected í´ëì¤ë ìì . 309 var _li = $(this).parent("li").addClass("selected").siblings().removeClass("selected"), 310 _target = $(this).attr("href"), 311 _siblings = $(_target).attr("class"), 312 _arr = _siblings.split(" "), 313 _classSiblings = "." + _arr[0]; 314 315 //í´ë¦í íì í´ë¹íë ììë íì±í, 기존 ììë ë¹íì±í í¨. 316 $(_target).show().siblings(_classSiblings).hide(); 317 318 //preventDefault ë a íê·¸ ì²ë¼ í´ë¦ ì´ë²¤í¸ ì¸ì ë³ëì ë¸ë¼ì°ì íëì ë§ê¸° ìí´ ì¬ì©ë¨. 319 e.preventDefault(); 320}); 321 322//window popup script 323function winPop(url) {
324 window.open(url, "popup", "width=300,height=300,left=10,top=10,resizable=no,scrollbars=no"); 325} 326/** 327 * document.location.href split 328 * return array Param 329 */ 330function getQueryString(sKey) 331{ 332 var sQueryString = document.location.search.substring(1); 333 var aParam = {}; 334 335 if (sQueryString) { 336 var aFields = sQueryString.split("&"); 337 var aField = []; 338 for (var i=0; i<aFields.length; i++) { 339 aField = aFields[i].split('='); 340 aParam[aField[0]] = aField[1]; 341 } 342 } 343 344 aParam.page = aParam.page ? aParam.page : 1; 345 return sKey ? aParam[sKey] : aParam; 346}; 347 348$(function(){ 349 // tab 350 $.eTab = function(ul){ 351 $(ul).find('a').on('click', function(){ 352 var _li = $(this).parent('li').addClass('selected').siblings().removeClass('selected'), 353 _target = $(this).attr('href'), 354 _siblings = '.' + $(_target).attr('class'); 355 $(_target).show().siblings(_siblings).hide(); 356 return false 357 }); 358 } 359 if ( window.call_eTab ) { 360 call_eTab(); 361 }; 362}); 363(function($){ 364 $.fn.extend({ 365 center: function() { 366 this.each(function() { 367 var 368 $this = $(this), 369 $w = $(window); 370 $this.css({ 371 position: "absolute", 372 top: ~~(($w.height() - $this.outerHeight()) / 2) + $w.scrollTop() + "px", 373 left: ~~(($w.width() - $this.outerWidth()) / 2) + $w.scrollLeft() + "px" 374 }); 375 }); 376 return this; 377 } 378 }); 379 $(function() { 380 var $container = function(){/* 381 <div id="modalContainer"> 382 <iframe id="modalContent" scroll="0" scrolling="no" frameBorder="0"></iframe> 383 </div>'); 384 */}.toString().slice(14,-3); 385 $('body') 386 .append($('<div id="modalBackpanel"></div>')) 387 .append($($container)); 388 function closeModal () { 389 $('#modalContainer').hide(); 390 $('#modalBackpanel').hide(); 391 } 392 $('#modalBackpanel').on('click',closeModal); 393 zoom = function ($piProductNo, $piCategoryNo, $piDisplayGroup) { 394 var $url = '/product/image_zoom.html?product_no=' + $piProductNo + '&cate_no=' + $piCategoryNo + '&display_group=' + $piDisplayGroup; 395 $('#modalContent').attr('src', $url); 396 $('#modalContent').on("load",function(){ 397 $(".header .close",this.contentWindow.document.body).on("click", closeModal); 398 }); 399 $('#modalBackpanel').css({width:$("body").width(),height:$("body").height(),opacity:.4}).show(); 400 $('#modalContainer').center().show(); 401 } 402 }); 403})(jQuery); 404const initFullHeight = () => { 405 const onResize = () => { 406 let vh = window.innerHeight * 0.01; 407 document.documentElement.style.setProperty("--vh", `${vh}px`); 408 }; 409 window.addEventListener("resize", onResize); 410 411 onResize(); 412}; 413 414initFullHeight(); 415 416const layoutInit = () => { 417 // â field 418 const wrapDom = document.querySelector("#wrap"); 419 420 // â check path for padding top on wrap 421 const lists = [ 422 "/board/notice", 423 "/board/event", 424 "/board/review", 425 "/myshop", 426 "/order/", 427 "/member/", 428 "/product/search", 429 "/shopinfo/company", 430 "/article/", 431 "/product/recent_view_product", 432 "/shopinfo/stores.html", 433 "/shopinfo/stockist.html", 434 "/shop1/front/php/", 435 ]; 436 const path = window.location.pathname; 437 const check = lists.some((t) => path.includes(t)); 438 439 if (check) { 440 wrapDom.classList.add("withPadding"); 441 } 442 wrapDom.classList.add("active"); 443}; 444 445layoutInit(); 446 447$(document).ready(function(){ 448 if (typeof(EC_SHOP_MULTISHOP_SHIPPING) != "undefined") { 449 var sShippingCountryCode4Cookie = 'shippingCountryCode'; 450 var bShippingCountryProc = false; 451 452 // ë°°ì¡êµê° ì í ì¤ì ì´ ì¬ì©ìí¨ì´ë©´ ì¨ê¹ 453 if (EC_SHOP_MULTISHOP_SHIPPING.bMultishopShippingCountrySelection === false) { 454 $('.xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist').hide(); 455 $('.xans-layout-multishoplist .xans-layout-multishoplistmultioption .xans-layout-multishoplistmultioptioncountry').hide(); 456 } else { 457 $('.thumb .xans-layout-multishoplistitem').hide(); 458 var aShippingCountryCode = document.cookie.match('(^|;) ?'+sShippingCountryCode4Cookie+'=([^;]*)(;|$)'); 459 if (typeof(aShippingCountryCode) != 'undefined' && aS
459hippingCountryCode != null && aShippingCountryCode.length > 2) { 460 var sShippingCountryValue = aShippingCountryCode[2]; 461 } 462 463 // query stringì¼ë¡ ëì´ ì¨ ë°°ì¡êµê° ê°ì´ ìë¤ë©´, ê·¸ ê°ì ì ì©í¨ 464 var aHrefCountryValue = decodeURIComponent(location.href).split("/?country="); 465 466 if (aHrefCountryValue.length == 2) { 467 var sShippingCountryValue = aHrefCountryValue[1]; 468 } 469 470 // ë©ì¸ íì´ì§ìì êµê°ì íì ìí ê²½ì°, ê·¸ ì¸ì íì´ì§ìì ì í ë ê°ì´ ì ëì¤ë íì ì²ë¦¬ 471 if (location.href.split("/").length != 4 && $(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist").val()) { 472 $(".xans-layout-multishoplist .xans-layout-multishoplistmultioption a .ship span").text(" : "+$(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist option:selected").text().split("SHIPPING TO : ").join("")); 473 474 if ($("#f_country").length > 0 && location.href.indexOf("orderform.html") > -1) { 475 $("#f_country").val($(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist").val()); 476 } 477 } 478 if (typeof(sShippingCountryValue) != "undefined" && sShippingCountryValue != "" && sShippingCountryValue != null) { 479 sShippingCountryValue = sShippingCountryValue.split("#")[0]; 480 var bShippingCountryProc = true; 481 482 $(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist").val(sShippingCountryValue); 483 $(".xans-layout-multishoplist .xans-layout-multishoplistmultioption a .ship span").text(" : "+$(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist option:selected").text().split("SHIPPING TO : ").join("")); 484 var expires = new Date(); 485 expires.setTime(expires.getTime() + (30 * 24 * 60 * 60 * 1000)); // 30ì¼ê° ì¿ í¤ ì ì§ 486 document.cookie = sShippingCountryCode4Cookie+'=' + $(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist").val() +';path=/'+ ';expires=' + expires.toUTCString(); 487 if ($("#f_country").length > 0 && location.href.indexOf("orderform.html") > -1) { 488 $("#f_country").val(sShippingCountryValue).change();; 489 } 490 } 491 } 492 // ì¸ì´ì í ì¤ì ì´ ì¬ì©ìí¨ì´ë©´ ì¨ê¹ 493 if (EC_SHOP_MULTISHOP_SHIPPING.bMultishopShippingLanguageSelection === false) { 494 $('.xans-layout-multishopshipping .xans-layout-multishopshippinglanguagelist').hide(); 495 $('.xans-layout-multishoplist .xans-layout-multishoplistmultioption .xans-layout-multishoplistmultioptionlanguage').hide(); 496 } else { 497 $('.thumb .xans-layout-multishoplistitem').hide(); 498 } 499 500 // ë°°ì¡êµê° ë° ì¸ì´ ì¤ì ì´ ë ë¤ ì¬ì©ìí¨ì´ë©´ ì¨ê¹ 501 if (EC_SHOP_MULTISHOP_SHIPPING.bMultishopShipping === false) { 502 $(".xans-layout-multishopshipping").hide(); 503 $('.xans-layout-multishoplist .xans-layout-multishoplistmultioption').hide(); 504 } else if (bShippingCountryProc === false && location.href.split("/").length == 4) { // ë°°ì¡êµê° ê°ì ì²ë¦¬í ì ì´ ìê³ , ë©ì¸íë©´ì¼ ëë§ ì í ë ì´ì´ë¥¼ ëì 505 var sShippingCountryValue = $(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist").val(); 506 $(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist").val(sShippingCountryValue); 507 $(".xans-layout-multishoplist .xans-layout-multishoplistmultioption a .ship span").text(" : "+$(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist option:selected").text().split("SHIPPING TO : ").join("")); 508 // ë°°ì¡êµê° ì íì ì¬ì©í´ì¼ ë ì´ì´ë¥¼ ë³´ì´ê² í¨ 509 if (EC_SHOP_MULTISHOP_SHIPPING.bMultishopShippingCountrySelection === true) { 510 $(".xans-layout-multishopshipping").show(); 511 } 512 } 513 514 $(".xans-layout-multishopshipping .close").bind("click", function() { 515 $(".xans-layout-multishopshipping").hide(); 516 }); 517 518 $(".xans-layout-multishopshipping .ec-base-button a").bind("click", function() { 519 var expires = new Date(); 520 expires.setTime(expires.getTime() + (30 * 24 * 60 * 60 * 1000)); // 30ì¼ê° ì¿ í¤ ì ì§ 521 document.cookie = sShippingCountryCode4Cookie+'=' + $(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist").val() +';path=/'+ ';expires=' + expires.toUTCString(); 522 523 // ëë©ì¸ 문ì ë¡ ì¿ í¤ë¡ ë°°ì¡êµê° ì¤ì ì´ ì ëë ê²½ì°ë¥¼ ìí´ query stringì¼ë¡ ë°°ì¡êµê° ê°
523ì ëê¹ 524 var sQuerySting = (EC_SHOP_MULTISHOP_SHIPPING.bMultishopShippingCountrySelection === false) ? "" : "/?country="+encodeURIComponent($(".xans-layout-multishopshipping .xans-layout-multishopshippingcountrylist").val()); 525 526 location.href = '//'+$(".xans-layout-multishopshipping .xans-layout-multishopshippinglanguagelist").val()+sQuerySting; 527 }); 528 $(".xans-layout-multishoplist .xans-layout-multishoplistmultioption a").bind("click", function() { 529 $(".xans-layout-multishopshipping").show(); 530 }); 531 } 532}); 533const checkPathInit = () => { 534 const header = document.querySelector("#header.header-desktop"); 535 const path = window.location.pathname.replace(/^\/skin-skin\d+/, "") || "/"; 536 const checkIsHome = path === "/" || path === "/index.html"; 537 if (checkIsHome) { 538 header.classList.add("home"); 539 } else { 540 header.classList.remove("home"); 541 } 542}; 543 544checkPathInit(); 545const drawCategoryInit = () => { 546 const parents = document.querySelector("#header.header-desktop .header-category-left").querySelectorAll("li"); 547 548 const getCategoryCodeFromLiTag = (liTag) => { 549 const splitArr = liTag 550 .querySelector("a") 551 .href.split("/") 552 .filter((t) => t !== ""); 553 return Number(splitArr[splitArr.length - 1]); 554 }; 555 556 const parentsCode = Array.from(parents).map((el) => { 557 return getCategoryCodeFromLiTag(el); 558 }); 559 let subCategoryObj = {}; 560 561 // METHOD 562 const genSubCategoryTag = (href, text, className) => { 563 const liTag = document.createElement("li"); 564 if (className) { 565 liTag.classList.add(className); 566 } 567 const aTag = document.createElement("a"); 568 aTag.setAttribute("href", href); 569 aTag.innerText = text; 570 liTag.appendChild(aTag); 571 return liTag; 572 }; 573 574 const get = () => { 575 $.ajax({ 576 url: "/exec/front/Product/SubCategory", 577 dataType: "json", 578 success: function (aData) { 579 if (aData == null || aData == "undefined") return; 580 581 const depthCategories = []; 582 // : filter sub category data 583 aData 584 // .sort((a, b) => a.cate_no - b.cate_no) 585 .forEach((d) => { 586 if (parentsCode.includes(d.parent_cate_no)) { 587 subCategoryObj = { ...subCategoryObj, [d.parent_cate_no]: subCategoryObj[d.parent_cate_no] ? [...subCategoryObj[d.parent_cate_no], d] : [d] }; 588 } 589 depthCategories.push(d); 590 }); 591 592 // second depth 593 depthCategories.forEach((d) => { 594 Object.keys(subCategoryObj).forEach((code) => { 595 const checkInclude = subCategoryObj[code].find((menu) => menu.cate_no === d.parent_cate_no); 596 if (!checkInclude) return; 597 598 subCategoryObj = { 599 ...subCategoryObj, 600 [code]: subCategoryObj[code].map((menu) => 601 menu.cate_no === d.parent_cate_no 602 ? { 603 ...menu, 604 children: menu.children ? [...menu.children, d] : [d], 605 } 606 : menu 607 ), 608 }; 609 }); 610 }); 611 612 // : draw sub on desktop 613 parents.forEach((el) => { 614 const code = getCategoryCodeFromLiTag(el); 615 616 if (!subCategoryObj[code] || !subCategoryObj[code].length) return; 617 const subDatas = subCategoryObj[code]; 618 619 const subDiv = document.createElement("div"); 620 subDiv.classList.add("sub-category-left"); 621 subDiv.classList.add("sub-category"); 622 623 const ulTag = document.createElement("ul"); 624 subDiv.appendChild(ulTag); 625 626 subDatas.forEach((d) => { 627 const liTag = genSubCategoryTag(d.link_product_list, d.name); 628 if (d.children) { 629 const secondUl = document.createElement("ul"); 630 secondUl.classList.add("second-category"); 631 d.children.forEach((secondMenu) => { 632 const secondLi = genSubCategoryTag(secondMenu.link_product_list, secondMenu.name); 633 secondUl.appendChild(secondLi); 634 }); 635 liTag.appendChild(secondUl); 636 } 637 638 ulTag.appendChild(liTag); 639 }); 640 641 el.appendChild(subDiv); 642 }); 643 644 // : draw sub on mobile 645 const filtedData = Array.from(parents).reduce((prev, current) => { 646 const code = getCategoryCodeFromLiTag(current); 647 const title = current.querySelector("a").innerText; 648 let children = subCategoryObj[code]; 649 if (current.classList.contains("collection")) { 650 const liTags = current.querySelectorAll("ul li"); 651 children = Array.from(liTags).map((el) => { 652 const aTag = el.querySelector("a"); 653 return { 654 name: aTag.innerText, 655 link_product_list: aTag.getAttribute("href"), 656 }; 657 }); 658 } 659 660 prev.push({ 661 code, 662 title, 663 children, 664 }); 665 return prev; 666 }, []); 667 668 headerMobile(filtedData); 669 }, 670 }); 671 }; 672 673 get(); 674}; 675
676drawCategoryInit(); 677 678const scrollAnimationInit = () => { 679 // Field 680 const header = document.querySelector("#header.header-desktop"); 681 const scrolledClassName = "scrolled"; 682 const hideClassName = "hide"; 683 let lastScrollTop = 0; 684 685 // METHOD 686 // : Set window scroll event 687 window.addEventListener("scroll", () => { 688 // â check scroll position 689 if (window.scrollY > 0) { 690 addScrolled(); 691 } else { 692 removeScrolled(); 693 } 694 695 // â check scroll direction 696 const st = window.pageYOffset || document.documentElement.scrollTop; 697 if (st > lastScrollTop) { 698 hideHeader(); 699 } else if (st < lastScrollTop) { 700 activeHeader(); 701 } 702 lastScrollTop = st <= 0 ? 0 : st; // For Mobile or negative scrolling 703 }); 704 705 // add header logo class [scrolled] 706 const addScrolled = () => { 707 header.classList.add(scrolledClassName); 708 }; 709 710 // remove header logo class [scrolled] 711 const removeScrolled = () => { 712 header.classList.remove(scrolledClassName); 713 }; 714 715 const hideHeader = () => { 716 header.classList.add(hideClassName); 717 }; 718 719 const activeHeader = () => { 720 header.classList.remove(hideClassName); 721 }; 722}; 723 724scrollAnimationInit(); 725 726const categoryInit = () => { 727 // FIELD 728 const header = document.querySelector("#header.header-desktop"); 729 const categories = header.querySelectorAll(".categories>li"); 730 const subCategoryBg = header.querySelector(".sub-category-bg"); 731 const classNameOn = "on"; 732 const classOpen = "open"; 733 734 // â add mouse hover event on right categories 735 categories.forEach((el, index) => { 736 el.addEventListener("mouseenter", () => { 737 categories.forEach((sub, subIndex) => (subIndex === index ? sub.classList.add(classNameOn) : sub.classList.remove(classNameOn))); 738 }); 739 }); 740 741 // â on mouse leave on sub category area 742 subCategoryBg.addEventListener("mouseout", () => { 743 categories.forEach((sub) => sub.classList.remove(classNameOn)); 744 }); 745 746 // â detect class changed 747 categories.forEach((el) => { 748 var observer = new MutationObserver(function (event) { 749 const checkOn = Array.from(categories).find((element) => element.classList.contains(classNameOn)); 750 if (!checkOn) { 751 setSubCategoryBgHeight(0); 752 header.classList.remove(classOpen); 753 return; 754 } 755 756 // â if class on, add background 757 const subCategoryEl = checkOn.querySelector("ul"); 758 const bgHeight = subCategoryEl?.clientHeight ?? 0; 759 setSubCategoryBgHeight(bgHeight); 760 if (!header.classList.contains(classOpen)) { 761 header.classList.add(classOpen); 762 } 763 }); 764 765 observer.observe(el, { 766 attributes: true, 767 attributeOldValue: false, 768 attributeFilter: ["class"], 769 childList: false, 770 characterData: false, 771 }); 772 }); 773 774 // METHOD 775 const setSubCategoryBgHeight = (height) => { 776 subCategoryBg.style.height = `${height}px`; 777 }; 778}; 779 780categoryInit(); 781 782// ð Check menu name here! : start 783const DATA_MENU_COLLECTION = ["FALL WINTER 2026 MEN COLLECTION", "FALL WINTER 2026 WOMEN COLLECTION", "RESORT 2026 MEN COLLECTION", "RESORT 2026 WOMEN COLLECTION","SPRING 2026 MEN COLLECTION", "SPRING 2026 WOMEN COLLECTION"]; 784const DATA_MENU_CAMPAIGN = ["FALL WINTER 2026 CAMPAIGN", "SPRING 2026 CAMPAIGN", "KALEG X TONYWACK"]; 785// ð Check menu name here! : end 786 787const setCollectionMenu = (name, ulTag, baseUrl, className) => { 788 const path = name.toLowerCase().replaceAll(" ", "_"); 789 const liTag = document.createElement("li"); 790 const aTag = document.createElement("a"); 791 aTag.innerHTML = name; 792 aTag.setAttribute("href", `${baseUrl}?type=${path}`); 793 liTag.appendChild(aTag); 794 liTag.classList.add(path); 795 if (className) { 796 liTag.classList.add(className); 797 }
798 ulTag.appendChild(liTag); 799}; 800 801const collectionInit = () => { 802 const menu = document.querySelector(".header-category .collection"); 803 const ulTag = menu.querySelector("ul"); 804 const templateLi = ulTag.querySelector("li"); 805 const aTag = templateLi.querySelector("a"); 806 const href = aTag.getAttribute("href"); 807 808 DATA_MENU_COLLECTION.forEach((name, index) => { 809 setCollectionMenu(name, ulTag, `${href === "/" ? "" : href}/collection`, `collection-${index + 1}`); 810 }); 811 812 DATA_MENU_CAMPAIGN.forEach((name, index) => { 813 setCollectionMenu(name, ulTag, `${href === "/" ? "" : href}/campaign`, `campaign-${index + 1}`); 814 }); 815 816 templateLi.remove(); 817}; 818 819collectionInit(); 820 821// FW 2026 컬ë ì (MEN/WOMEN)ë§ 5ì´ ì²ë¦¬ 822(function () { 823 var type = new URLSearchParams(window.location.search).get("type") || ""; 824 type = decodeURIComponent(type); 825 if (type.indexOf("fall_winter_2026") !== -1) { 826 document.body.classList.add("collection-fw2026"); 827 } 828})(); 829 830const headerMobile = (data) => { 831 data.forEach((category, index) => { 832 // â draw sub screens 833 if (!category.children) return; 834 drawMobileCategoryScreen(category.title, category.children, index === data.length - 1); 835 }); 836 837 // â add events : menu 838 addMobileHeaderEvents(); 839 840 // â add events : backbutton 841 addBackBtnEvent(); 842 843 // â parse category men, women, kaleg x tonywack 844 parseCategoryLink(); 845}; 846 847const drawMobileCategoryScreen = (title, subCategoryArr, isEnd) => { 848 // get template 849 const menuLists = document.querySelector("#header .header-mobile-menu-lists"); 850 const template = document.querySelector("#header .header-mobile-template"); 851 if (!menuLists || !template) return; // ììê° ìì ê²½ì° ìì¸ ì²ë¦¬ 852 853 const cloned = template.cloneNode(true); 854 855 // change data 856 cloned.classList.remove("header-mobile-template"); 857 cloned.dataset.targetScreen = title.toLowerCase(); 858 // : title 859 cloned.querySelector(".header-mobile-subcategory-title").innerHTML = title; 860 861 // : contents 862 const categoryWrapper = cloned.querySelector(".header-mobile-menu-group.category"); 863 let groupName = ""; 864 subCategoryArr.forEach((el, index) => { 865 const liTag = document.createElement("li"); 866 867 // if category is collection or campaign 868 if (el.link_product_list && el.link_product_list.includes("?")) { 869 const base = el.link_product_list.split("?")[0]; 870 const categoryName = base.split("/")[2]; 871 if (groupName !== categoryName) { 872 if (groupName !== "") { 873 liTag.classList.add(`group-top`); 874 } 875 groupName = categoryName; 876 } 877 } 878 879 const aTag = document.createElement("a"); 880 aTag.innerHTML = el.name; 881 aTag.setAttribute("href", el.link_product_list); 882 liTag.appendChild(aTag); 883 categoryWrapper.appendChild(liTag); 884 885 if (el.children) { 886 aTag.addEventListener("click", (e) => { 887 e.preventDefault(); 888 889 const secondUl = liTag.querySelector(".second-category"); 890 const isOpen = secondUl.classList.contains("active"); 891 892 // ë¤ë¥¸ ì´ë¦° ë©ë´ 모ë ë«ê¸° 893 const allSeconds = categoryWrapper.querySelectorAll(".second-category.active"); 894 allSeconds.forEach((s) => s.classList.remove("active")); 895 896 // í ê¸ 897 if (!isOpen) { 898 secondUl.classList.add("active"); 899 } 900 }); 901 902 const secondUl = document.createElement("ul"); 903 secondUl.classList.add("second-category"); 904 liTag.appendChild(secondUl); 905 906 el.children.forEach((menu) => { 907 const secondLi = document.createElement("li"); 908 const aTag = document.createElement("a"); 909 aTag.innerHTML = menu.name; 910 aTag.setAttribute("href", menu.link_product_list); 911 secondLi.appendChild(aTag); 912 secondUl.appendChild(secondLi); 913 }); 914 } 915 }); 916 917 // add 918 menuLists.appendChild(cloned); 919 920 // remove template 921 if (isEnd) { 922 template.remove(); 923 } 924}; 925 926const addMobileHeaderEvents = () => { 927 // add button 928 const btns = document.querySelectorAll(".header-mobile-btn"); 929 930 btns.forEach((btn) => 931 btn.addEventListener("click", () => { 932 moveToSubSCreen(btn.dataset.target); 933 }) 934 ); 935}; 936 937const moveToSubSCreen = (target) => { 938 const menuScreens = document.querySelectorAll("#header.header-mobile .header-mobile-menu"); 939 const targetScreen = Array.from(menuScreens).find((el) => { 940 return el.dataset.targetScreen === target; 941 });
942 if (targetScreen) { 943 targetScreen.classList.add("active"); 944 } 945}; 946 947const addBackBtnEvent = () => { 948 const menuLists = document.querySelector("#header .header-mobile-menu-lists").querySelectorAll(".header-mobile-menu"); 949 menuLists.forEach((el) => { 950 const backBtn = el.querySelector(".header-mobile-menu-top button"); 951 if (backBtn) { 952 backBtn.addEventListener("click", () => el.classList.remove("active")); 953 } 954 }); 955}; 956 957const parseCategoryLink = () => { 958 const screenMenu = document.querySelector("#header.header-mobile .header-mobile-menu.menu"); 959 if (!screenMenu) return; 960 961 const category = screenMenu.querySelector("#category"); 962 if (!category) return; 963 964 const categoryList = category.querySelectorAll(".header-mobile-category-name"); 965 966 categoryList.forEach((el) => { 967 const name = el.innerText ? el.innerText.trim() : ""; 968 if (!name) return; // í ì¤í¸ê° ë¹ì´ìì¼ë©´ í¨ì¤ 969 970 // íì íë©´ì´ ìë ê²½ì°ë§ ë²í¼ì¼ë¡ ë³í 971 const menuScreens = document.querySelectorAll("#header.header-mobile .header-mobile-menu"); 972 const targetScreen = Array.from(menuScreens).find((screen) => { 973 return screen.dataset.targetScreen === name.toLowerCase(); 974 }); 975 976 if (!targetScreen) return; // íì íë©´ ìì¼ë©´ ìë ë§í¬ ì ì§ 977 978 const btn = document.createElement("button"); 979 btn.type = "button"; 980 btn.innerHTML = name; 981 btn.addEventListener("click", () => { 982 moveToSubSCreen(name.toLowerCase()); 983 }); 984 el.innerHTML = ""; 985 el.appendChild(btn); 986 }); 987 988 // ================================================================= 989 // ⨠[ìë²½ í´ê²°] LOGIN, CHECK ORDER ìë 그룹ì COMMUNITY ëë¡ë¤ì´ 주ì 990 // ================================================================= 991 // ì¬ì´ëë° ë´ìì ë©ë´ 그룹(ul) 리ì¤í¸ë¥¼ ì ë¶ ì°¾ìµëë¤. 992 const subMenuGroups = screenMenu.querySelectorAll(".header-mobile-menu-group"); 993 994 // LOGIN, CHECK ORDER í목ë¤ì´ ëª¨ì¬ ìë ë ë²ì§¸ ê·¸ë£¹ì´ ì ìì ì¼ë¡ ì¡´ì¬í ëë§ ì¤í 995 if (subMenuGroups.length > 1) { 996 const targetGroup = subMenuGroups[1]; // ë ë²ì§¸ ë©ë´ 그룹 (íë¨ ìì) 997 998 if (!targetGroup.querySelector('.custom-community-dropdown')) { 999 const communityLi = document.createElement("li"); 1000 // ëìì¸ ëì¼ì±ì íë³´í기 ìí´ ì¤í¨ ê³ ì ëë©ë´ í´ëì¤ ë§¤ì¹ 1001 communityLi.classList.add("header-mobile-category-name", "custom-community-dropdown"); 1002 communityLi.style.position = "relative"; 1003 communityLi.style.width = "100%"; 1004 1005 // 1. 모ë°ì¼ìì í°ì¹í ê°ë¡ ëë©ë´ ë²í¼ (COMMUNITY) 1006 const toggleBtn = document.createElement("button"); 1007 toggleBtn.type = "button"; 1008 toggleBtn.innerHTML = "COMMUNITY"; 1009 toggleBtn.style.width = "100%"; 1010 toggleBtn.style.textAlign = "left"; 1011 toggleBtn.style.display = "block"; 1012 toggleBtn.style.background = "none"; 1013 toggleBtn.style.border = "none"; 1014 toggleBtn.style.padding = "initial"; 1015 toggleBtn.style.font = "inherit"; 1016 toggleBtn.style.color = "inherit"; 1017 toggleBtn.style.cursor = "pointer"; 1018 1019 // 2. ë²í¼ í´ë¦ ì ìëë¡ ì´ë¦´ ëë¡ë¤ì´ ìë¸ ë©ë´ 컨í ì´ë(ul) 1020 const dropdownUl = document.createElement("ul"); 1021 dropdownUl.classList.add("second-category"); // ì¤í¨ ìë¸ ì¹´í ê³ ë¦¬ í´ëì¤ ë§¤ì¹ 1022 dropdownUl.style.display = "none"; // ì´ê¸° ìíë ì¨ê¹ 1023 dropdownUl.style.paddingLeft = "15px"; 1024 dropdownUl.style.marginTop = "10px"; 1025 1026 // 3. ì°ëí ì§ì§ ê²ìí ë°ì´í° ì¤ì (ì´ë민 ë²í¸ ì¸í ë°ì) 1027 const boards = [ 1028 { name: "NOTICE", link: "/board/free/list.html?board_no=2" }, 1029 { name: "EVENT", link: "/board/free/list.html?board_no=3001" }, 1030 { name: "REVIEW", link: "/board/product/list.html?board_no=4" } 1031 ]; 1032 1033 // 4. ìë¸ ë¦¬ì¤í¸ íê·¸ ìì± ë° ì¨í ê²ìì ì¤íì¼ ìì± ê°ì ë¶ì¬ 1034 boards.forEach(board => { 1035 const li = document.createElement("li"); 1036 li.style.margin = "12px 0"; // 모ë°ì¼ í°ì¹ ë¯¸ì¤ ë°©ì§ë¥¼ ìí ìí ê°ê²© ë³´ì 1037 1038 const a = document.createElement("a"); 1039 a.innerHTML = board.name; 1040 a.setAttribute("href", board.link); 1041 1042 // í리ë©í íê² ì£½ì´ ë³´ì´ë í¬ëª ë ê·ì¹ì í´ì íê³ ì ëª í ë¸ëì¼ë¡ ê°ì ê³ ì 1043 a.style.fontSize = "11px"; 1044 a.style.color = "#000000"; // ë¦¬ì¼ ë¸ë ì»¬ë¬ 1045 a.style.opacity = "1"; // í¬ëª ë 100% ì ëª íê² 1046 a.style.fontWeight = "500"; // ëí°í êµµê¸°ê° ì§ì 1047 1048 li.appendChild(a); 1049 dropdownUl.appendChild(li); 1050 }); 1051 1052 // 5. COMMUNITY ë²í¼ í´ë¦ ì ëë¡ë¤ì´ í ê¸ ì´ë²¤í¸ ë°ì¸ë© 1053 toggleBtn.addEventListener("click", (e) => { 1054 e.preventDefault(); 1055 const isHidden = dropdownUl.style.display === "none"; 1056 dropdownUl.style.display = isHidden ? "block" : "none"; 1057 toggleBtn.classList.toggle("active", isHidden); 1058 }); 1059 1060 // 6. ìì ìµì¢ 조립 í íë¨ ë ë²ì§¸ 그룹(targetGroup) 맨 ë°ì ì¥ì°© 1061 communityLi.appendChild(toggleBtn); 1062 communityLi.appendChild(dropdownUl); 1063 targetGroup.appendChild(communityLi); 1064 } 1065 } 1066};
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.