PageSourceSearch

https://couple2ya.com/ind-script/optimizer_user.php?filename=lY4xD…8ef5b986f6c219012b4a42c&t=1770601652&user=T

js couple2ya.com collected 2026-09-26 08:49:23 UTC 14,954 bytes, 495 lines download raw bytes

1$(function () {
2  console.log("cate.js");
3
4  var methods = {
5    aSubCategory: {},
6
7    getParam: function (sUrl, sKey) {
8      var aUrl = sUrl.split("?"),
9        sQueryString = aUrl[1],
10        aParam = {};
11      if (sQueryString) {
12        sQueryString.split("&").forEach(function (field) {
13          var pair = field.split("=");
14          aParam[pair[0]] = pair[1];
15        });
16      }
17      return sKey ? aParam[sKey] : aParam;
18    },
19
20    getParamSeo: function (sUrl) {
21      var aUrl = sUrl.split("/"),
22        len = aUrl.length - 2;
23      return aUrl[len] || null;
24    },
25
26    show: function (liNode, iCateNo) {
27      var items = this.aSubCategory[iCateNo];
28      if (!items) return;
29
30      var html = ["<ul>"];
31      items.forEach(function (item) {
32        html.push('<li><a href="' + item.link_product_list + '">' + item.name + "</a></li>");
33      });
34      html.push("</ul>");
35
36      $(liNode).find(".sub-category").remove();
37      $('<div class="sub-category"></div>').appendTo(liNode).html(html.join(""));
38    },
39
40    get: function () {
41      var self = this;
42      $.ajax({
43        url: "/exec/front/Product/SubCategory",
44        dataType: "json",
45        success: function (aData) {
46          if (!aData) return;
47
48          aData.forEach(function (item) {
49            var parent = item.parent_cate_no;
50            if (!self.aSubCategory[parent]) self.aSubCategory[parent] = [];
51            self.aSubCategory[parent].push(item);
52          });
53
54          Object.keys(self.aSubCategory).forEach(function (parentCateNo) {
55            $(".xans-layout-category li").each(function () {
56              var href = $(this).find("a").attr("href") || "",
57                cateNo1 = self.getParam(href, "cate_no"),
58                cateNo2 = self.getParamSeo(href),
59                cateNo = Number(cateNo1 || cateNo2);
60
61              if (cateNo === Number(parentCateNo)) {
62                self.show(this, cateNo);
63              }
64            });
65          });
66        },
67      });
68    },
69  };
70
71  methods.get();
72
73  // ✅ 드롭다운 시작선 변수 세팅 (SHOP/BRIDAL 등 각 메뉴 hover 시 적용)
74  function setDropLeft($li) {
75    var $a = $li.children("a").first();
76    if (!$a.length) return;
77
78    var rect = $a[0].getBoundingClientRect();
79    var padL = parseFloat(getComputedStyle($a[0]).paddingLeft) || 0;
80
81    // 텍스트 시작선 기준
82    var left = rect.left + padL;
83
84    document.documentElement.style.setProperty("--gnb-drop-left", left + "px");
85  }
86
87  $(".gnb > li.hasSubMenu").on("mouseenter", function () {
88    setDropLeft($(this));
89  });
90
91  $(window).on("resize", function () {
92    var $open = $(".gnb > li.hasSubMenu.subOpen").first();
93    if ($open.length) setDropLeft($open);
94  });
95});
96
97$(function(){
98    if($(".menuCategory > li").length==0){
99        $(".menuCategory").hide();
100    }else {
101        $(".menuCategory li").each(function(i){
102            var ulElChk = $(this).find('ul').length;
103            if(ulElChk == 0){
104                $(this).find('.iconWrap').remove();
105            }
106        });
107
108        var domWidth = $(document).width();
109        if(domWidth < 1024){
110            $(".menuCategory .iconWrap").on('click', function(e){
111                var target = $(this).closest('li');
112                var ulEl = returnTarget(target);
113                var ulElchk = ulEl.hasClass('active');
114
115                if(ulElchk){
116                    var classChk = $(this).closest('ul').hasClass('active');
117                    if(!classChk){ heightCheck(ulEl, "out"); }
118                    mouseEvent(target, "out");
119
120                    target.find('ul').removeClass('active');
121                }else{
122                    heightCheck(ulEl, "hover");
123                    mouseEvent(target, "hover");
124                }
125                target.siblings('li').find('ul').removeClass('active');
126
127            });
128        }else{
129            $(".menuCategory li").hover(function() {
130                mouseEvent($(this), "hover");
131            }, function(){
132               mouseEvent($(this), "out"); /***/
133            })
134        }
135    };
136
137    function mouseEvent(_this, str){
138        var target = returnTarget(_this);
139        str == "hover" ? target.addClass('active') : target.removeClass('active');
140    }
141
142    function returnTarget(_this){
143        var target = _this.children('ul');
144        var ulElChk = target.length;
145        if(ulElChk == 0){ target = _this.children('.button').children('ul') }
146
147        return target;
148    }
149
150    function heightCheck(ulEl, str){
151        if(str == "out"){
152            $('.menuCategory.menu').css({"height":""});
153        }else{
154            var height = ulEl.outerHeight(true);
155            var menuHeight = $('.menuCategory .menu li').outerHeight(true);
156            var cul = (menuHeight+height)+10;
157
158            $('.menuCategory.menu').css({"height":cul});
159        }
160    };
161
162});
163
164/**
165 * 카테고리 리스트 상품 정렬
166 */
167var aUrl = location.href.split('?');
168var sQueryString = aUrl[1];
169var orgHeaderHeight = 0;
170var selAdd = 0;
171var maxTime = 5;
172
173/**
174 * 파라미터가 있을경우에만 처리
175 */
176$(function(){
177    if (sQueryString && sQueryString.indexOf('sort_method') > -1) {
178        for (var i=0; i<$('#selArray option').length; i++) {
179            if ($('#selArray option').eq(i).val().indexOf(sQueryString) > -1) {
180                $('#selArray option').eq(i).prop("selected", true);
181
182                orgHeaderHeight = $('#header').outerHeight(true);
183                fixedClassCheck();
184            }
185        }
186    }
187});
188
189$('#selArray').on('change', function() {
190    if ($('#selArray').val()) {
191        location.href=$('#selArray').val();
192    }
193});
194
195function goThumg(url) {
196    location.href = url+'?'+sQueryString;
197}
198
199function fixedClassCheck(){
200    var fixedBol = $('#header').hasClass('fixed');
201    if(!fixedBol){
202        if(selAdd < maxTime){ setTimeout(fixedClassCheck,100); }
203        selAdd++;
204    }else{
205        var fixedHeader = $('#header').find('.navigation').outerHeight(true),
206            scrollValue = $(document).scrollTop(),
207            scrollTop = scrollValue - (orgHeaderHeight+fixedHeader);
208
209        if(scrollTop > 0){ $(document).scrollTop(scrollTop); }
210    }
211}
212(function () {
213  var titleEl = document.getElementById("jsCateTitle");
214  var descEl = document.getElementById("jsCateDesc");
215  if (!titleEl || !descEl) return;
216
217  function getParam(key) {
218    var qs = window.location.search.substring(1);
219    if (!qs) return null;
220    var pairs = qs.split("&");
221    for (var i = 0; i < pairs.length; i++) {
222      var p = pairs[i].split("=");
223      if (decodeURIComponent(p[0]) === key) return decodeURIComponent(p[1] || "");
224    }
225    return null;
226  }
227
228  function getCateNoFallback() {
229    var m = location.pathname.match(/\/(\d+)(?:\/)?$/);
230    return m ? m[1] : null;
231  }
232
233  function getCurrentCateNameFromPath() {
234    var path = document.querySelector(".xans-product-menupackage .path");
235    if (!path) return "";
236    var lis = Array.prototype.slice.call(path.querySelectorAll("ol > li"))
237      .filter(function (li) { return li.offsetParent !== null; });
238    var last = lis.length ? lis[lis.length - 1] : null;
239    if (!last) return "";
240    var a = last.querySelector("a");
241    return a ? (a.textContent || "").trim() : "";
242  }
243
244  var cateNo = getParam("cate_no") || getCateNoFallback();
245  var cateName = getCurrentCateNameFromPath();
246
247  // 타이틀은 기본적으로 카테명 기반 (기존 로직 유지)
248  titleEl.textContent = cateName ? "LEOR. " + cateName : "LEOR.";
249
250  if (!cateNo) {
251    descEl.style.display = "none";
252    return;
253  }
254
255  // JSON만 고치면 끝나게 만들기
256  fetch("/cate_meta.json?v=" + Date.now(), { cache: "no-store" })
257    .then(function (r) { return r.json(); })
258    .then(function (map) {
259      var meta = map[cateNo];
260      var html = meta && meta.descHtml ? meta.descHtml : "";
261
262      if (!html) {
263        descEl.style.display = "none";
264        return;
265      }
266
267      // 필요하면 타이틀 접두어도 JSON에서 통제 가능
268      if (meta && meta.titlePrefix) {
269        titleEl.textContent = cateName ? (meta.titlePrefix + cateName) : meta.titlePrefix.trim();
270      }
271
272      descEl.innerHTML = html;
273      descEl.style.display = "";
274    })
275    .catch(function () {
276      // JSON 못 읽으면 문구 숨김(레이아웃 깨짐 방지)
277      descEl.style.display = "none";
278    });
279})();
280/**
281 * hasClass
282 */
283function hasClass(element, className){
284    return (' ' + element.className + ' ').indexOf(' ' + className+ ' ') > -1;
285};
286
287/**
288 *  toggle
289 */
290function toggleClassAll(element, handler, className){
291    var _handler = document.querySelector(handler);
292    document.querySelectorAll(handler).forEach(function(item){
293        item.addEventListener('click', function(){
294            var _element = item.parentNode;
295            if ( hasClass( _element, className ) ) {
296                _element.classList.remove( className );
297            } else {
298                _element.classList.add( className );
299            }
300        })
301    })
302};
303
304/**
305 *  findElements
306 */
307function findElements(element, findElement){
308    var resultElements = [];
309    document.querySelectorAll(element).forEach(function(item){
310        var findElementList = item.querySelectorAll(findElement);
311        findElementList = Array.prototype.slice.call(findElementList);
312        resultElements = resultElements.concat(findElementList);
313    })
314    return resultElements;
315};
316
317/**
318 *  setAttributeAl
319 */
320function setAttributeAll(elements, name, value){
321    elements.forEach(function(item){
322        item.setAttribute(name, value);
323    })
324};
325
326/**
327 *  상품 섬네일 로드되지 않을 경우, 기본값 설정
328 */
329function setDefaultImage(element) {
330    document.querySelectorAll(element).forEach(function(item){
331        var $img = new Image();
332        $img.onerror = function () {
333            item.src="//img.echosting.cafe24.com/thumb/img_product_big.gif";
334        }
335        $img.src = item.src;
336    });
337};
338
339/**
340 *  tooltip
341 */
342function setTooltipEvent(){
343    var input = findElements('.eTooltip', 'input');
344    input.forEach(function(item){
345        item.addEventListener('focusin', function(event){
346            var targetName = returnTargetName(event.target);
347            targetName.nextElementSibling.style.display = 'block'
348        });
349        item.addEventListener('focusout', function(event){
350            var targetName = returnTargetName(event.target);
351            targetName.nextElementSibling.style.display = 'none'
352        });
353    });
354}
355
356/**
357 *  tooltip input focus
358 */
359function returnTargetName(_this){
360    var ePlacename = _this.parentElement.getAttribute("class");
361    var targetName;
362    if(ePlacename == "ePlaceholder"){ //ePlaceholder supported
363        targetName = _this.parentElement;
364    }else{
365        targetName = _this;
366    }
367    return targetName;
368}
369
370/**
371 * window load
372 */
373window.addEventListener('load', function(){
374    if (document.querySelector('.thumbnail')){
375        setDefaultImage('.thumbnail img');
376    }
377    if (document.querySelector('.eTooltip')){
378        setAttributeAll(findElements('.eTooltip', '.btnClose'),'tabIndex','-1');
379        setTooltipEvent();
380    }
381    if (document.querySelector('div.eToggle')){
382        toggleClassAll(false, 'div.eToggle .title', 'selected');
383    }
384}); 
385//window popup script
386function winPop(url) {
387    window.open(url, "popup", "width=300,height=300,left=10,top=10,resizable=no,scrollbars=no");
388}
389/**
390 * document.location.href split
391 * return array Param
392 */
393function getQueryString(sKey)
394{
395    var sQueryString = document.location.search.substring(1);
396    var aParam       = {};
397
398    if (sQueryString) {
399        var aFields = sQueryString.split("&");
400        var aField  = [];
401        for(var i=0; i<aFields.length; i++){
402            aField = aFields[i].split('=');
403            aParam[aField[0]] = aField[1];            
404        }
405    }
406
407    aParam.page = aParam.page ? aParam.page : 1;
408    return sKey ? aParam[sKey] : aParam;
409};
410
411/**
412  *  구매버튼
413*/
414var globalBuyBtnScrollFunc = function() {
415    // 구매버튼 관련변수
416    var sFixId = $('#orderFixItem').length > 0  ? 'orderFixItem' : 'fixedActionButton',
417        $area = $('#orderFixArea'),
418        $item = $('#' + sFixId + '').not($area);
419
420    $(window).scroll(function(){
421        try {
422             // 구매버튼 관련변수
423            var iCurrentHeightPos = $(this).scrollTop() + $(this).height(),
424                iButtonHeightPos = $item.offset().top;
425
426            if (iCurrentHeightPos > iButtonHeightPos || iButtonHeightPos < $(this).scrollTop() + $item.height()) {
427                if (iButtonHeightPos < $(this).scrollTop() - $item.height()) {
428                    $area.fadeIn('fast');
429                } else {
430                    $area.hide();
431                }
432            } else {
433                $area.fadeIn('fast');
434            }
435        } catch(e) { }
436    });
437};
438
439$(function(){
440    // tab
441    $.eTab = function(ul) {
442        $(ul).find('a').on('click', function() {
443            var _li = $(this).parent('li').addClass('selected').siblings().removeClass('selected'),
444                _target = $(this).attr('href'),
445                _siblings = '.' + $(_target).attr('class');
446            $(_target).show().siblings(_siblings).hide();
447            return false
448        });
449    }
450    if ( window.call_eTab ) {
451        call_eTab();
452    };
453    globalBuyBtnScrollFunc();
454});
455(function($){
456    $.fn.extend({
457        center: function() {
458            this.each(function() {
459                var
460                    $this = $(this),
461                    $w = $(window);
462                $this.css({
463                    position: "absolute",
464                    top: ~~(($w.height() - $this.outerHeight()) / 2) + $w.scrollTop() + "px",
465                    left: ~~(($w.width() - $this.outerWidth()) / 2) + $w.scrollLeft() + "px"
466                });
467            });
468            return this;
469        }
470    });
471    $(function() {
472        var $container = function(){/*
473    <div id="modalContainer">
474        <iframe id="modalContent" scroll="0" scrolling="no" frameBorder="0"></iframe>
475    </div>');
476    */}.toString().slice(14,-3);
477        $('body')
478        .append($('<div id="modalBackpanel"></div>'))
479        .append($($container));
480        function closeModal () {
481            $('#modalContainer').hide();
482            $('#modalBackpanel').hide();
483        }
484        $('#modalBackpanel').on('click', closeModal);
485        zoom = function ($piProductNo, $piCategoryNo, $piDisplayGroup) {
486            var $url = '/product/image_zoom.html?product_no=' + $piProductNo + '&cate_no=' + $piCategoryNo + '&display_group=' + $piDisplayGroup;
487            $('#modalContent').attr('src', $url);
488            $('#modalContent').on("load",function(){
489                $(".header .close",this.contentWindow.document.body).on("click", closeModal);
490            });
491            $('#modalBackpanel').css({width:$("body").width(),height:$("body").height(),opacity:.4}).show();
492            $('#modalContainer').center().show();
493        }
494    });
495})(jQuery);

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.