PageSourceSearch

https://lh.or.kr/main/js/layout.js?20261001202939

js lh.or.kr collected 2026-10-01 11:31:58 UTC 22,698 bytes, 678 lines download raw bytes

1/*-------------------------------------------------
2title       : 레이아웃
3Author      : 플랜아이
4Create date : 2023-07
5-------------------------------------------------*/
6
7$(function()
8{
9    $(window).on("load",function(){
10        $("#wrap").addClass("load");
11
12        //게시글 상세페이지 중 <title>, <meta> 태그 가져오는 부분 제거
13        if($(".board_view .contents").find("title").length || $(".board_view .contents").find("meta").length){
14            $(".board_view .contents title, .board_view .contents meta").remove();
15            $("body").removeAttr("style");
16        }
17    });
18
19    //반응형 뉴스룸 메인 이동 버튼 메뉴에 추가
20    $(".topmenu_all > li > a").each(function(){
21        let t = $(this);
22        let link = "<li class='mobile'><a href='/user/news/main?mid=a10501000000'>뉴스룸 메인</a></li>";
23        if(t.text() == "뉴스룸"){
24            t.closest("li").find(".submenu ul").prepend(link);
25        }
26    });
27
28    //자막보기 버튼
29    $(document).on("click",".video_box .txt_view",function(){
30        let t = $(this);
31        if(!t.hasClass("active")){
32            t.addClass("active").text("자막닫기");
33            t.closest(".video_box").addClass("active");
34        }else{
35            t.removeClass("active").text("자막보기");
36            t.closest(".video_box").removeClass("active");
37        }
38    })
39
40    //스크롤 시 헤더 고정
41    $(window).on("load scroll",function(){
42        let topB = $(".topbanner .group"),
43            scrT = $(this).scrollTop()
44            wrap = $("#wrap")
45            gap = 10;
46
47        if(topB.css("visibility") == "hidden" || topB.is(":hidden")){ //탑배너 없는 경우
48            if(scrT > gap){
49                headerFix();
50            }else{
51                headerFixOff();
52            }
53        }else{ //탑배너 있을 경우
54            if(scrT > (topB.height() + gap)){
55                headerFix();
56            }else{
57                headerFixOff();
58            }
59        } 
60    });
61
62    function headerFix(){
63        wrap.addClass("fixed");
64    }
65
66    function headerFixOff(){
67        wrap.removeClass("fixed");
68    }
69
70    //레이어팝업
71    if ($(".modal").length) {
72        modal();
73    }
74
75    function modal() {
76        let link;
77        $(".modal").each(function () {
78            $(this).find(".modal_box").attr("tabindex", "0");
79            if ($(this).hasClass("visible")) {
80                $("html").css("overflow", "hidden");
81            } else {
82                $("html").attr("style", false);
83            }
84
85            if($(this).find(".video_box").length){
86                $(this).find(".video_box").attr("tabindex", "0");
87            }
88        });
89
90        $(document).on("click", ".modal_open", function () {
91            let anchor = $(this).attr("href");
92            $("html").css("overflow", "hidden");
93            $("#area_quick .more").addClass("active");
94            if($(anchor).find(".video_box").length){
95                $(anchor).find(".video_box").removeClass("active");
96                $(anchor).find(".txt_view").removeClass("active").text("자막보기");
97                $(anchor).fadeIn("fast").find(".video_box").focus();
98            }else{
99                $(anchor).fadeIn("fast").find(".modal_box").focus();
100            }
101
102            link = $(this);
103            return false;
104        });
105
106        $(".modal .modal_close").on("click", function () {
107            $("html").attr("style", false);
108            $(this).closest(".modal").fadeOut("fast");
109            $("#area_quick .more").removeClass("active");
110            if (link != undefined) {
111                link.focus();
112            }
113
114            return false;
115        });
116
117        $(".modal .modal_close").keydown(function (e) {
118            let t = $(this);
119            if (e.keyCode == 9) {
120                if(t.closest(".modal_box").length){
121                    t.closest(".modal_box").focus();
122                }else if(t.closest(".video_box").length){
123                    t.closest(".video_box").focus();
124                }
125            }
126        })
127    }
128
129    //상, 하단 이동 버튼 클릭
130    $(".btn_top").on("click",function(){
131        $("html, body").animate({scrollTop:0}, 500);
132        $("#wrap").focus();
133
134        return false;
135    });
136
137    $(".btn_bot").on("click",function(){
138        $("html, body").animate({scrollTop:$(document).height()}, 500);
139        $("#siteinfo").focus();
140    });
141    
142    // 사이트바로가기
143    $('.hnb1').classtoggle
144    ({
145        'button'            : '.label',     // 이벤트 받을 타겟 선택
146        'respond'           : true,         // 반응형일 때 (true 시 반응형일때 가로 사이즈 이하에서만 / click 일때만)
147        'respondWidth'      : '1024',       // 반응형 가로 사이즈
148    });
149
150    // 언어
151    $('.lang').classtoggle
152    ({
153        'button'            : '.active'  // 이벤트 받을 타겟 선택
154    });
155
156    // 검색어
157    $('.search').classtoggle();
158
159    $('.search .open').on("click",function(){
160        $("#mo_link").focus();
161    });
162    $('.search .close').on("click",function(){
163        $(".header_wrap, #gnb2").removeClass("active");
164    });
165
166    // 주메뉴
167    $('#gnb1').gnb1();
168
169    //태블릿(갤럭시탭 1280이하)에서 gnb 1뎁스메뉴 터치 시 하위메뉴 표출(뉴스룸은 서브메인이 있기 때문에 제외)
170    $('#gnb1 .topmenu > li > a').on("click",function(){
171        if($(window).width() <= 1280){
172            if($(this).text() != "뉴스룸"){
173                return false;
174            }
175        }
176    });
177
178    // 전체메뉴이자 모바일 메뉴
179    $('#gnb2 .control.open').on('click', function () {
180        if ($('#header').hasClass('active')) {
181            $('#header, #gnb1 li').removeClass('active');
182        }
183        //topbanner 여부 확인
184        if($(".topbanner").length){
185            if($(".topbanner .group").css("visibility") == "visible"){
186                $("#gnb2").addClass("topBnr");
187            }else{
188                $("#gnb2").removeClass("topBnr");
189            }
190        }
191    });
192
193    // topbanner 닫을 경우
194    $(".topbanner .control.close").on("click",function(){
195        $("#gnb2").removeClass("topBnr");
196    });
197
198
199    $('#gnb2').gnb2();
200
201    //하위 메뉴 있을 시
202    $('#head_menu .submenu > ul > li, #head_menu_all .submenu > ul > li').each(function(){
203        let t = $(this);
204        t.find("ul").length ? t.addClass("__plus") : t.removeClass("__plus");
205    });
206
207    /*------------------------------------------------- 하단배너 -------------------------------------------------*/
208    
209    // 컨트롤러 추가
210    $('.footbanner').find('.list').after('<div class="control"><button class="prev">이전</button><button class="next">다음</button><button class="play">재생</button><button class="pause active">정지</button><div class="pager"></div></div>');
211
212    // 스와이퍼
213    if($(".footbanner").length){
214        var footbanner = new Swiper(".footbanner", 
215        {
216            autoplay                : 
217            {
218                delay               : 2500,
219                disableOnInteraction: false,
220            },
221            wrapperClass            : "list",
222            slideClass              : "list > li",
223            slidesPerView           : 6,
224            slidesPerGroup : 1,
225            spaceBetween            : 45,
226            //loop                    : true,
227            //loopAdditionalSlides    : 1,            // 슬라이드 반복 시 마지막 슬라이드에서 다음 슬라이드가 보여지지 않는 현상 수정
228            navigation              : 
229            {
230                nextEl              : ".footbanner .next",
231                prevEl              : ".footbanner .prev",
232            },
233            breakpoints             : 
234            {
235                1200:{
236                    slidesPerView:6,
237                },
238                1024:{
239                    slidesPerView:5,
240                },
241                960:{
242                    slidesPerView:4,
243                },
244                500:{
245                    slidesPerView:3
246                },
247                320 :
248                {
249                    slidesPerView:2,
250                    spaceBetween    : 13,
251                }
252            },
253            /* on: {
254                slideChange: function () {
255                    $('.footbanner .swiper-slide').find('a').attr('tabindex', '-1');
256                    $('.footbanner .swiper-slide').eq(this.activeIndex).find('a').attr('tabindex', '0');
257                    $('.footbanner .swiper-slide-duplicate a').attr('tabindex', '-1');
258                }
259            } */
260        });
261        swiperoption('.footbanner', footbanner);
262    }
263
264    // 풋배너 슬라이드
265    /* var $footbanner = $('.footbanner .list');
266
267    $footbanner.bxSlider
268    ({
269        pager       : false,
270        auto        : true,
271        autoHover   : true,
272        maxSlides   : 9,
273        minSlides   : 2,
274        moveSlides  : 1,
275        slideWidth  : 160
276    }); */
277
278    // 퀵메뉴
279    /* $('#quick').classtoggle(); */
280    let breakP = 1730;
281    $("#quick .open").on("click",function(){
282        let wSize = $(window).width();
283        if(wSize > breakP){
284            $("#quick, #quick .group").removeClass("hide");
285        }else{
286            $("#quick").addClass("hide");
287        }
288    });
289
290    $("#quick .close").on("click",function(){
291        let wSize = $(window).width();
292        if(wSize > breakP){
293            $("#quick").addClass("hide");
294            setTimeout(function(){
295                $("#quick .group").addClass("hide");
296            },500);
297        }else{
298            $("#quick, #quick .group").removeClass("hide");
299        }
300    });
301
302    // 위로가기 활성화
303    $(window).on('scroll load', function()
304    {
305        if ( $('html, body').scrollTop() > 300 )
306        {
307            $('#footer .btn-top').addClass('active');
308        }
309        else
310        {
311            $('#footer .btn-top').removeClass('active');
312        }
313    });
314
315    // 위로가기
316    $('#footer .btn-top').on('click', function()
317    {
318        $('html, body').animate({scrollTop: $(this.hash).offset().top});
319        
320        $(this.hash).focus();
321
322        return false;
323    });
324
325
326    // 관련사이트
327    $('.related .group').classtoggle
328    ({
329        'button'            : '.label'  // 이벤트 받을 타겟 선택
330    });
331
332    // 관련사이트
333    $('.gnb_list .list').classtoggle
334    ({
335        'button'            : '.gnb_list a',      // 이벤트 받을 타겟 선택
336    });
337});
338
339//주메뉴
340$.fn.gnb1 = function( options )
341{
342    var settings = $.extend
343    ({
344        'actionType'        : 'mouseenter focusin',     // 메뉴가 동작하는 액션 (mouseenter focusin, click)
345        'target'            : '#header',                // 활성화 시 클래스가 추가되는 요소 (공란일 경우 오버되는 a 링크 부모 li에만 í
345´ëž˜ìФ 추가됨)        
346        'class'             : 'active',                 // 추가할 클래스명 (target에 추가됨)
347        'depth2'            : '.submenu',               // 서브메뉴
348        'closeBtn'          : '.close'                  // 닫기 버튼이 별도로 존재하는 경우 (닫기 버튼은 클릭시에만)
349    }, 
350    options );
351
352    return this.each(function()
353    {
354        var $selecter = $(this);
355
356        $selecter.find('a').on(settings.actionType, function()
357        {
358            if ( $(this).parent('li').hasClass('active') == false )
359            {
360                $(this).parents('li').addClass('active');
361                $(this).parents('li').siblings('li').removeClass('active');
362                $(this).parents('li').siblings('li').find('li').removeClass('active');
363
364                if (settings.target != '')
365                {
366                    $(settings.target).addClass(settings.class);
367                    $("#header .search_keyword").addClass("change_ph");
368                }
369            }
370
371            if ( settings.actionType == 'click' )
372            {
373                if ( $(this).next('*').length > 0 )
374                {
375                    return false;
376                }
377            }
378        });
379
380        if ($selecter.find(settings.closeBtn).length == 1)
381        {
382            $selecter.find(settings.closeBtn).on('click', function()
383            {
384                $selecter.find('li').removeClass(settings.class);
385                $(settings.target).removeClass(settings.class);
386
387                return false;
388            });
389        }
390        else
391        {
392            // 마우스 아웃
393            $(document).on('mousemove', function(e)
394            {
395                cursorY = e.pageY;
396
397                if ( $selecter.find('li.active').length > 0 )
398                {
399                    if (cursorY > parseInt($selecter.find(settings.depth2).offset().top + $selecter.find('.active').find(settings.depth2).height()) )
400                    {
401                        setTimeout(function()
402                        {
403                            closeMenu();
404                        }, 200);
405                    }
406                }
407            });
408
409            $(".topmenu").on("mouseleave",function(){
410                closeMenu();
411            });
412
413            function closeMenu(){
414                $selecter.find('li').removeClass(settings.class);
415                $(settings.target).removeClass(settings.class);
416                $("#header .search_keyword").removeClass("change_ph");
417            }
418        }
419
420        // 탭 아웃
421        $selecter.find('a:last').keydown(function(e) 
422        {
423            if(e.keyCode === 9) 
424            {
425                $selecter.find('li').removeClass(settings.class);
426                $(settings.target).removeClass(settings.class);
427            }
428        });
429
430        // 역탭 아웃
431        $selecter.find('a:first').keydown(function(e) 
432        {
433            if(e.keyCode === 9 && e.shiftKey) 
434            {
435                $selecter.find('li').removeClass(settings.class);
436                $selecter.removeClass(settings.classname);
437            }
438        });
439    });
440};
441
442//전체메뉴
443$.fn.gnb2 = function( options )
444{
445    var settings = $.extend
446    ({
447        'btnOpen'           : '.open',      // 최초 메뉴를 여는 버튼
448        'btnClose'          : '.close',     // 닫기 버튼이 별도로 존재하는 경우
449        'classAdd'          : '#gnb2, .header_wrap',      // 활성화 시 클래스가 추가되는 요소
450        'className'         : 'active',     // 추가할 클래스명 (classAdd에 추가됨)
451        'siblings'			: true,		    // active 될 때 형제요소의 반응 여부
452        'responsive'        : true,         // 반응형일 때 (true 시 반응형일때 가로 사이즈 이하에서만 / false 시 반응형 아닐 때도 클릭 동작함)
453        'responsiveWidth'   : '1024'        // 반응형 가로 사이즈
454    }, 
455    options );
456
457    return this.each(function()
458    {
459        var $selecter = $(this);
460
461        $(window).on("load resize",function(){
462            if ( $(this).width() > settings.responsiveWidth ){
463                $(".topmenu_all > li").on("mouseleave focusout",function(){
464                    $(this).parent().find('li').removeClass('on');
465                });
466            }
467            if ($(window).width() > settings.responsiveWidth) {
468                $selecter.find('a').on("mouseenter focusin", function () {
469                    if ($(this).parent('li').hasClass('on') == false) {
470                        $(this).parents('li').addClass('on');
471                        $(this).parents('li').siblings('li').removeClass('on');
472                        $(this).parents('li').siblings('li').find('li').removeClass('on');
473                    }
474                });
475            }
476        });
477
478        // 열기
479        $selecter.find(settings.btnOpen).on('click', function()
480        {
481            if ( $selecter.find(settings.btnClose).length > 0 )
482            {            
483                $(settings.classAdd).addClass(settings.className);
484                $("html").css("overflow","hidden");
485            }
486            else
487            {
488                if ( $(settings.classAdd).hasClass(settings.className) == false )
489                {
490                    $(settings.classAdd).addClass(settings.className);
491                }
492                else
493                {
494                    $(settings.classAdd).removeClass(settings.className);
495                }
496            }
497
498            return false;
499        });
500        
501        // 닫기
502        if ( $selecter.find(settings.btnClose).length > 0 )
503        {
504            $selecter.find(settings.btnClose).on('click', function()
505            {
506                $(settings.classAdd).removeClass(settings.className);
507                $("html").removeAttr("style");
508
509                return false;
510            });
511        };
512
513        // 메뉴 클릭 이벤트
514        function menuAction($this)
515        {
516            if ( $this.next('*').length > 0 && $this.next('*').css('display') != 'none' )
517            {
518                if ( $this.parent('li').hasClass('active') == false )
519                {
520                    $this.parent('li').addClass('active');
521                    $this.closest("ul").addClass('active');
522					//$this.attr("aria-expanded","true");
523					//$this.parent('li').parent('a').attr("aria-expanded","true");
524
525                    if ( settings.siblings == true )
526                    {
527                        $this.parent('li').siblings('li').removeClass('active');
528                    }
529                }
530                else
531                {
532                    //$this.parent('li').removeClass('active');
533                    //$this.closest("ul").removeClass('active');
534                }
535
536                event.preventDefault();
537            }      
538        }
539
540        // 메뉴
541        $selecter.find('li a').on('click', function(e)
542        {
543		    //$selecter.find('li a').attr("aria-expanded","false");
544            if ( settings.responsive == true )
545            {
546                if ( $(window).width() <= settings.responsiveWidth )
547                {
548                    menuAction($(this));
549                }
550            }
551            else
552            {
553                menuAction($(this));
554            }
555        });
556    });
557};
558
559//클래스토글
560$.fn.classtoggle = function( options )
561{
562    var settings = $.extend
563    ({
564        'button'            : '.open',      // 이벤트 받을 타겟 선택
565        'action'            : 'click',      // 액션 선택 (click | over)
566        'classname'         : 'active',     // 추가할 클래스명
567        'accordion'			: false,		// active 될 때 형제요소의 반응 여부
568        'respond'           : false,        // 반응형일 때 (true 시 반응형일때 가로 사이즈 이하에서만 / click 일때만)
569        'respondWidth'      : '768',        // 반응형 가로 사이즈
570        'close'             : '.close'      // 닫기 버튼이 별도로 존재하는 경우 (닫기 버튼은 클릭시에만)
571    }, 
572    options );
573
574    return this.each(function()
575    {
576        var $selecter = $(this);
577
578        function clickActive()
579        {
580            if ( $selecter.hasClass(settings.classname) == false )
581            {
582                $selecter.addClass(settings.classname);
583
584                if (settings.accordion == true)
585                {
586                    $selecter.siblings().removeClass(settings.classname);
587                }
588            }
589            else
590            {
591                // 닫기 버튼 존재할 경우 토글되지 않음
592                if ( $selecter.find(settings.close).length == 0 )
593                {
594                    $selecter.removeClass(settings.classname);
595                }
596            }
597        }
598
599        if ( settings.action == 'click' )
600        {
601            $selecter.find(settings.button).on(settings.action, function()
602            {
603                if ( settings.respond == false )
604                {
605                    clickActive();
606
607                    return false;
608                }
609                else
610                {
611                    if ( $(window).width() <= settings.respondWidth )
612                    {
613                        clickActive();
614
615                        return false;
616                    }
617                    else
618                    {
619                        $selecter.find(settings.button).off();
620                    }
621                }
622            });
623        }
624        else
625        {
626            $selecter.find(settings.button).on
627            ({
628                mouseenter  : function()
629                {
630                    $selecter.addClass(settings.classname);
631                },
632                focusin     : function()
633                {
634                    $selecter.addClass(settings.classname);
635                },
636                mouseleave  : function()
637                {
638                    $selecter.removeClass(settings.classname);
639                },
640                focusout    : function()
641                {
642                    $selecter.removeClass(settings.classname);
643                }
644            });
645        }
646
647        // 닫기 버튼이 별도로 존재하는 경우
648        if ( $selecter.find(settings.close).length > 0 )
649        {
650            $selecter.find(settings.close).on('click', function()
651            {
652                $selecter.removeClass(settings.classname);
653
654                return false;
655            });
656        }
657        else
658        {
659            // 탭 아웃
660            $selecter.find('a:last').keydown(function(e) 
661            {
662                if(e.keyCode === 9) 
663                {
664                    $selecter.removeClass(settings.classname);
665                }
666            });
667
668            // 역탭 아웃
669            $selecter.find('a:first').keydown(function(e) 
670            {
671                if(e.keyCode === 9 && e.shiftKey) 
672                {
673                    $selecter.removeClass(settings.classname);
674                }
675            });
676        }
677    });
678};

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.