/* javascript for bemil.chosun.com renewal GNB package */ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-58940796-10', 'auto'); ga('require', 'displayfeatures'); ga('require', 'linkid', 'linkid.js'); ga('send', 'pageview'); ga('create', 'UA-58940796-24', 'auto',{'name':'chosun_web_total'}); ga('require', 'displayfeatures'); ga('require', 'linkid', 'linkid.js'); ga('chosun_web_total.send', 'pageview'); // for PC GNB document.write('\ \
\ '); // for Mobile GNB document.write('\

모바일 LNB

\ '); /* current menu on */ var TEMP_ID = CatID.substring(0, 1); var TEMP_ID2 = CatID.substring(0, 2); if (TEMP_ID =="9") { if (TEMP_ID2 =="92") { document.getElementById("mm9").className = "current"; } else if (TEMP_ID2 =="91") { document.getElementById("mmA").className = "current"; } else {} } else if (TEMP_ID =="4") { document.getElementById("mmb10158").className = "current"; if (TEMP_ID2 =="42") { document.getElementById("mmb10158").className = "current"; } else if (TEMP_ID2 =="45") { document.getElementById("mmb10158").className = "current"; } else if (TEMP_ID2 =="41") { document.getElementById("mmb10158").className = "current"; } else if (TEMP_ID2 =="44") { document.getElementById("mmb10158").className = "current"; } else if (TEMP_ID2 =="46") { document.getElementById("mmb10158").className = "current"; } else if (TEMP_ID2 =="47") { document.getElementById("mmb10158").className = "current"; } else if (TEMP_ID2 =="48") { document.getElementById("mmb10158").className = "current"; } else if (TEMP_ID2 =="49") { document.getElementById("mmb10158").className = "current"; } else {} } else if (TEMP_ID =="3") { document.getElementById("mmA").className = "current"; if (TEMP_ID2 =="31") { document.getElementById("mmA").className = "current"; } else if (TEMP_ID2 =="32") { document.getElementById("mmA").className = "current"; } else if (TEMP_ID2 =="33") { document.getElementById("mmA").className = "current"; } else if (TEMP_ID2 =="34") { document.getElementById("mmA").className = "current"; } else if (TEMP_ID2 =="35") { document.getElementById("mmA").className = "current"; } else if (TEMP_ID2 =="36") { document.getElementById("mmA").className = "current"; } else if (TEMP_ID2 =="37") { document.getElementById("mmA").className = "current"; } else if (TEMP_ID2 =="38") { document.getElementById("mmA").className = "current"; } else if (TEMP_ID2 =="39") { document.getElementById("mmA").className = "current"; } else if (TEMP_ID2 =="3A") { document.getElementById("mmA").className = "current"; } else if (TEMP_ID2 =="3B") { document.getElementById("mmA").className = "current"; } else if (TEMP_ID2 =="91") { document.getElementById("mmA").className = "current"; } else {} } else if (TEMP_ID =="5") { document.getElementById("mmb10159").className = "current"; if (TEMP_ID2 =="51") { document.getElementById("mmb10159").className = "current"; } else if (TEMP_ID2 =="52") { document.getElementById("mmb10159").className = "current"; } else if (TEMP_ID2 =="53") { document.getElementById("mmb10159").className = "current"; } else if (TEMP_ID2 =="54") { document.getElementById("mmb10159").className = "current"; } else if (TEMP_ID2 =="55") { document.getElementById("mmb10159").className = "current"; } else if (TEMP_ID2 =="56") { document.getElementById("mmb10159").className = "current"; } else {} } else if (TEMP_ID =="6") { document.getElementById("mmb10040").className = "current"; if (TEMP_ID2 =="61") { document.getElementById("mmb10040").className = "current"; } else if (TEMP_ID2 =="62") { document.getElementById("mmb10040").className = "current"; } else if (TEMP_ID2 =="63") { document.getElementById("mmb10040").className = "current"; } else if (TEMP_ID2 =="64") { document.getElementById("mmb10040").className = "current"; } else {} } else if (TEMP_ID =="7") { document.getElementById("mmb10129").className = "current"; if (TEMP_ID2 =="71") { document.getElementById("mmb10129").className = "current"; } else if (TEMP_ID2 =="72") { document.getElementById("mmb10129").className = "current"; } else if (TEMP_ID2 =="73") { document.getElementById("mmb10129").className = "current"; } else if (TEMP_ID2 =="74") { document.getElementById("mmb10129").className = "current"; } else if (TEMP_ID2 =="75") { document.getElementById("mmb10129").className = "current"; } else {} } else { } /* javscript include from ui.js start */ var adaptivePage; //pc 전용 체이지 체크 var winWidth = $(window).width(); var winHeight = $(window).height(); var scrollTop; function getWinPosition(){ scrollTop = $(window).scrollTop(); } function setWinPosition(){ $(window).scrollTop(scrollTop); } //윈도우 사이즈 $(function(){ if (adaptivePage){} else { winWidthChk(); $(window).bind('resize', function(){ winWidthChk(); }); } }); //윈도우체크 function winWidthChk() { var winWidthChk = $(window).width(); if (768 < winWidthChk) { $('body').removeClass('mobile'); $('body').addClass('web'); } else if (winWidthChk <= 768) { $('body').removeClass('web'); $('body').addClass('mobile'); } } //리셋 처리 $(function(){ if ($('body').hasClass('bodyWeb') || $('body').hasClass('bodyM')) {} else{ $(window).resize(function(){ if (winWidth >= 768) { closeSchBox(); //모바일 서치박스 w_closeSchBox(); winWidthChk(); //location.reload(); //$('.gnbMenu ul').mCustomScrollbar("disable",true); } }); } }); //투데이 롤링 $(function(){ $('.todayBox').cycle({ fx: 'scrollVert', speed: 'slow', timeout: 4000, }); }); //컨텐츠 영역 높이 $(function(){ if ($('body').hasClass('web')) { var conH = $('.content .conSection').height(); if ($('.conSection').hasClass('boardView')) { // $('.conSection').css({'height':conH-21}); $('.conSection').css({'height':conH }); } else{ // $('.conSection').css({'height':conH-41}); $('.conSection').css({'height':conH }); } } else if ($('body').hasClass('mobile')) { $('.conSection').css({'height':'auto'}); } $(window).resize(function(){ var conH = $('.content .conSection').height(); if (winWidth <= 768 && $('body').hasClass('mobile')) { $('.conSection').css({'height':'auto'}); } else if (winWidth > 768 && $('body').hasClass('web')) { if ($('.conSection').hasClass('boardView')) { // $('.conSection').css({'height':conH-21}); $('.conSection').css({'height':conH}); } else { // $('.leftSectionWarp').css({'height':conH-41}); $('.conSection').css({'height':conH}); } } }); }); // textarea $(function(){ var comment_box = ''; $(".comment_box textarea").on("click, focusin", function() { if($(this).val() == "[알림] 로그인 후 사용할 수 있습니다." || $(this).val() == "[알림] 욕설, 지역감정 조장, 유언비어, 광고, 동일한 글 반복 게재 등은 사전통보 없이 삭제됩니다."){ comment_box = $(this).val(); $(this).val(''); } }); $(".comment_box textarea").on("focusout", function() { if($(this).val().length == 0){ $(this).val(comment_box); } }); }); //ul 서치박스 $(function(){ $(document).on('click', '.select-ul .title', function (){ var target = $(this).parent(); if(target.hasClass('open')){ $(this).siblings('.selList').stop().animate({'maxHeight' : 0+'px'}, 250, 'easeOutCubic'); setTimeout(function(){ target.find('.selList').hide(); target.removeClass('open'); },250); } else { $(this).parent('.select-ul').addClass('open'); $(this).siblings('.selList').show(); $(this).siblings('.selList').stop().animate({'maxHeight' : 250+'px'}, 500, 'easeOutCubic'); } }); $(document).on('click', '.select-ul .selList label', function (){ var txt_value = $(this).text(); var target = $(this).parents('.select-ul'); target.find('.title').text(txt_value); target.find('input').removeAttr('checked'); $(this).find('input').attr('checked','checked'); $(this).parents('.selList').stop(true, false).animate({'maxHeight' : 0+'px'}, 250, 'easeOutCubic'); setTimeout(function(){ target.removeClass('open'); target.find('.selList').hide(); },250); }); }); // 탭 자동 넓이 - tabType1 $(function(){ $(".tabType1, .tabType2, .tabType3, .tabType4").each(function(){ var size = $(this).find("li").size(); $(this).find("li").css({ 'width': 100/size + '%' }); if ($(this).hasClass('profile')) { $(this).find("li").css({'width' : 'auto'}); } }); }); // 탭 활성화 $(function(){ $(".js-tab li").click(function(){ $(this).siblings('li').removeClass('on'); $(this).addClass('on'); }); }); // 탭 컨텐츠 보기 function showTab(i,ele){ $(i).parents('.js-tab').next(".js-con").children('.boardCon, .profileCon').hide(); $("#" + ele).show(); } //서치박스 텍스트 삭제 $(function(){ $('.js-label').each(function(){ $(this).next('input, textarea').on({ focusin : function(){ $(this).prev('label').addClass('hide'); }, focusout : function(){ if(!$(this).val()){ $(this).prev('label').removeClass('hide'); } } }) }); }); //페이지상단 function pageTop() { wScrollTop = $(window).scrollTop(); $('html, body').stop().animate({scrollTop : 0}, 500, 'easeOutCubic'); } function pageBottom() { var f_pos = $('#footer').offset().top; $('html, body').stop().animate({scrollTop : f_pos}, 800, 'easeOutCubic'); } //인풋 텍스트 삭제 $(function(){ $('.js-label').each(function(){ $(this).next('input, textarea').on({ focusin : function(){ $(this).prev('label').addClass('hide'); }, focusout : function(){ if(!$(this).val()){ $(this).prev('label').removeClass('hide'); } } }) }); }); /* layer */ var open_pos; function showLayer(e){ $('#overlay').remove(); $('#'+e).show(); var layerH = $('#'+e).height(); open_pos = $(window).scrollTop(); if (layerH > $(window).height()){ //$('#'+e).addClass('layerScale'); $('html, body').stop().animate({scrollTop : 0}); $('#wrap').css({'height' : layerH + 150, 'overflow' : 'hidden'}); } else { $('#'+e).css({'top' : '50%', 'margin-top' : -layerH/2}); $('#wrap').css({'height' : '100%', 'overflow' : 'hidden'}); } // if(layerH > $('#wrap').height()){ // $('#wrap').css({'min-height' : layerH + 100}); // } $('#'+e).addClass('on').stop().fadeIn(200); $('#wrap').append('
'); // layerScale(); // }); } function hideLayer(e){ $('#'+e).removeClass('on, layerScale').hide(); $('#overlay').remove(); $('#wrap').css({'height' : 'auto', 'overflow' : 'visible'}); $('html, body').stop().animate({scrollTop : open_pos}, 50); } // $(window).bind('resize', function(){ // layerScale(); // }); // function layerScale(){ // if ($('.layerPopup.on').height() > ($(window).height() - 60) ){ // $('.layerPopup.on').addClass('layerScale'); // $('html, body').stop().animate({scrollTop : 0}); // } else { // $('.layerPopup.on').removeClass('layerScale'); // }; // } // $(function(){ // //라디오버튼 // $(document).on('click', '.radioForm', function (){ // var grpNm = $(this).find("input:radio").attr("name"); // $("input:radio[name=" + grpNm + "]").each(function() { // $(this).closest(".radioForm").removeClass("checked"); // }); // $(this).addClass("checked"); // }); // }); //웹 헤더 검색창 function w_openSchBox() { $('.w_btn_search .btnOpen').hide(); $('.w_btn_search .btnClose').show(); $('.m_head_search').addClass('open'); // $('.headerMenu').css('position','fixed'); $('.m_head_search').stop().animate({'top':106}, 150, 'easeOutCubic'); $('
').clone().appendTo('#wrap'); } function w_closeSchBox() { $('.w_btn_search .btnOpen').show(); $('.w_btn_search .btnClose').hide(); $('.m_head_search').removeClass('open'); // $('.headerMenu').css('position','relative'); $('.m_head_search').stop().animate({'top':0}, 0, 'easeOutCubic'); $("#overlay1").remove(); } //모바일 헤더 검색창 function openSchBox() { $('.btn_headSearch .btnOpen').hide(); $('.btn_headSearch .btnClose').show(); $('.m_head_search').addClass('open'); $('.headerMenu').css('position','fixed'); $('.m_head_search').stop().animate({'top':58}, 150, 'easeOutCubic'); $('
').clone().appendTo('#wrap'); } function closeSchBox() { $('.btn_headSearch .btnOpen').show(); $('.btn_headSearch .btnClose').hide(); $('.m_head_search').removeClass('open'); $('.headerMenu').css('position','relative'); $('.m_head_search').stop().animate({'top':0}, 150, 'easeOutCubic'); $("#overlay1").remove(); } //gnb 스크롤바 $(function(){ $('.gnbMenu ul').mCustomScrollbar({ theme:"minimal-dark", axis:"x", autoDraggerLength: true, // setHeight: 42, autoHideScrollbar: true, scrollInertia: 800, }); }); //gnb 서브메뉴 열기 닫기 $(function(){ $(document).on('click', '.mobile .gnbMenu li.current a', function(){ $('.subMebu').stop().animate({'top' : '105px'}, 300, 'easeOutCubic'); if($(this).parent().attr('class')=='current') return false; }); $(document).on('click', '.mobile .subMebu button', function(){ $('.subMebu').stop().animate({'top' : '-290px'}, 300, 'easeOutCubic'); }); }); //리셋 function reSet_gnb(){ winWidth = $(window).width(); if (winWidth <= 768 && $('body').hasClass('mobile')) { $('.subMebu').css({'top' : '-290px'}); } else if (winWidth > 768 && $('body').hasClass('web')) { $('.subMebu').css({'top' : '215px'}); } } $(function(){ //사이드메뉴 보기 $('.btn_sideNavi .openMenu_m').on('click focusin', function(){ $('body').addClass('openSide'); $('#wrap').css({'height' : winHeight, 'overflow' : 'hidden' }); $('.sideContainer').stop().animate({'left' : 0+'px'}, 700, 'easeOutCubic'); $(".closeSidebar").show(); $('#sideNaviWrap').append('
'); $("#overlay2").stop().animate({'opacity':0.75},700); }); $(window).resize(function(){ winWidth = $(window).width(); if (winWidth > 768 && $('body').hasClass('openSide')) { $('#wrap').css({'height' : 'auto', 'overflow' : 'visible' }); $('.sideContainer').stop().animate({'left' : -100 +'%'}, 400, 'easeOutCubic'); $(".closeSidebar").hide(); $("#overlay2").stop().animate({'opacity':0},600); setTimeout(function(){ $('body').removeClass('openSide'); $("#overlay2").remove(); },650); } }); //사이드 메뉴 닫기 $('.closeSidebar').on('click', function(){ $('#wrap').css({'height' : 'auto', 'overflow' : 'visible' }); $('.sideContainer').stop().animate({'left' : -100 +'%'}, 400, 'easeOutCubic'); $(".closeSidebar").hide(); $("#overlay2").stop().animate({'opacity':0},600); setTimeout(function(){ $('body').removeClass('openSide'); $("#overlay2").remove(); },650); }); //웹사이트맵 열기 $('.btn_sitemap button').on('click', function(){ if ($(this).parent().hasClass('open')) { $('.btn_sitemap').removeClass('open'); $('.btn_sitemap .btn_close').hide(); $('.btn_sitemap .btn_open').show(); $('.siteMapArea').css({'z-index' : 500}); $('.siteMapArea').stop().animate({'top' : '-190px'}, 250, 'easeOutCubic'); setTimeout(function(){ $('.siteMapArea').removeClass('open'); },300); } else{ $('.btn_sitemap').addClass('open'); $('.siteMapArea').addClass('open'); $('.btn_sitemap .btn_open').hide(); $('.btn_sitemap .btn_close').show(); $('.siteMapArea').stop().animate({'top' : '215px'}, 250, 'easeOutCubic'); setTimeout(function(){ $('.siteMapArea').css({'z-index' : 501}); },250); } }); }); // 모바일 사이드메뉴 활성화 $(function(){ $('.side_menuArea .depth1_list .depth1_title').click(function(){ if ($(this).parent().hasClass('on')) { $('.side_menuArea .depth1_list > li').removeClass('on'); $('.side_menuArea .depth2_group').slideUp(300); } else{ $('.side_menuArea .depth1_list > li').removeClass('on'); $('.side_menuArea .depth1_list .depth2_group').hide(); $(this).parent().addClass('on'); $(this).siblings('.depth2_group').slideDown(300); } }); }); //전체 체크 function chkAll(e){ var thisChk = $(e).is(":checked"); if (thisChk == true){ $(e).closest(".chkAll").find('.checkForm input:checkbox').prop("checked", "checked"); if ($('body').hasClass('web')) { $(e).closest(".chkAll").find('.checkForm input:checked + label i').css({'background-positon': '0 -258px'}); }else{ $(e).closest(".chkAll").find('.checkForm input:checked + label i').css({'background-positon': '0 -129px'}); } } else { $(e).closest(".chkAll").find('.checkForm input:checkbox').prop('checked', ''); $(e).closest(".chkAll").find('.checkForm input:checked + label i').css({'background-positon': '0 0'}); } } /* javscript include from ui.js end */ /* javascript chosun.com custom start */ function BeforeSearch(form_name) { if (eval("document." + form_name + ".searchTerm.value") == "") { eval("document." + form_name + ".action") = "http://bemil.chosun.com/nbemil_search.html"; return true; } return true; } function BeforeSearch_M(form_name) { if (eval("document." + form_name + ".searchTerm.value") == "") { eval("document." + form_name + ".action") = "http://bemil.chosun.com/nbemil_search.html"; return true; } return true; } function Temp_menu() { alert("준비 중입니다."); } //방문자 집계 $.ajax({ url : "http://bemil.chosun.com/nbrd/visit/count.html", type : "post", dataType : "text", beforeSend:function(x){ if(x && x.overrideMimeType) { //x.overrideMimeType("application/x-www-form-urlencoded;charset=EUC-KR"); x.overrideMimeType("text/html; charset=EUC-KR"); } }, success : function(data) { //html 테그 제거 var tmpStr = new RegExp(); tmpStr = /[<][^>]*[>]/gi; data = data.replace(tmpStr , ""); data = data.replace(/[^0-9]/gi, " "); data = data.replace(/\s+/gi, "-"); data = data.split("-"); // $("#today_box").html("

오늘 "+addcomma(data[4])+" 명

누적 "+addcomma(data[6])+" 명

"); $("#count_today_id").html('TODAY '+addcomma(data[4])+'명') $("#count_total_id").html('TOTAL '+addcomma(data[6])+'명') } }); function addcomma(data){ if(data==0) return 0; var reg = /(^[+-]?\d+)(\d{3})/; var n = (data + ''); while (reg.test(n)) n = n.replace(reg, '$1' + ',' + '$2'); return n; }; /* javascript chosun.com custom end */ /* end */