PageSourceSearch

https://dedra.co.kr/ind-script/optimizer_user.php?filename=dY5BCoA…804fe5ddbfb188dc323a189&t=1790663926&user=T

js dedra.co.kr collected 2026-10-01 14:24:04 UTC 21,544 bytes, 745 lines download raw bytes

1/**
2 * 움직이는 배너 Jquery Plug-in
3 * @author  cafe24
4 */
5
6(function($){
7
8    $.fn.floatBanner = function(options) {
9        options = $.extend({}, $.fn.floatBanner.defaults , options);
10
11        return this.each(function() {
12            var aPosition = $(this).position();
13            var jbOffset = $(this).offset();
14            var node = this;
15
16            $(window).on('scroll', function() {
17                var _top = $(document).scrollTop();
18                _top = (aPosition.top < _top) ? _top : aPosition.top;
19
20                setTimeout(function () {
21                    var newinit = $(document).scrollTop();
22
23                    if ( newinit > jbOffset.top ) {
24                        _top -= jbOffset.top;
25                        var container_height = $("#wrap").height();
26                        var quick_height = $(node).height();
27                        var cul = container_height - quick_height;
28                        if(_top > cul){
29                            _top = cul;
30                        }
31                    } else {
32                        _top = 0;
33                    }
34
35                    $(node).stop().animate({top: _top}, options.animate);
36                }, options.delay);
37            });
38        });
39    };
40
41    $.fn.floatBanner.defaults = {
42        'animate'  : 500,
43        'delay'    : 500
44    };
45
46})(jQuery);
47
48/**
49 * 문서 구동후 시작
50 */
51$(function(){
52    $('#banner:visible, #quick:visible').floatBanner();
53
54    //placeholder
55    $(".ePlaceholder input, .ePlaceholder textarea").each(function(i){
56        var placeholderName = $(this).parents().attr('title');
57        $(this).attr("placeholder", placeholderName);
58    });
59    /* placeholder ie8, ie9 */
60    $.fn.extend({
61        placeholder : function() {
62            //IE 8 버전에는 hasPlaceholderSupport() 값이 false를 리턴
63           if (hasPlaceholderSupport() === true) {
64                return this;
65            }
66            //hasPlaceholderSupport() 값이 false 일 경우 아래 코드를 실행
67            return this.each(function(){
68                var findThis = $(this);
69                var sPlaceholder = findThis.attr('placeholder');
70                if ( ! sPlaceholder) {
71                   return;
72                }
73                findThis.wrap('<label class="ePlaceholder" />');
74                var sDisplayPlaceHolder = $(this).val() ? ' style="display:none;"' : '';
75                findThis.before('<span' + sDisplayPlaceHolder + '>' + sPlaceholder + '</span>');
76                this.onpropertychange = function(e){
77                    e = event || e;
78                    if (e.propertyName == 'value') {
79                        $(this).trigger('focusout');
80                    }
81                };
82                //공통 class
83                var agent = navigator.userAgent.toLowerCase();
84                if (agent.indexOf("msie") != -1) {
85                    $(".ePlaceholder").css({"position":"relative"});
86                    $(".ePlaceholder span").css({"position":"absolute", "padding":"0 4px", "color":"#878787"});
87                    $(".ePlaceholder label").css({"padding":"0"});
88                }
89            });
90        }
91    });
92
93    $(':input[placeholder]').placeholder(); //placeholder() 함수를 호출
94
95    //클릭하면 placeholder 숨김
96    $('body').on('click', '.ePlaceholder span', function(){
97        $(this).hide();
98    });
99
100    //input창 포커스 인 일때 placeholder 숨김
101    $('body').on('focusin', '.ePlaceholder :input', function(){
102        $(this).prev('span').hide();
103    });
104
105    //input창 포커스 아웃 일때 value 가 true 이면 숨김, false 이면 보여짐
106    $('body').on('focusout', '.ePlaceholder :input', function(){
107        if (this.value) {
108            $(this).prev('span').hide();
109        } else {
110            $(this).prev('span').show();
111        }
112    });
113
114    //input에 placeholder가 지원이 되면 true를 안되면 false를 리턴값으로 던져줌
115    function hasPlaceholderSupport() {
116        if ('placeholder' in document.createElement('input')) {
117            return true;
118        } else {
119            return false;
120        }
121    }
122});
123
124/**
125 *  썸네일 이미지 엑박일경우 기본값 설정
126 */
127$(window).on('load', function() {
128    $("img.thumb,img.ThumbImage,img.BigImage").each(function($i,$item){
129        var $img = new Image();
130        $img.onerror = function () {
131            $item.src="//img.echosting.cafe24.com/thumb/img_product_big.gif";
132        }
133        $img.src = this.src;
134    });
135});
136
137/**
138 *  tooltip
139 */
140$('.eTooltip').each(function(i){
141    $(this).find('.btnClose').attr('tabIndex','-1');
142});
143//tooltip input focus
144$('.eTooltip').find('input').on('focus', function() {
145    var targetName = returnTagetName(this);
146    targetName.siblings('.ec-base-tooltip').show();
147});
148$('.eTooltip').find('input').on('focusout', function() {
149    var targetName = returnTagetName(this);
150    targetName.siblings('.ec-base-tooltip').hide();
151});
152function returnTagetName(_this){
153    var ePlacename = $(_this).parent().attr("class");
154    var targetName;
155    if(ePlacename == "ePlaceholder"){ //ePlaceholder 대응
156        targetName = $(_this).parents();
157    }else{
158        targetName = $(_this);
159    }
160    return targetName;
161}
162
163/**
164 *  eTab
165 */
166$("body").on("click", ".eTab a", function(e){
167    // 클릭한 li 에 selected 클래스 추가, 기존 li에 있는 selected 클래스는 삭제.
168    var _li = $(this).parent("li").addClass("selected").siblings().removeClass("selected"),
169    _target = $(this).attr("href"),
170    _siblings = $(_target).attr("class"),
171    _arr = _siblings.split(" "),
172    _classSiblings = "."+_arr[0];
173
174    //클릭한 탭에 해당하는 요소는 활성화, 기존 요소는 비활성화 함.
175    $(_target).show().siblings(_classSiblings).hide();
176
177
178    //preventDefault 는 a 태그 처럼 클릭 이벤트 외에 별도의 브라우저 행동을 막기 위해 사용됨.
179    e.preventDefault();
180});
181
182
183
184//window popup script
185function winPop(url) {
186    window.open(url, "popup", "width=300,height=300,left=10,top=10,resizable=no,scrollbars=no");
187}
188/**
189 * document.location.href split
190 * return array Param
191 */
192function getQueryString(sKey)
193{
194    var sQueryString = document.location.search.substring(1);
195    var aParam       = {};
196
197    if (sQueryString) {
198        var aFields = sQueryString.split("&");
199        var aField  = [];
200        for (var i=0; i<aFields.length; i++) {
201            aField = aFields[i].split('=');
202            aParam[aField[0]] = aField[1];
203        }
204    }
205
206    aParam.page = aParam.page ? aParam.page : 1;
207    return sKey ? aParam[sKey] : aParam;
208};
209
210$(function(){
211    // tab
212    $.eTab = function(ul){
213        $(ul).find('a').on('click', function(){
214            var _li = $(this).parent('li').addClass('selected').siblings().removeClass('selected'),
215                _target = $(this).attr('href'),
216                _siblings = '.' + $(_target).attr('class');
217            $(_target).show().siblings(_siblings).hide();
218            return false
219        });
220    }
221    if ( window.call_eTab ) {
222        call_eTab();
223    };
224});
225(function($){
226    $.fn.extend({
227        center: function() {
228            this.each(function() {
229                var
230                    $this = $(this),
231                    $w = $(window);
232                $this.css({
233                    position: "absolute",
234                    top: ~~(($w.height() - $this.outerHeight()) / 2) + $w.scrollTop() + "px",
235                    left: ~~(($w.width() - $this.outerWidth()) / 2) + $w.scrollLeft() + "px"
236                });
237            });
238            return this;
239        }
240    });
241    $(function() {
242        var $container = function(){/*
243    <div id="modalContainer">
244        <iframe id="modalContent" scroll="0" scrolling="no" frameBorder="0"></iframe>
245    </div>');
246    */}.toString().slice(14,-3);
247        $('body')
248        .append($('<div id="modalBackpanel"></div>'))
249        .append($($container));
250        function closeModal () {
251            $('#modalContainer').hide();
252            $('#modalBackpanel').hide();
253        }
254        $('#modalBackpanel').on('click',closeModal);
255        zoom = function ($piProductNo, $piCategoryNo, $piDisplayGroup) {
256            var $url = '/product/image_zoom.html?product_no=' + $piProductNo + '&cate_no=' + $piCategoryNo + '&display_group=' + $piDisplayGroup;
257            $('#modalContent').attr('src', $url);
258            $('#modalContent').on("load",function(){
259                $(".header .close",this.contentWindow.document.body).on("click", closeModal);
260            });
261            $('#modalBackpanel').css({width:$("body").width(),height:$("body").height(),opacity:.4}).show();
262            $('#modalContainer').center().show();
263        }
264    });
265})(jQuery);
266$(function(){
267    var loginButtons = document.querySelectorAll('.header-login-btn');
268    
269    loginButtons.forEach(function(button) {
270        button.addEventListener('click', function() {
271            var contentValue = document.querySelector('meta[name="path_role"]').getAttribute('content');
272
273            // 회원가입(MEMBER_JOIN)일 경우 returnUrl 없이 리다이렉트
274            if (contentValue == 'MEMBER_JOIN') {
275                window.location.href = '/member/login.html';
276                return true;
277            }
278
279            // 기존 queryString이 있으면 유지함
280            var existingParams = new URLSearchParams(window.location.search);
281            var returnUrl = existingParams.has('returnUrl') ? existingParams.get('returnUrl') : window.location.pathname + window.location.search;
282            existingParams.set('returnUrl', returnUrl);
283
284            window.location.href = '/member/login.html?' + existingParams.toString();
285        });
286    });
287});
288$(document).ready(function() {
289    var myElement = document.querySelector("#header");
290    var headerWrap = document.querySelector("#header-wrap");
291    var headroom;
292
293    // 높이와 offset을 다시 계산하고 적용하는 통합 함수
294    function updateHeaderLayout() {
295        // 1. 스크롤이 내려가서 헤더가 고정(접힌) 상태라면, 정확한 측정을 위해 잠시 원래대로 폅니다.
296        var wasNotTop = myElement.classList.contains("headroom--not-top");
297        if (wasNotTop) {
298            myElement.classList.remove("headroom--not-top");
299        }
300
301        // 3. 다 펴진 상태에서 정확한 offset 재계산
302        var isMobile = window.matchMedia("(max-width: 1028px)").matches;
303        var targetElement = isMobile ? document.querySelector(".moBtmBar") : document.querySelector("#header .btmArea");
304        var newOffset = targetElement ? (targetElement.offsetTop + targetElement.offsetHeight + 100) : 100;
305
306        // 4. Headroom 객체가 이미 있다면 offset 갱신
307        if (headroom) {
308            headroom.offset = newOffset;
309        }
310
311        // 5. 측정이 끝났으니, 원래 고정 상태였었다면 다시 클래스를 붙여줌
312        if (wasNotTop) {
313            myElement.classList.add("headroom--not-top");
314        }
315
316        return newOffset;
317    }
318
319    // 초기 Headroom 세팅
320    headroom = new Headroom(myElement, {
321        "offset": updateHeaderLayout(), // 초기 계산 실행
322        "tolerance": 5,
323        "classes": {
324            "pinned": "slideDown",
325            "unpinned": "slideUp"
326        }
327    });
328    headroom.init();
329
330    // 리사이즈 이벤트 (setTimeout을 활용해 창 크기 조절이 끝났을 때만 계산하여 과부하 방지)
331    var resizeTimer;
332    window.addEventListener('resize', function() {
333        clearTimeout(resizeTimer);
334        resizeTimer = setTimeout(function() {
335            updateHeaderLayout();
336        }, 150); // 창 조절을 멈추고 0.15초 뒤에 한 번만 실행
337    });
338});
339
340
341$(document).ready(function(){
342    /* 상단 배너 */
343    var topBannerNum = $('.topBanner .swiper-slide').length ;
344    $(".topBanner").each(function () {
345        var topBannerId = $(this).attr("id");
346        if (topBannerNum > 0){
347            if (getCookie(topBannerId) != "topDone") {
348                $("#" + topBannerId).show();
349            }
350        } else {
351            $(".topBanner").hide();
352        }
353    });
354
355    if (topBannerNum > 1){
356        var topBanner = new Swiper(".topBannerSwiper", {
357            speed: 600,
358            direction: 'vertical',
359            slidesPerView: 1,
360            spaceBetween: 0,
361            centeredSlides: false,
362            loop: true,
363            autoplay: {
364                delay: 2500,
365                disableOnInteraction: false,
366            },
367        });
368    }
369
370    $(".topBannerClose").click(function(e) {
371        e.preventDefault();
372        var $topBanner = $(this).closest(".topBanner");
373        $topBanner.animate({ height: 0, opacity: 0 }, 500, function() {
374            $topBanner.hide();
375            $('#container').css('padding-top','0'); // 여백도 원래대로
376        });
377    });
378
379    $("#header .midArea .rightArea a.searchBtn").click(function(e) {
380        e.preventDefault();
381
382    });
383
384
385
386    var joinSwiper = new Swiper(".joinSwiper", {
387        autoplay: {
388            delay: 3000,
389            disableOnInteraction: false,
390        },
391        loop:true,
392        effect:'fade'
393    });
394
395
396    /* PC 전체 메뉴 */
397    $("#openAllCate").click(function(e) {
398        e.preventDefault();
399       $("#categoryBox").addClass("active").fadeIn();
400    });
401
402    $("#cateClosed").click(function(e) {
403        e.preventDefault();
404        $("#categoryBox").remove("active").fadeOut();
405    });
406
407
408    var menuSwiperNum = $('.menuSwiper .swiper-slide a');
409    var menuSwiper = new Swiper('.menuSwiper', {
410        //freeMode: true,
411        slidesPerView: 'auto',
412    });
413
414    $("#openAll").click(function(e) {
415        e.preventDefault();
416        $(this).parent().toggleClass('active');
417        if($('.rightPoint').hasClass('active')){
418            $('.foldArea').slideDown();
419            $('.foldDim').fadeIn();
420        } else {
421            $('.foldArea').slideUp();
422            $('.foldDim').fadeOut();
423        }
424    });
425
426    $('#categoryA .cateList > li > a').on('click', function () {
427        $(this).parent('li').toggleClass('on').siblings().removeClass('on');
428    });
429
430    $('.tabBox .tab').on('click', function (e) {
431        e.preventDefault();
432        var target = $(this).data('tab');
433        $(this).addClass('on').siblings().removeClass('on');
434        $('.tabConBox .tabCon').removeClass('on');
435        $('#' + target).addClass('on');
436    });
437
438    $('#closeAside').on('click', function (e) {
439        e.preventDefault();
440        $('#aside').fadeOut().removeClass('active');
441
442    });
443
444    $('#openAside').on('click', function (e) {
445        e.preventDefault();
446        $('#aside').fadeIn().addClass('active');
447
448    });
449
450
451    $('#footer .toggleInfo dl dt').on('click', function () {
452        var $dl = $(this).closest('dl');
453        var isOpen = $dl.hasClass('on');
454
455        $('#footer .toggleInfo dl').removeClass('on').find('dd').slideUp(200);
456        if (!isOpen) {
457            $dl.addClass('on').find('dd').slideDown(200);
458        }
459    });
460
461    addPriceDividers();
462
463
464    var $topBtm = $('#topBtm');
465
466    $topBtm.hide();
467
468    $(window).on('scroll', function () {
469        if ($(this).scrollTop() > 300) {
470            $topBtm.stop(true, true).fadeIn(300);
471        } else {
472            $topBtm.stop(true, true).fadeOut(300);
473        }
474    });
475
476
477
478   $('.moveTop').click(function () {
479        $('html, body').stop().animate({scrollTop:0}, 500);
480        return false;
481    });
482
483    $('.moveBtm').click(function () {
484        $('html, body').stop().animate({scrollTop:$(document).height()}, 500);
485        return false;
486    });
487});
488
489
490
491$(function () {
492    var $searchBtn = $('#header .searchBtn');
493    var $searchBox = $('#searchBox');
494    var $searchClosed = $('#searchBox .searchClosed');
495
496    $searchBtn.on('click', function (e) {
497        e.preventDefault();
498        e.stopPropagation();
499
500        $searchBox.addClass('on');
501        $searchBox.find('#keyword').focus();
502    });
503
504    $searchClosed.on('click', function (e) {
505        e.preventDefault();
506        e.stopPropagation();
507
508        $searchBox.removeClass('on');
509    });
510
511    $searchBox.on('click', function (e) {
512        e.stopPropagation();
513    });
514
515    $(document).on('click', function () {
516        $searchBox.removeClass('on');
517    });
518
519    $(document).on('keydown', function (e) {
520        if (e.key === 'Escape') {
521            $searchBox.removeClass('on');
522        }
523    });
524});
525
526window.addPriceDividers = function() {
527    $('.ec-base-product .spec').each(function() {
528        const $spec = $(this);
529
530        if ($spec.find('.price-divider-line').length > 0) {
531            return;
532        }
533
534        const $prdPriceSale = $spec.find('.prd_price_sale');
535        const $productPrice = $spec.find('.product_price');
536        const $priceCustom = $spec.find('.price_custom, .product_custom');
537
538        if ($prdPriceSale.length > 0) {
539            $prdPriceSale.before('<div class="price-divider-line"></div>');
540        } else if ($productPrice.length > 0) {
541            $productPrice.before('<div class="price-divider-line"></div>');
542        } else if ($priceCustom.length > 0) {
543            $priceCustom.before('<div class="price-divider-line"></div>');
544        }
545    });
546}
547;
548
549
550
551
552
553$(function () {
554
555    setTimeout(function () {
556        checkDiscount();
557    }, 500);
558
559    var discountTimer = null;
560
561    var observer = new MutationObserver(function (mutations) {
562        var hasNewProduct = false;
563
564        mutations.forEach(function (mutation) {
565            if (mutation.addedNodes.length > 0) {
566                hasNewProduct = true;
567            }
568        });
569
570        if (hasNewProduct) {
571            clearTimeout(discountTimer);
572
573            discountTimer = setTimeout(function () {
574                checkDiscount();
575            }, 200);
576        }
577    });
578
579    observer.observe(document.body, {
580        childList: true,
581        subtree: true
582    });
583
584    $(document).on('click', '.moreBtn a, .btn_moreview a', function () {
585        setTimeout(function () {
586            checkDiscount();
587        }, 300);
588
589        setTimeout(function () {
590            checkDiscount();
591        }, 700);
592
593        setTimeout(function () {
594            checkDiscount();
595        }, 1200);
596    });
597
598
599
600});
601
602
603function checkDiscount() {
604
605    $('.RNW_rate').each(function () {
606
607        var $this = $(this);
608
609        if ($this.find('.RNW_per').length === 0) {
610
611            var $rnwPer = $('<li class="RNW_per xans-record-"><span class="per"></span></li>');
612            var $reviewCnt = $this.find('.spec .review_cnt');
613
614            if ($reviewCnt.length > 0) {
615                $reviewCnt.before($rnwPer);
616            } else {
617                $this.find('.spec').append($rnwPer);
618            }
619        }
620
621        var data_arr = ($this.attr('data-price') || '^^').split('^');
622
623        var custom_price = cleanPrice(data_arr[0]);
624        var selling_price = cleanPrice(data_arr[1]);
625
626        var $discountRate = $this.find('.discount_rate');
627        var sale_price = cleanPrice($discountRate.attr('data-sale-price'));
628
629        setRate(
630            $this,
631            custom_price,
632            selling_price,
633            sale_price,
634            ''
635        );
636
637        $this.removeClass('noneSale hasSale');
638
639        if (sale_price === '') {
640            $this.addClass('noneSale');
641        } else {
642            $this.addClass('hasSale');
643        }
644
645        var $couPrice = $this.find('.priceOri .cou');
646
647        if ($couPrice.length && !$couPrice.hasClass('displaynone')) {
648            $this.addClass('couSale');
649        } else {
650            $this.removeClass('couSale');
651        }
652
653    });
654
655}
656
657
658function cleanPrice(price) {
659
660    if (price === undefined || price === null) {
661        return '';
662    }
663
664    return String(price).replace(/[^0-9.]/g, '');
665
666}
667
668
669function setRate(_this, _custom_price, _selling_price, _discounted_price, _coupon_price) {
670
671    var $this = _this;
672
673    var basePrice = parseFloat(_custom_price);
674
675    if (isNaN(basePrice) || basePrice === 0) {
676        basePrice = parseFloat(_selling_price);
677    }
678
679    var finalPrice = parseFloat(_coupon_price);
680
681    if (isNaN(finalPrice) || finalPrice === 0) {
682        finalPrice = parseFloat(_discounted_price);
683    }
684
685    if (isNaN(finalPrice) || finalPrice === 0) {
686        finalPrice = parseFloat(_selling_price);
687    }
688
689    var rate = 0;
690
691    if (
692        !isNaN(basePrice) &&
693        basePrice > 0 &&
694        !isNaN(finalPrice) &&
695        finalPrice > 0
696    ) {
697        rate = 100 - Math.round(finalPrice / basePrice * 100);
698    }
699
700    var $per = $this.find('.RNW_per');
701
702    if (rate > 0) {
703        $per
704            .addClass('on')
705            .find('.per')
706            .html(rate + '<i>%</i>');
707    } else {
708        $per
709            .removeClass('on')
710            .find('.per')
711            .empty();
712    }
713
714}
715
716
717
718function setCookie(name, value, expiredays) {
719    var today = new Date();
720    today.setDate(today.getDate() + expiredays);
721
722    document.cookie = name + '=' + escape(value) + '; path=/; expires=' + today.toGMTString() + ';'
723}
724
725function getCookie(name) {
726    var cName = name + "=";
727    var x = 0;
728    while (x <= document.cookie.length)
729    {
730        var y = (x + cName.length);
731        if (document.cookie.substring(x, y) == cName)
732        {
733            if ((endOfCookie = document.cookie.indexOf(";", y)) == -1)
734                endOfCookie = document.cookie.length;
735            return unescape(document.cookie.substring(y, endOfCookie));
736        }
737        x = document.cookie.indexOf(" ", x) + 1;
738        if (x == 0)
739            break;
740    }
741    return "";
742}
743
744
745

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.