PageSourceSearch

https://inthepaper.co.kr/data/skin/front/moment/js/gd_ui.js?ts=1735776115

js inthepaper.co.kr collected 2026-10-05 07:08:43 UTC 23,412 bytes, 657 lines download raw bytes

1$(function(){
2    if ($('#scroll_right, #scroll_left').length > 0) {
3        $('#scroll_right, #scroll_left').gb_quick_menu({
4            //HEADER_ID: '#header_warp'
5        });
6    }
7    // top으로 이동
8    $('.btn_top').click(
9        function() {
10            $('html, body').stop().animate({scrollTop: $('body').offset().top}, 300);
11            return false;
12        }
13    );
14});
15
16$(function(){
17    var cateArray = new Array('','','','');
18    var arrayNum = 0;
19    var menupage = 0;
20    var total_width = $('.gnb_menu_box').innerWidth();
21    var gd_display_cate = function(){
22        var depth1 = 0;
23        $('.gnb_menu_box > ul > li').each(function(){
24            cateArray[arrayNum] += "<li>"+$(this).html()+"</li>";
25            //240715 주영 2뎁스 카테고리 전체 노출
26            // depth1 += $(this).innerWidth();
27            // if(depth1 > total_width){
28            //     arrayNum++;
29            //     depth1 =0;
30            //     depth1 += $(this).innerWidth();
31            //     cateArray[arrayNum] += "<li>"+$(this).html()+"</li>";
32            // }else{
33            //     cateArray[arrayNum] += "<li>"+$(this).html()+"</li>";
34            // }
35        });
36        $('.gnb_menu_box > ul').html(cateArray[0]);
37        $('#header .gnb .depth0').css({
38            'overflow':'visible',
39            'height':'100%',
40        });
41    };
42    gd_display_cate();
43    /* 상단 메뉴 */
44    var gd_topmenu = function(){
45        //뮤자인 gnb 2뎁스 활성화 변경
46        // $('.depth0 li').on({
47        //     'mouseover':function(){
48        //         $(this).find('> ul').stop(true,true).fadeIn('fast');
49        //         $(this).find('> a').addClass('active');
50        //         //console.log('open');
51        //     },
52        //     'mouseleave':function(){
53        //         $(this).find('> ul').stop(true,true).fadeOut('fast');
54        //         $(this).find('> a').removeClass('active');
55        //         //console.log('hide');
56        //     }
57        // });
58
59        $('.gnb_depth1>li').on({
60            'mouseover':function(){
61                $(this).find('> ul').stop(true,true).fadeIn('fast');
62                $(this).find('> a').addClass('active');
63                //console.log('open');
64            },
65            'mouseleave':function(){
66                $(this).find('> ul').stop(true,true).fadeOut('fast');
67                $(this).find('> a').removeClass('active');
68                //console.log('hide');
69            }
70        });
71    };
72    gd_topmenu();
73
74
75
76    /* 메뉴 우측 버튼 */
77    $('.gnb_right').on({
78        'click':function(){
79            if(arrayNum > menupage){
80                menupage++;
81                if(menupage == arrayNum) $(this).find('a').addClass('active');
82                $('.gnb_left').find('a').removeClass('active');
83                $('.gnb_menu_box > ul').html(cateArray[menupage]);
84                gd_topmenu();
85            }
86        }
87    });
88    /* 메뉴 좌측 버튼 */
89    $('.gnb_left').on({
90        'click':function(){
91            if(arrayNum >= menupage && menupage != 0){
92                menupage--;
93                if(menupage == 0) $(this).find('a').addClass('active');
94                $('.gnb_right').find('a').removeClass('active');
95                $('.gnb_menu_box > ul').html(cateArray[menupage]);
96                gd_topmenu();
97            }
98        }
99    });
100
101
102
103    /* 전체메뉴 버튼 */
104    /*
105     $('.gnb_all').on({
106     'click':function(){
107     if($('.gnb_allmenu').css('display') =='none') $('.gnb_allmenu').stop(true,true).slideDown('fast');
108     else $('.gnb_allmenu').slideUp('fast');
109
110     }
111     });
112     */
113
114    $ ( '.layer_type .sub_depth0 li'). on ({
115        'mouseover': function () {
116            $ (this) .find ( '> ul'). stop (true, true) .fadeIn ( 'fast');
117            $ (this) .find ( '> a'). addClass ( 'active');
118            //console.log('open ');
119        },
120        'mouseleave': function () {
121            $ (this) .find ( '> ul'). stop (true, true) .fadeOut ( 'fast');
122            $ (this) .find ( '> a'). removeClass ( 'active');
123            //console.log('hide ');
124        }
125    });
126
127    /* 해외몰 홈아이콘 타입 선택형(국기) */
128    $('.top_country_list1 .country_tit').on({
129        'click':function(){
130            if($(this).parent().find('ul').css('display') =='none'){
131                $(this).addClass('active');
132                $(this).parent().find('ul').slideDown('fast');
133            }else{
134                $(this).parent().find('ul').slideUp('fast');
135                $(this).removeClass('active');
136            }
137        }
138    });
139
140    /* 해외몰 홈아이콘 타입 선택형(국기,언어) */
141    $('.top_country_list2 .country_tit').on({
142        'click':function(){
143            if($(this).parent().find('ul').css('display') =='none'){
144                $(this).addClass('active');
145                $(this).parent().find('ul').slideDown('fast');
146            }else{
147                $(this).parent().find('ul').slideUp('fast');
148                $(this).removeClass('active');
149            }
150        }
151    });
152
153    /* location 경로 */
154    // $('.location_select').on({
155    //     'mouseenter':function() {
156    //         if ($(this).find('ul').css('display') == 'none') {
157    //             $(this).find('.location_tit').addClass('active');
158    //             $(this).find('ul').slideDown('fast');
159    //         }
160    //     },
161    //     'mouseleave':function() {
162    //         $(this).find('ul').slideUp('fast');
163    //         $(this).find('.location_tit').removeClass('active');
164    //     }
165    // });
166
167    /* 상단 마이페이지 레이어 */
168    $('.top_mypage_cont').on({
169        'mouseenter':function(){
170            if($(this).find('ul').css('display') =='none'){
171                $(this).find('.top_mypage_tit').addClass('active');
172                $(this).find('ul').show();
173            }
174        },
175        'mouseleave':function(){
176            $(this).find('ul').hide();
177            $(this).find('.top_mypage_tit').removeClass('active');
178        }
179    });
180
181    /* 상단 검색 */
182    $('.top_search_cont input[name="keyword"]').on({
183        'focus':function(){
184            if($("input[name=recentCount]").val() > 0) {
185                $(this).parents().find('.search_cont').show();
186                $('body').css('overflow-y', 'hidden');
187            }
188        },
189        'blur':function(){
190            $('body').click(function(e){
191                if (!$('.search_cont').has(e.target).length && e.target.name != 'keyword') {
192                    $(this).parents().find('.search_cont').hide();
193                    $('body').css('overflow-y', 'auto')
194                }
195            });
196            $('.btn_top_search_close').click(function(){
197                $(this).parents().find('.search_cont').hide();
198            });
199        }
200    });
201
202    /* 레이어, 추가 내용 */
203    $('.btn_common_box, .btn_layer').find('a').on({
204        'click':function(e){
205            var tg = $(this).attr('href');
206            if(tg.substr(0, 1) == '#'){
207                e.preventDefault();
208                if($(tg).css('display') == 'none'){
209                    $('.layer_area').hide()
210                    $(tg).show();
211                    $(tg).find('.ly_close').attr('href',tg);
212                }else{
213                    $(tg).hide();
214                }
215            }
216        }
217    });
218    $('.ly_close').on({
219        click:function(){
220            var tg = $(this).attr('href');
221            if (tg.substr(0, 1) == '#') {
222                $(tg).hide();
223            }
224
225            if ($(this).parents('.js_password_layer').length) {
226                $('.js_password_layer').find('input[name="writerPw"]').val('');
227            }
228        }
229    });
230});
231
232
233function gd_btn_all_menu_close(){
234    $('.gnb_allmenu').slideUp('fast');
235}
236
237$(document).ready(function() {
238    /* 퀵검색 */
239    var qs_id = $('#quick_search');
240    var cname = qs_id.attr('class');
241    var position, position_m;
242
243    if(cname == 'q_left'){
244        position = qs_id.innerWidth();
245        qs_id.css('left','-'+position+'px');
246    }else if(cname == 'q_right'){
247        position = qs_id.innerWidth();
248        qs_id.css('right','-'+position+'px');
249    }else{
250        $(window).load(function(){
251            position = qs_id.innerHeight();
252            qs_id.css('top','-'+position+'px');
253        });
254    }
255    position_m = position;
256
257    function gd_quick_motion(){
258
259        if(cname == 'q_left'){
260            if(qs_id.css('left') == '0px') position_m = '-'+ position;
261            else position_m = 0;
262
263            qs_id.animate({
264                left : position_m
265            }, 500, function(){
266                //console.log(position_m);
267            });
268        }else if(cname =='q_right'){
269            if(qs_id.css('right') == '0px') position_m = '-'+ position;
270            else position_m = 0;
271
272            qs_id.animate({
273                right : position_m
274            }, 500, function(){
275                //console.log(position_m);
276            });
277        } else {
278            if(qs_id.css('top') == '0px') position_m = '-'+ position;
279            else position_m = 0;
280
281            qs_id.animate({
282                top : position_m
283            }, 500, function(){
284                //console.log(position_m);
285            });
286
287        }
288        if(position_m == 0) $('.quick_search_cont').addClass('on');
289        else $('.quick_search_cont').removeClass('on');
290    }
291    $('#quick_search .btn_quick_search_open, #quick_search .btn_quick_search_close').on({
292        'click':function(){
293            gd_quick_motion();
294        }
295    });
296
297    /* 퀵검색 컬러 & 혜택조건 */
298    $('.color_box span label, .benefit_box span label').on({
299        'click':function(){
300            if(!$(this).parent().find('input').is(':checked')) $(this).addClass('active');
301            else $(this).removeClass('active');
302        }
303    });
304
305    $('.btn_all_menu_open').on('click',function(){
306        gd_btn_all_menu_open();
307    });
308
309
310});
311
312
313
314
315// 레이어박스 센터정렬 플러그인 (최상단)
316jQuery.fn.center = function() {
317    var top = ($(window).height() - this.outerHeight()) / 2;
318    var left = ($(window).width() - this.outerWidth()) / 2;
319
320    this.css({
321        position:'absolute',
322        margin:0,
323        top: (top > 0 ? top : 0) + 'px',
324        left: (left > 0 ? left : 0) + 'px'
325    });
326
327    return this;
328};
329
330// 레이어박스 센터정렬 플러그인 (현재위치)
331jQuery.fn.currentCenter = function() {
332    this.css({
333        'position': 'fixed',
334        'left': '50%',
335        'top': '50%'
336    });
337
338    this.css({
339        'margin-left': -this.outerWidth() / 2 + 'px',
340        'margin-top': -this.outerHeight() / 2 + 'px'
341    });
342
343    return this;
344};
345
346/* 스크롤배너(오른쪽) */
347(function (){
348    $.fn.gb_quick_menu = function(options){
349        //초기값
350        var defaults = {
351            HEADER_ID: '.scroll_wrap',
352            FIXED_CLS: 'ban_fixed',
353            FIXED_SIZE :1450,
354            LEFT_QUICK_ID : '#scroll_left',
355            CONTENTS_WARP : '#wrap',
356        };
357        //초기값 옵션 배열 저장
358        var options = $.extend({}, defaults, options);
359        var el = $(this);
360        var scqTop = 0;
361        var quickTop = $(options.HEADER_ID).offset().top;
362        var qucik_left = $(options.LEFT_QUICK_ID).css('left');
363
364        $(window).on({
365            'resize':function(){
366
367            },
368            'scroll':function(){
369                var win_width = $(window).innerWidth();
370                scqTop = $(this).scrollTop();
371                if(scqTop <= quickTop){
372                    el.removeClass(options.FIXED_CLS).removeAttr('style');
373                }else{
374                    if(win_width > options.FIXED_SIZE){
375                        el.addClass(options.FIXED_CLS).removeAttr('style');
376                    }else{
377                        el.removeClass(options.FIXED_CLS).removeAttr('style');
378                        el.stop(true,true).css('top', (scqTop-quickTop+20));
379
380                    }
381                }
382            }
383        });
384        var gd_leftmove = function(){
385            var win_width = $(window).innerWidth();
386            if(win_width <= options.FIXED_SIZE){
387                gd_left_animate(qucik_left);
388            }else{
389                gd_left_animate(0);
390            }
391        };
392        var gd_left_animate = function(left_quick_position){
393            $('#wrap').stop(true,true).animate({
394                'marginLeft':left_quick_position,
395            },'5000',function(){
396
397            });
398        };
399        $(window).load(function(){
400
401        })
402    };
403})(jQuery);
404
405// 체크박스 처리 로직 초기화
406function gd_init_checkbox_ui() {
407    $(document).on('click', 'input[type=radio]', function(e){
408        $(this).parents('form:first').find("input[name='" + $(this).prop("name") + "']").each(function() {
409            if ($(this).prop("checked")) {
410                // $("label[for=" + $(this).attr("id") + "]").addClass("on");
411                $(this).prop('checked',true)
412            } else {
413                $(this).prop('checked',false)
414                // $("label[for=" + $(this).attr("id") + "]").removeClass("on");
415            }
416        });
417    });
418
419    $(document).on('click', 'input[type=checkbox]', function(e){
420        if($(this).prop('readonly') === false) {
421            if($(this).prop("checked")) {
422                // $("label[for="+$(this).attr("id")+"]").addClass("on");
423                $(this).prop('checked',true)
424            } else {
425                // $("label[for="+$(this).attr("id")+"]").removeClass("on");
426                $(this).prop('checked',false)
427                $('.gd_checkbox_all').prop('checked', false);
428            }
429        } else {
430            e.preventDefault();
431        }
432    });
433}
434
435// 라디오박스,체크박스 이미지화 스크립트
436function gd_trigger_checkbox_ui() {
437    var $input = $('input[type=radio], input[type=checkbox]');
438    // 템플릿에서 check 처리한 경우 예외처리 추가
439    if(!$input.find('label.on')){
440        $input.each(function(){
441            var $item = $("label[for="+$(this).attr("id")+"]");
442            if($(this).prop("checked")) {
443                $item.addClass("on");
444            } else {
445                $item.removeClass("on");
446            }
447        });
448    }
449}
450
451// 체크박스 전체 선택
452function gd_checkbox_all() {
453    // 체크박스 전체 선택 이벤트
454    if ($(':checkbox.gd_checkbox_all').length > 0) {
455        // 이벤트 중복 실행을 막아준다.
456        $(':checkbox.gd_checkbox_all').off('click');
457        $(':checkbox.gd_checkbox_all').click(function (e) {
458            var $target = $(e.target);
459            var targetName = $target.data('target-name');
460            var targetId = $target.data('target-id');
461            var targetFormName = $target.data('target-form');
462            if (typeof targetFormName == 'undefined') targetFormName = "";
463            if (_.isUndefined(targetId)) {
464                $(targetFormName + ' :checkbox[name="' + targetName + '"]').prop('checked', !$target.prop('checked')).trigger('click');
465            } else {
466                $(targetFormName + ' :checkbox[id*="' + targetId + '"]').prop('checked', !$target.prop('checked')).trigger('click');
467            }
468        });
469    }
470}
471
472// 레이어 박스 이벤트
473function gd_center_layer(){
474    //$('.btn_open_layer').off('click');
475    $(document).on('click', '.btn_open_layer', function() {
476        // @qnibus 레이어 안에 레이어가 있는 경우 종속된 보이지 않는 레이어가 이미 떠있는 레이어 기준으로 center 처리 되어 보여져 레이아웃이 깨짐
477        $('.layer_wrap').removeAttr('style');
478        $('body').css('overflow','hidden');
479        var target = $(this).attr('href');
480        $(target).removeClass('dn');
481        $('#layerDim').removeClass('dn');
482        $(target).find('> div').center();
483
484        return false;
485    });
486
487    $(document).on('click', '.layer_wrap .layer_close, .btn_box .btn_cancel', function(){
488        $(this).closest('.layer_wrap').addClass('dn');
489        // 창이 2개 이상 떠있는 경우 Dim처리 안되게
490        if (!$('.layer_wrap').is(':visible')) {
491            $('#layerDim').addClass('dn');
492            $('body').removeAttr('style');
493        }
494        return false;
495    });
496}
497
498// 레이어 박스 창닫기 (현재 열려 있는 창만 닫는다)
499function gd_close_layer() {
500    if ($('.layer_wrap').is(':visible') || $('#layerDim').is(':visible')) {
501        if ($('.layer_wrap .layer_close, .btn_box .btn_cancel').length > 0) {
502            $('.layer_wrap .layer_close, .btn_box .btn_cancel').trigger('click');
503        } else {
504            // 딤만 떠있는 경우
505            $('.layer_wrap').addClass('dn');
506            $('#layerDim').addClass('dn');
507        }
508    }
509}
510
511// chosen 셀렉트 박스
512function gd_select_remodeling() {
513    var selector = '.chosen-select';
514    var config = {
515        disable_search_threshold: 10000,
516        no_results_text: __('검색결과가 없습니다.')
517    };
518
519    if ($(selector).length > 0) $(selector).chosen(config);
520}
521
522// 카트탭 레이어
523function gd_carttab_layer() {
524    $('.cart_tab_list li > a').on({
525        'click':function() {
526            if ($(this).hasClass('btn_alert_login') == false) {
527                $('.btn_shop_cart_box .btn_shop_cart_close').show();
528                $(this).parent().addClass('on').siblings().removeClass('on');
529                $('#shop_cart_wrap .shop_cart_cont > .cart_tab_box').eq($(this).index()).fadeIn('fast').siblings().removeClass('on').hide();
530                $('.shop_cart_cont').slideDown('fast');
531                gd_cart_tab_action($(this).attr('href'));
532            }
533        }
534    });
535
536    $('.btn_shop_cart_box .btn_shop_cart_open, .btn_shop_cart_box .btn_shop_cart_close').on({
537        'click':function() {
538            if ($('.shop_cart_cont').css('display') != 'none') {
539                $('.shop_cart_cont').slideUp('fast');
540                $('.btn_shop_cart_box .btn_shop_cart_close').hide();
541                $('.btn_shop_cart_box .btn_shop_cart_open').show();
542                $('.cart_tab_list li').removeClass('on');
543            } else {
544                $('.cart_tab_list li').eq(0).addClass('on');
545                $('.cart_tab_box').eq(0).addClass('on');
546                $('.shop_cart_cont').slideDown('fast');
547                $('.btn_shop_cart_box .btn_shop_cart_close').show();
548                $('.btn_shop_cart_box .btn_shop_cart_open').hide();
549                $('#shop_cart_wrap .shop_cart_cont > .cart_tab_box').hide().eq(0).fadeIn('fast');
550                gd_cart_tab_action('#cart_tab_today');
551            }
552
553            $('.chart_view_horizontal ul').slick('reinit');
554        }
555    });
556}
557
558// 파일첨부 꾸미기
559function gd_file_attach() {
560    $(document).on('change', '.file_upload_sec .file', function(){
561        var i = $(this).val();
562        $('label[for=' + $(this).attr('id') + ']').find('.file_text').val(i);
563    });
564}
565
566/*
567 카테고리/브랜드 카테고리 마우스 오버
568 */
569function gd_menu_over() {
570
571    $(document).on('mouseenter mouseleave', 'img.gd_menu_over', function (event) {
572        $(this).attr({
573            src: $(this).attr('data-other-src')
574            , 'data-other-src': $(this).attr('src')
575        });
576
577    });
578
579    $(document).on('mouseenter', 'span.gd_menu_over', function (event) {
580        var width = $(this).closest("strong").width();
581        var height = $(this).closest("strong").height() - 7;
582        $(this).html("<img src='" + $(this).data('other-src') + "' style='max-width:" + width + "px;max-height:" + height + "px'>");
583
584    });
585
586    $(document).on('mouseleave', 'span.gd_menu_over', function (event) {
587        $(this).html($(this).data('other-text'));
588    });
589}
590
591function gd_btn_all_menu_open(){
592
593    $.ajax({
594        method: "POST",
595        cache: false,
596        url: "/goods/goods_ps.php",
597        data: "mode=get_all_category",
598        success: function(data) {
599            var getData = $.parseJSON(data);
600            if(data =='false') {
601                $(".gnb_allmenu_box").html('');
602            }else{
603                var addHtml = '<div class="gnb_allmenu" style="display:none;"><div class="gnb_allmenu_box">'
604                addHtml += '<ul>';
605                $.each(getData, function (categoryKey, categoryVal) {
606                    $.each(categoryVal, function (key, val) {
607                        addHtml += '<li style="width:20%;"><div class="all_menu_cont"><a href="../goods/goods_list.php?cateCd='+val.cateCd+'">'+val.cateNm+'</a>';
608                        if(val.children) {
609                            addHtml += '<ul class="all_depth1">';
610                            $.each(val.children, function (key1, val1) {
611                                addHtml += '<li><a href="../goods/goods_list.php?cateCd='+val1.cateCd+'">'+val1.cateNm+'</a>';
612                                if(val1.children) {
613                                    addHtml += '<ul class="all_depth2">';
614                                    $.each(val1.children, function (key2, val2) {
615                                        addHtml += '<li><a href="../goods/goods_list.php?cateCd='+val2.cateCd+'">'+val2.cateNm+'</a>';
616                                        if(val2.children) {
617                                            addHtml += '<ul class="all_depth3">';
618                                            $.each(val2.children, function (key3, val3) {
619                                                addHtml += '<li><a href="../goods/goods_list.php?cateCd='+val3.cateCd+'">'+val3.cateNm+'</a></li>';
620                                            });
621                                            addHtml += '</ul>';
622                                        }
623                                        addHtml += '</li>';
624                                    });
625                                    addHtml += '</ul>';
626                                }
627                                addHtml += '</li>';
628                            });
629                            addHtml += '</ul>';
630                        }
631                        addHtml += '</div></li>';
632                    });
633                });
634                addHtml += '</ul>';
635                addHtml += '</div><span class="btn_all_menu_close" onClick="gd_btn_all_menu_close();">전체메뉴닫기</span></div>'
636                $(".gnb_allmenu_wrap").html(addHtml);
637                $('.gnb_allmenu').stop(true,true).slideDown('fast');
638            }
639        },
640        error: function (data) {
641            alert(data.message);
642        }
643    });
644
645};
646
647// 함수 호출
648$(document).ready(function() {
649    gd_init_checkbox_ui();
650    gd_trigger_checkbox_ui();
651    gd_checkbox_all();
652    gd_center_layer();
653    gd_carttab_layer();
654    gd_select_remodeling();
655    gd_file_attach();
656    gd_menu_over();
657});

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.