1$(window).scroll(function() 2{ 3 if ($(window).scrollTop() > 0) 4 { 5 $('body').addClass('header-sticky'); 6 } 7 else 8 { 9 $('body').removeClass('header-sticky'); 10 } 11}); 12 13 14$(function() 15{ 16 wCompare.init() 17 18 if (wEnv.apiUrl != "https://api.winix.com") { 19 const devAlert = ` 20 <div style="background-color:#ff4d4f;color:#fff;text-align:center;font-size:14px;padding:10px 0;font-weight:bold;z-index:9999;position:relative;"> 21 â ï¸ íì¬ ê°ë° ìë²ì ëë¤ (${window.location.hostname}) 22 </div> 23 `; 24 $('body').prepend(devAlert); 25 } 26 27 $(".header-gnb__depth1 > a").click(function(){ 28 let trackingData = { 29 menu: $(this).text(), 30 url: $(this).attr("href"), 31 } 32 wTracking.clickGnbMenu(trackingData) 33 }) 34 35 $(".header-gnb__depth2 a, .header-snb .header-snb__bot a").click(function(){ 36 let trackingData = { 37 menu: $(this).text(), 38 url: $(this).attr("href"), 39 } 40 // alert(trackingData.menu); 41 wTracking.clickMenu(trackingData) 42 }) 43 44 $("body") 45 .on("click", ".common-popup__bg", function(){ 46 wCommon.undoFixBody() 47 }) 48 // ë¶ë§í¬ ë²í¼ ì²ë¦¬ ì´ë²¤í¸ 49 .on("click", ".js-btn-scrap", function(){ 50 if($(this).hasClass("bookmark-on")) { 51 wScrap.remove($(this)) 52 }else{ 53 wScrap.add($(this)) 54 } 55 }) 56 .on("click", ".js-btn-compare", function(){ 57 wCompare.open($(this)); 58 }) 59 .on("click", ".js-btn-recent-keyword", function(){ 60 const searchText = $(this).text() 61 wSearch.search(searchText) 62 }) 63 .on("click", ".js-btn-remove-recent-keyword", function(){ 64 wSearch.removeRecentKeyword($(this).data("idx")) 65 }) 66 .on("click",".js-btn-clear-recent-keyword", function(){ 67 wSearch.clearRecentKeyword() 68 }) 69 .on("click", ".js-pop-btn-search-submit", function(){ 70 const searchText = $("input.js-pop-search-text").val() 71 if(searchText.length < 1){ 72 wToast.open("ê²ìì´ë¥¼ ì ë ¥í´ ì£¼ì¸ì.") 73 }else{ 74 wSearch.search(searchText) 75 } 76 }) 77 .on("keyup", ".js-pop-search-text", function(e){ 78 if(e.keyCode == 13){ 79 const searchText = $("input.js-pop-search-text").val() 80 if(searchText.length < 1){ 81 wToast.open("ê²ìì´ë¥¼ ì ë ¥í´ ì£¼ì¸ì.") 82 }else{ 83 wSearch.search(searchText) 84 } 85 } 86 }) 87 .on("click", ".common-popup-close__btn", function(){ 88 wCommon.undoFixBody() 89 }) 90 91 $(".js-btn-search").on("click", function(){ 92 wSearch.open() 93 }) 94 95 96 //ì¤í¬ë¡¤ ì ìë¨ 97 $(".js-scroll-top").on("click", function() 98 { 99 $("html, body").animate( 100 { 101 scrollTop: 0 102 }, 500); 103 }); 104 //문ìíì ì¹ì í¼ì¹ê¸° 105 $(".js-toggle-request").on("click", function() 106 { 107 var parentElement = $(this).closest(".floating-inner__request"); 108 parentElement.toggleClass("floating-request-on"); 109 if (parentElement.hasClass("floating-request-on")) 110 { 111 parentElement.find(".floating-inner__depth_wrap").slideDown(); 112 } 113 else 114 { 115 parentElement.find(".floating-inner__depth_wrap").slideUp(); 116 } 117 }) 118 $(".js-msg-close").on("click", function() 119 { 120 var parentElement = $(this).closest(".floating-inner__msg"); 121 parentElement.animate( 122 { 123 opacity: 'toggle' 124 }, 500); 125 }); 126 127 // sessionStorage.removeItem("tooltipWattup"); 128 // sessionStorage.removeItem("tooltipMoos"); 129 // sessionStorage.removeItem("tooltipRegister"); 130 // sessionStorage.removeItem("tooltipProduct"); 131 132 const tooltips = [ 133 { className: "js-tooltip-wattup", storageKey: "tooltipWattup" }, 134 { className: "js-tooltip-moos", storageKey: "tooltipMoos" }, 135 { className: "js-tooltip-register", storageKey: "tooltipRegister" }, 136 { className: "js-tooltip-product", storageKey: "tooltipProduct" } 137 ]; 138 const availableTooltips = tooltips.filter(tip => { 139 return !sessionStorage.getItem(tip.storageKey) && $("." + tip.className).length > 0;
140 }); 141 142 if (availableTooltips.length > 0) { 143 const randomIndex = Math.floor(Math.random() * availableTooltips.length); 144 const selectedTip = availableTooltips[randomIndex]; 145 const $tooltip = $("." + selectedTip.className); 146 147 $tooltip.addClass("is-active"); 148 149 $tooltip.find("button").on("click", function(e) { 150 e.preventDefault(); 151 e.stopPropagation(); 152 sessionStorage.setItem(selectedTip.storageKey, "hide"); 153 $tooltip.removeClass("is-active"); 154 }); 155 } 156 157 // const storageTooltipWattup = sessionStorage.getItem("tooltipWattup"); 158 // if(!storageTooltipWattup) { 159 // $(".js-tooltip-wattup").addClass("is-active") 160 // $(".js-tooltip-wattup button").click(function(e){ 161 // e.preventDefault(); 162 // e.stopPropagation(); 163 // sessionStorage.setItem("tooltipWattup", "hide"); 164 // $(".js-tooltip-wattup").removeClass("is-active") 165 // }) 166 // } 167 // const storageTooltipMoos = sessionStorage.getItem("tooltipMoos"); 168 // if(!storageTooltipMoos) { 169 // $(".js-tooltip-moos").addClass("is-active") 170 // $(".js-tooltip-moos button").click(function(e){ 171 // e.preventDefault(); 172 // e.stopPropagation(); 173 // sessionStorage.setItem("tooltipMoos", "hide"); 174 // $(".js-tooltip-moos").removeClass("is-active") 175 // }) 176 // } 177 // const storageTooltipRegister = sessionStorage.getItem("tooltipRegister"); 178 // if(!storageTooltipRegister) { 179 // $(".js-tooltip-register").addClass("is-active") 180 // $(".js-tooltip-register button").click(function(e){ 181 // e.preventDefault(); 182 // e.stopPropagation(); 183 // sessionStorage.setItem("tooltipRegister", "hide"); 184 // $(".js-tooltip-register").removeClass("is-active") 185 // }) 186 // } 187 // const storageTooltipProduct = sessionStorage.getItem("tooltipProduct"); 188 // if(!storageTooltipProduct) { 189 // $(".js-tooltip-product").addClass("is-active") 190 // $(".js-tooltip-product button").click(function(e){ 191 // e.preventDefault(); 192 // e.stopPropagation(); 193 // sessionStorage.setItem("tooltipProduct", "hide"); 194 // $(".js-tooltip-product").removeClass("is-active") 195 // }) 196 // } 197 const storageTooltipLive = sessionStorage.getItem("tooltipLive"); 198 if(!storageTooltipLive) { 199 $(".js-tooltip-live").addClass("is-active") 200 $(".js-tooltip-live button").click(function(){ 201 sessionStorage.setItem("tooltipLive", "hide"); 202 }) 203 } 204}) 205 206 207const wSearch = { 208 isOpen: false, 209 open: function(){ 210 if(!wSearch.isOpen) { 211 wSearch.isOpen = true; 212 wSearch.initSearch() 213 } 214 toggleCommonPopup("popup-search"); 215 }, 216 initSearch: function(){ 217 wSearch.initRecentKeyword() 218 219 const api = new W2RApi() 220 api.callback = wSearch.initSearchCallback 221 api.call("get", "/search/getKeyword") 222 }, 223 initSearchCallback: function(data){ 224 $("#popup-search .js-pop-search-text").attr("placeholder", data.result.placeHolder); 225 let template = wCommon.getTemplate("tplSearchKeyword", {list: data.result.list}) 226 $("#popup-search .common-sch-hot__list").html(template); 227 let template2 = wCommon.getTemplate("tplSearchProduct", {list: data.result.productList}) 228 $("#popup-search .common-sch-slide .swiper-wrapper").html(template2); 229 var swiper = new Swiper(".type-product-2-20", { 230 spaceBetween: 20, 231 slidesPerView: 2, 232 navigation: { 233 nextEl: '.swiper-button-next', 234 prevEl: '.swiper-button-prev', 235 }, 236 }); 237 }, 238 search: function(searchText){ 239 wSearch.setRecentKeyword(searchText) 240 location.href = "/search?searchText=" + searchText 241 }, 242 243 initRecentKeyword: function(){ 244 let recentKeyword = JSON.parse(localStorage.getItem("recentKeyword")) 245 let template = wCommon.getTemplate("tplRecentKeyword", {list: recentKeyword}) 246 $("#popup-search .common-sch-recent__list").html(template); 247 }, 248 249 setRecentKeyword: function (keyword = "") { 250 let recentKeyword = JSON.parse(localStorage.getItem("recentKeyword")) 251 if (recentKeyword === null) { 252 recentKeyword = [] 253 } 254 if (keyword) { 255 let idx = recentKeyword.indexOf(keyword); 256 if(idx !== -1){ 257 recentKeyword.splice(idx, 1); 258 } 259 recentKeyword.unshift(keyword) 260 } 261 localStorage.setItem("recentKeyword", JSON.stringify(recentKeyword.slice(0, 8))) 262 wSearch.recentKeyword = recentKeyword.slice(0, 8) 263 }, 264 clearRecentKeyword: function () { 265 console.log(1) 266 localStorage.removeItem("recentKeyword"); 267 wSearch.recentKeyword = null 268 wSearch.initRecentKeyword() 269 }, 270 271 removeRecentKeyword: function (idx) { 272 let recentKeyword = JSON.parse(localStorage.getItem("recentKeyword")) 273 recentKeyword.splice(idx, 1); 274 localStorage.setItem("recentKeyword", JSON.stringify(recentKeyword.slice(0, 8))) 275 wSearch.recentKeyword = recentKeyword.slice(0, 8) 276 wSearch.initRecentKeyword() 277 }, 278} 279 280 281 282const wCompare = { 283 selectedCategory: null, 284 isOpen: false, 285 startY: null, 286 endY: null, 287 product: [], 288 init: function(){ 289 if(!$("#popup-compare").length){ 290 return false; 291 } 292 var compareResult = new Swiper(".swiper-container--compareResult", 293 { 294 slidesPerView: 2, 295 spaceBetween: 8, 296 watchSlidesProgress: true, 297 }); 298 299 300 $('.popup-compare-result .common-popup__body').on('scroll', function() 301 { 302 if ($(this).scrollTop() > 0) 303 { 304 $(this).parent().addClass('scroll-active'); 305 } 306 else 307 { 308 $(this).parent().removeClass('scroll-active'); 309 } 310 }); 311 $(".popup-compare-result").on("click", ".js-compare-item-delete", function() 312 { 313 $(this).closest(".swiper-slide").remove();
314 compareResult.update(); 315 }) 316 317 318 $('.popup-compare__head ') 319 .on('touchstart', function(event) 320 { 321 wCompare.startY = event.originalEvent.touches[0].clientY; 322 }) 323 .on('touchmove', function(event) 324 { 325 wCompare.endY = event.originalEvent.touches[0].clientY; 326 }) 327 .on('touchend', function() 328 { 329 if (wCompare.startY < wCompare.endY) { 330 wCompare.minimize() 331 }else{ 332 wCompare.maximize() 333 } 334 wCompare.endY = null; 335 }); 336 $("#popup-compare") 337 .on("click", ".compare-reset__btn", function(){ 338 wCompare.reset() 339 }) 340 .on("click", ".js-delete-compare", function(){ 341 wCompare.remove($(this)) 342 }) 343 .on("change", "select.compareCategory", function(){ 344 wCompare.changeCategory($(this)) 345 }) 346 .on("click", ".js-open-compare-result", function(){ 347 wCompare.openResult() 348 }) 349 .on("click", ".compare-toggle__btn", function(){ 350 console.log(1) 351 if($('.popup-compare').hasClass("is-min")){ 352 wCompare.maximize() 353 }else{ 354 wCompare.minimize() 355 } 356 }) 357 $("#popup-compare-result") 358 .on("click", ".js-popup-compare-result-close", function() { 359 wCompare.closeResult() 360 }) 361 .on("change", "select.compareCategory", function(){ 362 wCompare.changeResultCategory($(this)) 363 }) 364 .on("click", ".js-delete-compare", function(){ 365 wCompare.remove($(this)) 366 }) 367 .on("click", ".compare-result-box__foot .common-button", function(){ 368 let trackingData = { 369 listName: "ë¹êµí기", 370 items: [ 371 { 372 item_id: $(this).closest(".compare-result-box").find(".compare-result-box__head_serial").text(), 373 item_name: $(this).closest(".compare-result-box").find("h4.compare-result-box__head_title").text(), 374 } 375 ] 376 } 377 wTracking.selectItem(trackingData) 378 }) 379 380 console.log("compare init") 381 }, 382 minimize: function(){ 383 $('.popup-compare').addClass("is-min") 384 }, 385 maximize: function(){ 386 $('.popup-compare').removeClass("is-min") 387 }, 388 open: function(obj){ 389 const productId = obj.data("product-id") 390 const categoryId = obj.data("category-id").substring(0, 3) 391 392 if(productId && categoryId){ 393 let compare = JSON.parse(localStorage.getItem("compare")); 394 if(compare === null){ compare = {} } 395 wCompare.addProduct(categoryId, productId) 396 if(!Object.hasOwn(compare, categoryId)) { 397 console.log("ca ìì") 398 const api = new W2RApi; 399 api.callback = wCompare.openCallback 400 api.call("get", "/display/category/"+categoryId) 401 }else{ 402 wCompare.selectedCategory = categoryId 403 wCompare.openItemPopup() 404 } 405 }else { 406 wCompare.selectedCategory = null 407 wCompare.openItemPopup() 408 } 409 }, 410 openCallback: function(data){ 411 let compare = JSON.parse(localStorage.getItem("compare")); 412 compare[data.result.categoryCode].name = data.result.displayName; 413 localStorage.setItem("compare", JSON.stringify(compare)); 414 wCompare.selectedCategory = data.result.categoryCode 415 wCompare.openItemPopup(data.result.categoryCode) 416 }, 417 close: function(){ 418 $('.popup-compare').removeClass("popup-on"); 419 $(".common-popup__bg").fadeOut() 420 wCommon.undoFixBody() 421 }, 422 addProduct: function(categoryId, productId){ 423 let compare = JSON.parse(localStorage.getItem("compare")); 424 if(compare === null){ compare = {} } 425 if(!compare[categoryId]){ 426 compare[categoryId] = { 427 list: [] 428 } 429 } 430 431 let idx = compare[categoryId].list.indexOf(productId); 432 if(idx !== -1){ 433 compare[categoryId].list.splice(idx, 1); 434 } 435 compare[categoryId].list.push(productId); 436 if(compare[categoryId].list.length > 4){ 437 compare[categoryId].list = compare[categoryId].list.slice(-4) 438 } 439 localStorage.setItem("compare", JSON.stringify(compare)); 440 }, 441 openItemPopup: function(){ 442 console.log("openItemPopup" + wCompare.isOpen); 443 wCompare.setItem() 444 if(!wCompare.isOpen) { 445 console.log("openItemPopup2") 446 $("#popup-compare").addClass("popup-on"); 447 wCompare.isOpen = true; 448 }else{ 449 wCompare.maximize() 450 } 451 }, 452 setItem: function(mode){ 453 let selectedCategory = wCompare.selectedCategory 454 let compare = JSON.parse(localStorage.getItem("compare")); 455 456 if(selectedCategory){ 457 $("#popup-compare .js-compare-result b").text("("+compare[selectedCategory].list.length+"/4)") 458 const apiData = { 459 productIds: compare[selectedCategory].list.join(",") 460 } 461 const api = new W2RApi(); 462 api.callback = wCompare.setItemCallback 463 api.call("get", "/product/productIds", apiData) 464 }else{ 465 $("#popup-compare .js-compare-result b").text("(0/4)") 466 $("#popup-compare .compare-product").html("") 467 } 468 469 470 const tplData = { 471 selectedCategory: selectedCategory, 472 compare: compare, 473 } 474 let template = wCommon.getTemplate("tplCompareForm", tplData) 475 $("#popup-compare .popup-compare__body .common-select-area").html(template) 476 $("#popup-compare-result .common-popup__head .common-select-area").html(template) 477 478 }, 479 setItemCallback: function(data){ 480 console.log(data) 481 let selectedCategory = wCompare.selectedCategory 482 let compare = JSON.parse(localStorage.getItem("compare")); 483 const emptyCount = 4 - compare[selectedCategory].list.length 484 wCompare.product = data.result 485 const tplData = { 486 product: data.result, 487 emptyCount: emptyCount, 488 } 489 let template = wCommon.getTemplate("tplCompareItem", tplData) 490 $("#popup-compare .compare-product").html(template) 491 }, 492 changeCategory: function(obj){ 493 if(obj.val()){ 494 wCompare.selectedCategory = obj.val() 495 }else{ 496 wCompare.selectedCategory = null 497 } 498 wCompare.maximize() 499 wCompare.setItem("fixForm") 500 }, 501 reset: function(){ 502 localStorage.setItem("compare", JSON.stringify({})) 503 $("#popup-compare .js-compare-result b").text("(0/4)") 504 wCompare.selectedCategory = null 505 wCompare.setItem() 506 }, 507 remove: function(obj){ 508 const productId = obj.data("product-id") 509 let selectedCategory = wCompare.selectedCategory 510 let compare = JSON.parse(localStorage.getItem("compare")); 511 compare[selectedCategory].list = compare[selectedCategory].list.filter(item => item !== productId); 512 if(!compare[selectedCategory].list.length){ 513 delete compare[selectedCategory] 514 } 515 localStorage.setItem("compare", JSON.stringify(compare)) 516 if(!compare[selectedCategory]){ 517 wCompare.selectedCategory = null 518 wCompare.setItem() 519 }else{ 520 wCompare.setItem("fixForm") 521 } 522 if($("#popup-compare-result").hasClass("popup-on")){ 523 wCompare.setResult() 524 } 525 }, 526 openResult: function(){ 527 if(!wCompare.selectedCategory){
528 wToast.open("ì íë ì¹´í ê³ ë¦¬ê° ììµëë¤.") 529 return false; 530 } 531 wCompare.setResult() 532 $("#popup-compare-result").addClass("popup-on"); 533 $(".common-popup__bg").fadeIn(); 534 wCommon.fixBody() 535 }, 536 closeResult: function(){ 537 $("#popup-compare-result").removeClass("popup-on"); 538 $(".common-popup__bg").fadeOut(); 539 wCommon.undoFixBody() 540 }, 541 542 setResult: function(){ 543 let selectedCategory = wCompare.selectedCategory 544 let compare = JSON.parse(localStorage.getItem("compare")); 545 if(!selectedCategory){ 546 return false; 547 } 548 const apiData = { 549 productIds: compare[selectedCategory].list.join(",") 550 } 551 const api = new W2RApi(); 552 api.callback = wCompare.setResultCallback 553 api.call("get", "/product/compair", apiData) 554 }, 555 setResultCallback: function(data, obj){ 556 if(data.code === "200"){ 557 let selectedCategory = wCompare.selectedCategory 558 let compare = JSON.parse(localStorage.getItem("compare")); 559 const emptyCount = 4 - compare[selectedCategory].list.length 560 const tplData = { 561 list: data.result.list, 562 emptyCount: emptyCount, 563 } 564 let template = wCommon.getTemplate("tplCompareResultItem", tplData) 565 $("#popup-compare-result .compare-result-slide__inner").html(template) 566 console.log(data) 567 568 var compareResult = new Swiper(".swiper-container--compareResult", 569 { 570 slidesPerView: 2, 571 spaceBetween: 8, 572 watchSlidesProgress: true, 573 }); 574 575 let trackingData = {} 576 if(data.result.list[0]){ 577 trackingData.id1 = data.result.list[0].model; 578 trackingData.name1 = data.result.list[0].name; 579 } 580 if(data.result.list[1]){ 581 trackingData.id2 = data.result.list[1].model; 582 trackingData.name2 = data.result.list[1].name; 583 } 584 if(data.result.list[2]){ 585 trackingData.id3 = data.result.list[2].model; 586 trackingData.name3 = data.result.list[2].name; 587 } 588 if(data.result.list[3]){ 589 trackingData.id4 = data.result.list[3].model; 590 trackingData.name4 = data.result.list[3].name; 591 } 592 wTracking.viewCompareResult(trackingData) 593 }else{ 594 $("#popup-compare-result .compare-result-slide__inner").html("<div class='wEmpty' style='width:100%; line-height:1.35'>ì¤ë¥ê° ë°ìíì¬<br>ë¹êµí기 ì 보를 ë¶ë¬ì¤ì§ 못íìµëë¤.</br>.</div>") 595 } 596 }, 597 changeResultCategory: function(obj){ 598 if(obj.val()){ 599 wCompare.selectedCategory = obj.val() 600 }else{ 601 wCompare.selectedCategory = null 602 } 603 wCompare.setItem() 604 wCompare.setResult() 605 } 606}
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.