PageSourceSearch

https://jun-world.com/data/skin/front/dcoms_junworld_re/js/gd_ui.js?ts=1763946416

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

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.