var SITE = function(){ var openPolicy = function(is_sub){ is_sub = (is_sub == true); if(!is_sub){ $.cocoaDialog.close(); } $.ajax({ type: 'POST', data: {}, url: ('/dialog/policy.cm'), dataType: 'html', async: true, cache: false, success: function(html){ var $html = $(html); $.cocoaDialog.open({type: 'site_policy', custom_popup: $html}); } }); }; var openPrivacy = function(){ $.cocoaDialog.close(); $.ajax({ type: 'POST', data: {}, url: ('/dialog/privacy.cm'), dataType: 'html', async: true, cache: false, success: function(html){ var $html = $(html); $.cocoaDialog.open({type: 'site_privacy', custom_popup: $html}); } }); }; var openDomestic = function(){ $.cocoaDialog.close(); $.ajax({ type: 'POST', data: {}, url: ('/dialog/tour_policy_domestic.cm'), dataType: 'html', async: true, cache: false, success: function(html){ var $html = $(html); $.cocoaDialog.open({type: 'site_domestic', custom_popup: $html}); } }); }; var openOverseas = function(){ $.cocoaDialog.close(); $.ajax({ type: 'POST', data: {}, url: ('/dialog/tour_policy_overseas.cm'), dataType: 'html', async: true, cache: false, success: function(html){ var $html = $(html); $.cocoaDialog.open({type: 'site_overseas', custom_popup: $html}); } }); }; var openDomesticOverseas = function(){ $.cocoaDialog.close(); $.ajax({ type: 'POST', data: {}, url: ('/dialog/tour_policy.cm'), dataType: 'html', async: true, cache: false, success: function(html){ var $html = $(html); $.cocoaDialog.open({type: 'site_domesticoverseas', custom_popup: $html}); } }); }; var openThirdParty = function(){ $.cocoaDialog.close(); $.ajax({ type: 'POST', data: {}, url: ('/dialog/third_party.cm'), dataType: 'html', async: true, cache: false, success: function(html){ var $html = $(html); $.cocoaDialog.open({type: 'site_thirdparty', custom_popup: $html}); } }); }; var openOauthDataInterlock = function(){ $.cocoaDialog.close(); $.ajax({ type: 'POST', data: {}, url: ('/dialog/oauth_data_interlock.cm'), dataType: 'html', async: true, cache: false, success: function(html){ var $html = $(html); $.cocoaDialog.open({type: 'site_thirdparty', custom_popup: $html}); } }); }; /** * 모달 메뉴를 띄움 * @param menu_code 모달 메뉴의 menu_code * @param base_menu_code 모달 밖에 깔리는 메뉴(모달을 호출한 메뉴)의 menu_code, 모달 내부에서 back_url 처리 등을 위해 사용 */ var openModalMenu = function(menu_code, base_menu_code){ $.cocoaDialog.close(); $.ajax({ type: 'POST', data: { 'menu_code': menu_code, 'base_menu_code': base_menu_code }, url: ('/ajax/get_modal_menu.cm'), dataType: 'json', async: true, cache: false, success: function(res){ if ( res.msg === 'SUCCESS' ) { // 웹접근성을 위해 모달 열기 전에 마지막 포커스를 저장하고 모달 닫힐 때 해당 포커스로 복귀 let lastFocus = document.activeElement; $.cocoaDialog.open({ type: 'site_modal_menu', custom_popup: res.html, opened: function(){ $('.modal_site_modal_menu').attr('tabindex', 0).attr('role', 'dialog'); $('.modal_site_modal_menu').lightGallery({ selector: '._image_widget_lightbox', thumbnail: false, animateThumb: false, swipeThreshold : 20, showThumbByDefault: false, mode: 'lg-fade', speed: 200, galleryId: 'img_lg', }); }, hide_event: async function(e){ const target = $(e.target); if (target.data('lightGallery')) await target.data('lightGallery').destroy(true); target.removeData('bs.modal').find('.modal-content').html(''); $('.modal_site_modal_menu').attr('tabindex', -1).attr('role', ''); // 이전 포커스 복귀 및 포커스 초기화 if (lastFocus) lastFocus.focus(); lastFocus = null; } }); } else { alert(res.msg); } } }); }; var changeAlarmCheckbox = function(obj, is_mobile){ if(is_mobile == 'Y'){ $('#alarm_popup').find("input:checkbox").prop("checked", false); var $alarm_popup = $('#alarm_popup_mobile'); }else{ $('#alarm_popup_mobile').find("input:checkbox").prop("checked", false); var $alarm_popup = $('#alarm_popup'); } if($(obj).hasClass("_all")){ $alarm_popup.find("input:checkbox").prop("checked", obj.checked); toggleAlarmActive(is_mobile); }else{ var count_total = $alarm_popup.find("._alarm_list li").length; var count_check = $alarm_popup.find("input:checkbox:checked").length; if($alarm_popup.find("._all").prop("checked")){ count_check = count_check - 1; } if(count_total == count_check && (count_check != 0 && count_total != 0)){ $alarm_popup.find("._all").prop("checked", true); }else{ $alarm_popup.find("._all").prop("checked", false); } toggleAlarmActive(is_mobile); } }; var toggleAlarmPopup = function(is_mobile){ if(is_mobile == 'Y'){ var $alarm_popup = $('#alarm_popup_mobile'); var $dLabel = $('#dLabel_mobile'); var $id = 'alarm_popup_mobile'; var $clos_id = 'alarm_popup'; var $layer = '_alarm_layer_mobile'; }else{ var $alarm_popup = $('#alarm_popup'); var $dLabel = $('#dLabel'); var $id = 'alarm_popup'; var $clos_id = 'alarm_popup_mobile'; var $layer = '_alarm_layer'; } $alarm_popup.toggleClass('open'); if($alarm_popup.hasClass('open')){ $(window).off('mousedown.'+$clos_id); $(window).on('mousedown.'+$id,function(event){ if($(event.target).closest('.'+$layer).length == 0){ $alarm_popup.removeClass('open'); $(window).off('mousedown.'+$id); } }); } }; var toggleAlarmActive = function(is_mobile){ if(is_mobile == 'Y'){ var $alarm_popup = $('#alarm_popup_mobile'); var $dLabel = $('#dLabel_mobile'); }else{ var $alarm_popup = $('#alarm_popup'); var $dLabel = $('#dLabel'); } var count_check = $alarm_popup.find("li input:checkbox:checked").length; if(count_check == 0){ $dLabel.removeClass('active'); }else{ $dLabel.addClass('active'); } }; var androidUpdateAlert = function (package) { $.ajax({ type : 'POST', data: {'package':package}, url : ('dialog/android_update_form.cm'), dataType : 'html', async : false, cache : false, success : function(html){ $.cocoaDialog.open({type : 'site_alert', custom_popup : $(html)}); } }); }; var firstScrollFixed = function(id){ var stop_fixed = {}; clearInterval(stop_fixed); var setCss = function(id){ var top = $(window).scrollTop(); clearInterval(stop_fixed); if(top > 0){ $('#'+id).toggleClass('first_scroll_fixed',false); $('#' + id).find('div[data-type="section-wrap"].scroll-to-fixed-fixed2').toggleClass('scroll-to-fixed-fixed',true).toggleClass('scroll-to-fixed-fixed2',false); $('#' + id).find('div[data-type="carousel_menu"].scroll-to-fixed-fixed2').toggleClass('scroll-to-fixed-fixed',true).toggleClass('scroll-to-fixed-fixed2',false); }else{ $('#'+id).toggleClass('first_scroll_fixed',true); stop_fixed = setInterval(function(){ var $fixed = $('#' + id).find('div[data-type="section-wrap"].scroll-to-fixed-fixed'); var $fixed2 = $('#' + id).find('div[data-type="carousel_menu"].scroll-to-fixed-fixed'); if($fixed.length > 0 || $fixed2.length >0){ clearInterval(stop_fixed); $('#' + id).find('div[data-type="section-wrap"].scroll-to-fixed-fixed').toggleClass('scroll-to-fixed-fixed', false).toggleClass('scroll-to-fixed-fixed2', true); $('#' + id).find('div[data-type="carousel_menu"].scroll-to-fixed-fixed').toggleClass('scroll-to-fixed-fixed', false).toggleClass('scroll-to-fixed-fixed2', true); } },200); $('#' + id).find('div[data-type="section-wrap"].scroll-to-fixed-fixed').toggleClass('scroll-to-fixed-fixed',false).toggleClass('scroll-to-fixed-fixed2',true); $('#' + id).find('div[data-type="carousel_menu"].scroll-to-fixed-fixed').toggleClass('scroll-to-fixed-fixed',false).toggleClass('scroll-to-fixed-fixed2',true); } }; $(window).bind('scroll.firstScrollFixed',function(){ setCss(id); }); $(window).bind('resize.firstScrollFixed',function(){ setCss(id); }); setCss(id); }; /** * * @returns {boolean} */ var setBookMark = function(){ var bookmarkURL = window.location.href; var bookmarkTitle = document.title; var triggerDefault = false; if (window.sidebar && window.sidebar.addPanel) { // Firefox version < 23 window.sidebar.addPanel(bookmarkTitle, bookmarkURL, ''); } else if ((window.sidebar && (navigator.userAgent.toLowerCase().indexOf('firefox') > -1)) || (window.opera && window.print)) { // Firefox version >= 23 and Opera Hotlist var $this = $(this); $this.attr('href', bookmarkURL); $this.attr('title', bookmarkTitle); $this.attr('rel', 'sidebar'); $this.off(e); triggerDefault = true; } else if (window.external && ('AddFavorite' in window.external)) { // IE Favorite window.external.AddFavorite(bookmarkURL, bookmarkTitle); } else { // WebKit - Safari/Chrome alert(LOCALIZE.설명_즐겨찾기등록키안내( (navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Cmd' : 'Ctrl') + '+D') ); } return triggerDefault; }; var setSnsShare = function(_type){ SNS.init(MENU_SNS_INIT_DATA); switch(_type){ case 'kakaotalk': SNS.shareKakaoTalk(); break; case 'line': SNS.shareLine(); break; case 'band': SNS.shareBand(); break; case 'naver': SNS.shareNaver(); break; case 'facebook': SNS.shareFacebook(); break; case 'twitter': SNS.shareTwitter(); break; case 'default': default: SNS.showDefalutSnsShareList(); break; } }; /** * 대상 없이 단일 라이트갤러리를 띄움 * @param d {type: gallery 또는 video, img_url: gallery일 때 url, video_url: video일 때 url, loop: video일 때 반복재생 여부 Y 또는 N, hide_title: video일 때 타이틀 숨김 여부 Y 또는 N} */ var showLightGallery = function(d){ var _data = d; var _type = _data.type; var modalZ = 17000; if($('#cocoaModal').length == 1) modalZ = $('#cocoaModal').css('z-index'); // 모달의 z-index보다 상위로 설정 if(_type == 'gallery'){ var img_url = _data.img_url; var $_body = $("body"); if($("#lg-temp-gallery").length > 0){ // 이전에 사용된 라이트갤러리 제거 $("#lg-temp-gallery").remove(); } var $_html = '
' + ''; $_body.append($_html); $("#lg-temp-gallery").lightGallery(); $("#lg-temp-gallery a").trigger('click'); }else if(_type == 'video'){ var video_url = _data.video_url; // 바른 주소가 아닐 경우 예외처리 필요 var loop = _data.loop; var hide_title = _data.hide_title; var youtube_id = ''; var video_id = getVideoId(video_url); if(typeof video_id != 'undefined'){ if (typeof video_id['youtube'] != 'undefined' && video_id['youtube'][1] != ''){ youtube_id = video_id['youtube'][1]; } } var $_body = $("body"); if($("#lg-temp-gallery").length > 0){ $("#lg-temp-gallery").remove(); } var $_html = '' + ''; $_body.append($_html); // vimeo의 경우 자동재생 시에는 타이틀 노출이 되지 않으므로 자동재생이 되지 않는 모바일에서 타이틀 확인 가능 // YouTube는 playlist 인자를 넘길 경우 매일 1회 동영상을 제대로 못부르는 경우가 발생함 var lg_option = { youtubePlayerParams: { rel : 0, showinfo: hide_title=='Y'?0:'' }, vimeoPlayerParams : { autoplay : 1, rel : 0, title: hide_title=='Y'?0:1 }, controls: 0, zoom: false, fullScreen: false, download: false, counter: false, hash: false, videoMaxWidth:1140 }; if(loop === 'Y'){ lg_option.youtubePlayerParams = Object.assign(lg_option.youtubePlayerParams, {loop: 1, playlist: youtube_id}); lg_option.vimeoPlayerParams = Object.assign(lg_option.vimeoPlayerParams, {loop: 1}); } $("#lg-temp-gallery").lightGallery(lg_option); $("#lg-temp-gallery a").trigger('click'); } }; var hidePermissionMenu = function(){ if($('.pms_check').length > 0){ $.ajax({ type: 'POST', data: {unit_code : UNIT_CODE}, url: ('/ajax/get_permission_limit_menu_list.cm'), dataType: 'json', async: true, cache: false, success: function(res){ if(res.msg === 'SUCCESS'){ var limit_menu_list = res.limit_menu_list; $.each(limit_menu_list, function(key, value){ $('.pms_check[data-code=' + value + ']').remove(); }); $('.pms_check').removeClass('pms_check'); rebuildMobileTableMenu(); rebuildSlideMenu(); }else{ $('.pms_check').remove(); } }, error: function(){ $('.pms_check').remove(); } }); } }; var rebuildMobileTableMenu = function(){ var $mobile_table_nav_wrap = $('._mobile_table_nav_wrap'); if($mobile_table_nav_wrap.length > 0){ var table_line_count = $mobile_table_nav_wrap.data('table_line_count'); var nav_item_cnt = 0; var rebuild_table_html = ''; $mobile_table_nav_wrap.find('td[data-rel=table_nav]').each(function(key, value){ if(nav_item_cnt == 0){ rebuild_table_html += "