PageSourceSearch

https://www.sqcf.org/js/site.js?1789616853

js sqcf.org collected 2026-09-24 10:11:27 UTC 29,632 bytes, 971 lines download raw bytes

1var SITE = function(){
2	var openPolicy = function(is_sub){
3		is_sub = (is_sub == true);
4		if(!is_sub){
5			$.cocoaDialog.close();
6		}
7		$.ajax({
8			type: 'POST',
9			data: {},
10			url: ('/dialog/policy.cm'),
11			dataType: 'html',
12			async: true,
13			cache: false,
14			success: function(html){
15				var $html = $(html);
16				$.cocoaDialog.open({type: 'site_policy', custom_popup: $html});
17			}
18		});
19	};
20	var openPrivacy = function(){
21		$.cocoaDialog.close();
22		$.ajax({
23			type: 'POST',
24			data: {},
25			url: ('/dialog/privacy.cm'),
26			dataType: 'html',
27			async: true,
28			cache: false,
29			success: function(html){
30				var $html = $(html);
31				$.cocoaDialog.open({type: 'site_privacy', custom_popup: $html});
32			}
33		});
34	};
35	var openDomestic = function(){
36		$.cocoaDialog.close();
37		$.ajax({
38			type: 'POST',
39			data: {},
40			url: ('/dialog/tour_policy_domestic.cm'),
41			dataType: 'html',
42			async: true,
43			cache: false,
44			success: function(html){
45				var $html = $(html);
46				$.cocoaDialog.open({type: 'site_domestic', custom_popup: $html});
47			}
48		});
49	};
50	var openOverseas = function(){
51		$.cocoaDialog.close();
52		$.ajax({
53			type: 'POST',
54			data: {},
55			url: ('/dialog/tour_policy_overseas.cm'),
56			dataType: 'html',
57			async: true,
58			cache: false,
59			success: function(html){
60				var $html = $(html);
61				$.cocoaDialog.open({type: 'site_overseas', custom_popup: $html});
62			}
63		});
64	};
65	var openDomesticOverseas = function(){
66		$.cocoaDialog.close();
67		$.ajax({
68			type: 'POST',
69			data: {},
70			url: ('/dialog/tour_policy.cm'),
71			dataType: 'html',
72			async: true,
73			cache: false,
74			success: function(html){
75				var $html = $(html);
76				$.cocoaDialog.open({type: 'site_domesticoverseas', custom_popup: $html});
77			}
78		});
79	};
80
81	var openThirdParty = function(){
82		$.cocoaDialog.close();
83		$.ajax({
84			type: 'POST',
85			data: {},
86			url: ('/dialog/third_party.cm'),
87			dataType: 'html',
88			async: true,
89			cache: false,
90			success: function(html){
91				var $html = $(html);
92				$.cocoaDialog.open({type: 'site_thirdparty', custom_popup: $html});
93			}
94		});
95	};
96
97	var openOauthDataInterlock = function(){
98		$.cocoaDialog.close();
99		$.ajax({
100			type: 'POST',
101			data: {},
102			url: ('/dialog/oauth_data_interlock.cm'),
103			dataType: 'html',
104			async: true,
105			cache: false,
106			success: function(html){
107				var $html = $(html);
108				$.cocoaDialog.open({type: 'site_thirdparty', custom_popup: $html});
109			}
110		});
111	};
112
113	/**
114	 * 모달 메뉴를 띄움
115	 * @param menu_code			모달 메뉴의 menu_code
116	 * @param base_menu_code	모달 밖에 깔리는 메뉴(모달을 호출한 메뉴)의 menu_code, 모달 내부에서 back_url 처리 등을 위해 사용
117	 */
118	var openModalMenu = function(menu_code, base_menu_code){
119		$.cocoaDialog.close();
120		$.ajax({
121			type: 'POST',
122			data: {
123				'menu_code': menu_code,
124				'base_menu_code': base_menu_code
125			},
126			url: ('/ajax/get_modal_menu.cm'),
127			dataType: 'json',
128			async: true,
129			cache: false,
130			success: function(res){
131				if ( res.msg === 'SUCCESS' ) {
132					// 웹접근성을 위해 모달 열기 전에 마지막 포커스를 저장하고 모달 닫힐 때 해당 포커스로 복귀
133					let lastFocus = document.activeElement;
134
135					$.cocoaDialog.open({
136						type: 'site_modal_menu',
137						custom_popup: res.html,
138						opened: function(){
139							$('.modal_site_modal_menu').attr('tabindex', 0).attr('role', 'dialog');
140							$('.modal_site_modal_menu').lightGallery({
141									selector: '._image_widget_lightbox',
142									thumbnail: false,
143									animateThumb: false,
144									swipeThreshold : 20,
145									showThumbByDefault: false,
146									mode: 'lg-fade',
147									speed: 200,
148									galleryId: 'img_lg',
149							});
150						},
151						hide_event: async function(e){
152							const target = $(e.target);
153							if (target.data('lightGallery')) await target.data('lightGallery').destroy(true);
154							target.removeData('bs.modal').find('.modal-content').html('');
155							$('.modal_site_modal_menu').attr('tabindex', -1).attr('role', '');
156							// 이전 포커스 복귀 및 포커스 초기화
157							if (lastFocus) lastFocus.focus();
158							lastFocus = null;
159						}
160					});
161				} else {
162					alert(res.msg);
163				}
164			}
165		});
166	};
167
168	var changeAlarmCheckbox = function(obj, is_mobile){
169		if(is_mobile == 'Y'){
170			$('#alarm_popup').find("input:checkbox").prop("checked", false);
171			var $alarm_popup = $('#alarm_popup_mobile');
172		}else{
173			$('#alarm_popup_mobile').find("input:checkbox").prop("checked", false);
174			var $alarm_popup = $('#alarm_popup');
175		}
176
177		if($(obj).hasClass("_all")){
178			$alarm_popup.find("input:checkbox").not(":disabled").prop("checked", obj.checked);
179			toggleAlarmActive(is_mobile);
180		}else{
181			var $alarm_checkbox_list = $alarm_popup.find("input:checkbox").not("._all").not(":disabled");
182			var count_total = $alarm_checkbox_list.length;
183			var count_check = $alarm_checkbox_list.filter(":checked").length;
184			if(count_total == count_check && (count_check != 0 && count_total != 0)){
185				$alarm_popup.find("._all").prop("checked", true);
186			}else{
187				$alarm_popup.find("._all").prop("checked", false);
188			}
189			toggleAlarmActive(is_mobile);
190		}
191	};
192
193	var toggleAlarmPopup = function(is_mobile){
194		if(is_mobile == 'Y'){
195			var $alarm_popup = $('#alarm_popup_mobile');
196			var $dLabel = $('#dLabel_mobile');
197			var $id = 'alarm_popup_mobile';
198			var $clos_id = 'alarm_popup';
199			var $layer = '_alarm_layer_mobile';
200		}else{
201			var $alarm_popup = $('#alarm_popup');
202			var $dLabel = $('#dLabel');
203			var $id = 'alarm_popup';
204			var $clos_id = 'alarm_popup_mobile';
205			var $layer = '_alarm_layer';
206		}
207		$alarm_popup.toggleClass('open');
208		if($alarm_popup.hasClass('open')){
209			$(window).off('mousedown.'+$clos_id);
210			$(window).on('mousedown.'+$id,function(event){
211				if($(event.target).closest('.'+$layer).length == 0){
212					$alarm_popup.removeClass('open');
213					$(window).off('mousedown.'+$id);
214				}
215			});
216		}
217	};
218
219	var toggleAlarmActive = function(is_mobile){
220		if(is_mobile == 'Y'){
221			var $alarm_popup = $('#alarm_popup_mobile');
222			var $dLabel = $('#dLabel_mobile');
223		}else{
224			var $alarm_popup = $('#alarm_popup');
225			var $dLabel = $('#dLabel');
226		}
227		var count_check = $alarm_popup.find("li input:checkbox:checked").length;
228		if(count_check == 0){
229			$dLabel.removeClass('active');
230		}else{
231			$dLabel.addClass('active');
232		}
233	};
234	var androidUpdateAlert = function (package) {
235		$.ajax({
236			type : 'POST',
237			data: {'package':package},
238			url : ('dialog/android_update_form.cm'),
239			dataType : 'html',
240			async : false,
241			cache : false,
242			success : function(html){
243				$.cocoaDialog.open({type : 'site_alert', custom_popup : $(html)});
244			}
245		});
246	};
247
248	var firstScrollFixed = function(id){
249		var stop_fixed = {};
250		var fixed_observer = null;
251		clearInterval(stop_fixed);
252		// 최상단에서 scrollToFixed가 붙인 scroll-to-fixed-fixed를 fixed2로 변환 (겹치기 투명 상태 유지)
253		var convertFixedAtTop = function(){
254			var $fixed = $('#' + id).find('div[data-type="section-wrap"].scroll-to-fixed-fixed');
255			var $fixed2 = $('#' + id).find('div[data-type="carousel_menu"].scroll-to-fixed-fixed');
256			if($fixed.length > 0 || $fixed2.length > 0){
257				$fixed.toggleClass('scroll-to-fixed-fixed', false).toggleClass('scroll-to-fixed-fixed2', true);
258				$fixed2.toggleClass('scroll-to-fixed-fixed', false).toggleClass('scroll-to-fixed-fixed2', true);
259				return true;
260			}
261			return false;
262		};
263		var setCss = function(id){
264			var top = $(window).scrollTop();
265			clearInterval(stop_fixed);
266			if(top > 0){
267				if(fixed_observer){
268					fixed_observer.disconnect();
269					fixed_observer = null;
270				}
271				$('#'+id).toggleClass('first_scroll_fixed',false);
272				$('#' + id).find('div[data-type="section-wrap"].scroll-to-fixed-fixed2').toggleClass('scroll-to-fixed-fixed',true).toggleClass('scroll-to-fixed-fixed2',false);
273				$('#' + id).find('div[data-type="carousel_menu"].scroll-to-fixed-fixed2').toggleClass('scroll-to-fixed-fixed',true).toggleClass('scroll-to-fixed-fixed2',false);
274			}else{
275				$('#'+id).toggleClass('first_scroll_fixed',true);
276				if(window.MutationObserver && document.getElementById(id)){
277					// 폴링(200ms) 대기 중 상단 기본 배경이 잠깐 노출되는 깜빡임 방지: 클래스가 붙는 즉시(paint 전) 변환 (IMOPS-14635)
278					if(!fixed_observer){
279						fixed_observer = new MutationObserver(function(){
280							if($(window).scrollTop() > 0){
281								return;
282							}
283							convertFixedAtTop();
284						});
285						fixed_observer.observe(document.getElementById(id), {attributes: true, attributeFilter: ['class'], subtree: true});
286					}
287				}else{
288					stop_fixed = setInterval(function(){
289						if(convertFixedAtTop()){
290							clearInterval(stop_fixed);
291						}
292					},200);
293				}
294				convertFixedAtTop();
295			}
296		};
297		$(window).bind('scroll.firstScrollFixed',function(){
298			setCss(id);
299		});
300
301		$(window).bind('resize.firstScrollFixed',function(){
302			setCss(id);
303		});
304
305		setCss(id);
306	};
307
308	/**
309	 *
310	 * @returns {boolean}
311	 */
312
313	var setBookMark = function(){
314		var bookmarkURL = window.location.href;
315		var bookmarkTitle = document.title;
316		var triggerDefault = false;
317
318		if (window.sidebar && window.sidebar.addPanel) {
319			// Firefox version < 23
320			window.sidebar.addPanel(bookmarkTitle, bookmarkURL, '');
321		} else if ((window.sidebar && (navigator.userAgent.toLowerCase().indexOf('firefox') > -1)) || (window.opera && window.print)) {
322			// Firefox version >= 23 and Opera Hotlist
323			var $this = $(this);
324			$this.attr('href', bookmarkURL);
325			$this.attr('title', bookmarkTitle);
326			$this.attr('rel', 'sidebar');
327			$this.off(e);
328			triggerDefault = true;
329		} else if (window.external && ('AddFavorite' in window.external)) {
330			// IE Favorite
331			window.external.AddFavorite(bookmarkURL, bookmarkTitle);
332		} else {
333			// WebKit - Safari/Chrome
334			alert(LOCALIZE.설명_즐겨찾기등록키안내( (navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Cmd' : 'Ctrl') + '+D') );
335		}
336
337		return triggerDefault;
338	};
339
340	var setSnsShare = function(_type, snsDataOrEl){
341		var snsData = null;
342		if (snsDataOrEl) {
343			if (snsDataOrEl instanceof HTMLElement) {
344				var attr = snsDataOrEl.getAttribute('data-sns-share');
345				if (attr) {
346					try { snsData = JSON.parse(attr); } catch(e) {}
347				}
348			} else if (typeof snsDataOrEl === 'object') {
349				snsData = snsDataOrEl;
350			}
351		}
352    SNS.init(snsData || MENU_SNS_INIT_DATA);
353		switch(_type){
354			case 'kakaotalk':
355				SNS.shareKakaoTalk();
356				break;
357			case 'line':
358				SNS.shareLine();
359				break;
360			case 'band':
361				SNS.shareBand();
362				break;
363			case 'naver':
364				SNS.shareNaver();
365				break;
366			case 'facebook':
367				SNS.shareFacebook();
368				break;
369			case 'twitter':
370				SNS.shareTwitter();
371				break;
372			case 'default':
373			default:
374				SNS.showDefalutSnsShareList();
375				break;
376		}
377	};
378
379	/**
380	 * 대상 없이 단일 라이트갤러리를 띄움
381	 * @param d		{type: gallery 또는 video, img_url: gallery일 때 url, video_url: video일 때 url, loop: video일 때 반복재생 여부 Y 또는 N, hide_title: video일 때 타이틀 숨김 여부 Y 또는 N}
382	 */
383
384	var showLightGallery = function(d){
385		var _data = d;
386		var _type = _data.type;
387		var modalZ = 17000;
388		if($('#cocoaModal').length == 1) modalZ = $('#cocoaModal').css('z-index');		// 모달의 z-index보다 상위로 설정
389
390		if(_type == 'gallery'){
391			var img_url = _data.img_url;
392			var $_body = $("body");
393			if($("#lg-temp-gallery").length > 0){		// 이전에 사용된 라이트갤러리 제거
394				$("#lg-temp-gallery").remove();
395			}
396			var $_html = '<div id="lg-temp-gallery">' +
397				'<a href="' + img_url + '"></a>' +
398				'</div>' +
399				'<style>.lg-backdrop {z-index: ' + (modalZ + 1) + '} .lg-outer {z-index: ' + (modalZ + 2) + '}</style>';
400			$_body.append($_html);
401
402			$("#lg-temp-gallery").lightGallery();
403
404			$("#lg-temp-gallery a").trigger('click');
405
406		}else if(_type == 'video'){
407			var video_url = _data.video_url;		// 바른 주소가 아닐 경우 예외처리 필요
408			var loop = _data.loop;
409			var hide_title = _data.hide_title;
410
411			var youtube_id = '';
412			var video_id = getVideoId(video_url);
413			if(typeof video_id != 'undefined'){
414				if (typeof video_id['youtube'] != 'undefined' && video_id['youtube'][1] != ''){
415					youtube_id = video_id['youtube'][1];
416				}
417			}
418
419			var $_body = $("body");
420			if($("#lg-temp-gallery").length > 0){
421				$("#lg-temp-gallery").remove();
422			}
423			var $_html = '<div id="lg-temp-gallery">' +
424				'<a href="' + video_url + '"></a>' +
425				'</div>' +
426				'<style>.lg-backdrop {z-index: 17001} .lg-outer {z-index: 17002}</style>';
427			$_body.append($_html);
428
429			// vimeo의 경우 자동재생 시에는 타이틀 노출이 되지 않으므로 자동재생이 되지 않는 모바일에서 타이틀 확인 가능
430      // YouTube는 playlist 인자를 넘길 경우 매일 1회 동영상을 제대로 못부르는 경우가 발생함
431      var lg_option = {
432        youtubePlayerParams: {
433          rel : 0,
434          showinfo: hide_title=='Y'?0:''
435        },
436        vimeoPlayerParams : {
437          autoplay : 1,
438          rel : 0,
439          title: hide_title=='Y'?0:1
440        },
441        controls: 0,
442        zoom: false,
443        fullScreen: false,
444        download: false,
445        counter: false,
446        hash: false,
447        videoMaxWidth:1140
448      };
449      if(loop === 'Y'){
450        lg_option.youtubePlayerParams = Object.assign(lg_option.youtubePlayerParams, {loop: 1, playlist: youtube_id});
451        lg_option.vimeoPlayerParams = Object.assign(lg_option.vimeoPlayerParams, {loop: 1});
452      }
453      
454			$("#lg-temp-gallery").lightGallery(lg_option);
455      
456			$("#lg-temp-gallery a").trigger('click');
457
458		}
459	};
460
461	var hidePermissionMenu = function(){
462		if($('.pms_check').length > 0){
463			$.ajax({
464				type: 'POST',
465				data: {unit_code : UNIT_CODE},
466				url: ('/ajax/get_permission_limit_menu_list.cm'),
467				dataType: 'json',
468				async: true,
469				cache: false,
470				success: function(res){
471					if(res.msg === 'SUCCESS'){
472						var limit_menu_list = res.limit_menu_list;
473						$.each(limit_menu_list, function(key, value){
474							$('.pms_check[data-code=' + value + ']').remove();
475						});
476						$('.pms_check').removeClass('pms_check');
477						rebuildMobileTableMenu();
478						rebuildSlideMenu();
479					}else{
480						$('.pms_check').remove();
481					}
482				},
483				error: function(){
484					$('.pms_check').remove();
485				}
486			});
487		}
488	};
489
490	var rebuildMobileTableMenu = function(){
491		var $mobile_table_nav_wrap = $('._mobile_table_nav_wrap');
492		if($mobile_table_nav_wrap.length > 0){
493			var table_line_count = $mobile_table_nav_wrap.data('table_line_count');
494			var nav_item_cnt = 0;
495			var rebuild_table_html = '';
496			$mobile_table_nav_wrap.find('td[data-rel=table_nav]').each(function(key, value){
497				if(nav_item_cnt == 0){
498					rebuild_table_html += "<tr>";
499				}
500				rebuild_table_html += value.outerHTML;
501				nav_item_cnt++;
502				if(nav_item_cnt % table_line_count == 0){
503					rebuild_table_html += "</tr>";
504				}
505			});
506			var table_row_cnt, max_item_cnt, empty_cnt;
507			if(nav_item_cnt > 0){
508				table_row_cnt = Math.ceil(nav_item_cnt / table_line_count);
509				max_item_cnt = table_row_cnt * table_line_count;
510				empty_cnt = max_item_cnt - nav_item_cnt;
511			}
512			for(var i = 0; i < empty_cnt; i++){
513				rebuild_table_html += '<td class="nav-item empty_item "></td>';
514				if(i == empty_cnt - 1){
515					rebuild_table_html += '</tr>';
516				}
517			}
518			$mobile_table_nav_wrap.html(rebuild_table_html);
519		}
520	};
521
522	var rebuildSlideMenu = function(){
523		MOBILE_SLIDE_MENU.rebuildAccordion();
524		PC_SLIDE_MENU.rebuildAccordion();
525	};
526
527	var setViewportBtn = function(color, background_color){
528		var $last_section = $('body');
529		var viewport_mode = getCookie('viewport_mode');
530		if($('#doz_footer').length > 0){
531			$last_section = $('#doz_footer .footer-section .inside');
532		}else{
533			if(viewport_mode === 'PC'){
534				var $pc_section = $('div[doz_type=section][doz_mobile_section=N]');
535				if($pc_section.length > 0){
536					var $pc_section_last = $($pc_section[$pc_section.length - 1]);
537					if($pc_section_last.hasClass('visual_section')){
538						$last_section = $pc_section_last;
539					}else{
540						var $pc_section_last_inside = $pc_section_last.find('div[doz_type=inside], div[doz_type=row]');
541						$last_section = $($pc_section_last_inside[$pc_section_last_inside.length - 1]);
542					}
543				}
544			}else{
545				var $mobile_show_section = $('div[doz_type=section][doz_mobile_hide=N]');
546				if($mobile_show_section.length > 0){
547					var $mobile_show_section_last = $($mobile_show_section[$mobile_show_section.length - 1]);
548					if($mobile_show_section_last.hasClass('visual_section')){
549						$last_section = $mobile_show_section_last;
550					}else{
551						var $mobile_show_section_last_inside = $mobile_show_section_last.find('div[doz_type=inside], div[doz_type=row]');
552						$last_section = $($mobile_show_section_last_inside[$mobile_show_section_last_inside.length - 1]);
553					}
554				}
555			}
556		}
557		if(viewport_mode === 'PC'){
558			var pc_mode_str = getLocalizeString('타이틀_모바일모드로보기', '', '모바일 모드로 보기');
559		}else{
560			var pc_mode_str = getLocalizeString('타이틀_PC모드로보기', '', 'PC 모드로 보기');
561		}
562		var border_color = tinycolor(color).setAlpha(tinycolor(color).getAlpha() * 0.2).toRgbString();
563		$last_section.append('<div class="pc_mode_btn_wrap"><btn class="btn btn-default pc_mode_btn _pc_mode_btn" onclick="SITE.toggleViewport();" style="color: ' + color + '; background-color: ' + background_color + '; border: 1px solid ' + border_color + '">' + pc_mode_str + '</btn></div>');
564	};
565
566	var toggleViewport = function(){
567		var viewport_mode = getCookie('viewport_mode');
568		if(viewport_mode === 'PC'){
569			setCookie('viewport_mode', 'm');
570		}else{
571			setCookie('viewport_mode', 'PC');
572		}
573		location.href = location.search;
574	};
575
576	var alarm_html_data = {"group_html":"","app_html":""};
577	var is_loaded = false;
578	/***
579	 * 알림 발송 타겟 리스트 불러오기
580	 */
581	var loadAlarmTargetList = function(board_code){
582		if(alarm_html_data.group_html === ""){
583			if(!is_loaded){
584				var $alarm_popup = $('#alarm_popup');
585				var $alarm_popup_mobile = $('#alarm_popup_mobile');
586				$.ajax({
587					type: 'POST',
588					data: {'board_code' : board_code},
589					url: ('/ajax/get_alarm_target_list.cm'),
590					dataType: 'json',
591					async: true,
592					cache: false,
593					success: function(res){
594						is_loaded = true;
595						if(res.msg === 'SUCCESS'){
596							alarm_html_data.group_html= res.group_html;
597							alarm_html_data.app_html= res.app_html;
598
599							$alarm_popup.find(".dLabel").html('').append(alarm_html_data.group_html);
600							$alarm_popup.find("._alarm_layer").append(alarm_html_data.app_html);
601							$alarm_popup_mobile.find(".dLabel").html('').append(alarm_html_data.group_html);
602							$alarm_popup_mobile.find("._alarm_layer_mobile").append(alarm_html_data.app_html);
603
604
605							$alarm_popup.find("._all_check").off("click._all_check").on("click._all_check",function(){
606								SITE.changeAlarmCheckbox(this,'N');
607							});
608							$alarm_popup_mobile.find("._all_check").off("click._all_check_m").on("click._all_check_m",function(){
609								SITE.changeAlarmCheckbox(this,'Y');
610							});
611
612							$alarm_popup.find("._alarm_group_list").off("click._alarm_group_list").on("click._alarm_group_list",function(){
613								SITE.changeAlarmCheckbox(this,'N');
614							});
615							$alarm_popup_mobile.find("._alarm_group_list").off("click._alarm_group_list_m").on("click._alarm_group_list_m",function(){
616								SITE.changeAlarmCheckbox(this,'Y');
617							});
618						}
619					},
620					error: function(){
621						is_loaded = true;
622					}
623				});
624			}
625		}
626	};
627
628	const createTermsMode = function() {
629		const termsModeFnMap = {
630			policy: openPolicy,
631			privacy: openPrivacy,
632			domesticoverseas: openDomesticOverseas,
633			third_party: openThirdParty,
634		};
635
636		const allowTermsMode = Object.keys(termsModeFnMap);
637		const allowTermsModeType = ['modal', 'link'];
638		const defaultTermsModeType = 'link';
639
640		const getTemsModeType = (termsModeType) => {
641			const isAllowed = allowTermsModeType.includes(termsModeType);
642
643			return isAllowed ? termsModeType : defaultTermsModeType;
644		}
645
646		function init() {
647			const $target = $('[data-terms-mode]').filter(function() {
648				return allowTermsMode.includes($(this).data('terms-mode'));
649			});
650
651			$target.off('click.terms').on('click.terms', function(e) {
652				e.preventDefault();
653
654				const termsMode = $(this).data('terms-mode');
655				const termsModeType = getTemsModeType($(this).data('terms-mode-type'));
656
657				if (termsModeType === 'modal') {
658					termsModeFnMap[termsMode]();
659				}
660
661				if (termsModeType === 'link') {
662					window.location.href = `?mode=${termsMode}`;
663				}
664			});
665		}
666
667		return { init };
668	}
669
670	const termsMode = createTermsMode();
671
672	return {
673		'openPolicy' : function(is_sub){
674			openPolicy(is_sub);
675		},
676		'openPrivacy' : function(){
677			openPrivacy();
678		},
679		'openDomestic' : function(){
680			openDomestic();
681		},
682		'openOverseas' : function(){
683			openOverseas();
684		},
685		'openDomesticOverseas' : function(){
686			openDomesticOverseas();
687		},
688		'openThirdParty' : function(){
689			openThirdParty()
690		},
691		'openOauthDataInterlock' : function(){
692			openOauthDataInterlock();
693		},
694		'openModalMenu' : function(menu_code, base_menu_code){
695			openModalMenu(menu_code, base_menu_code);
696		},
697		'changeAlarmCheckbox' : function(obj, is_mobile){
698			changeAlarmCheckbox(obj,is_mobile);
699		},
700		'toggleAlarmPopup' : function(is_mobile){
701			toggleAlarmPopup(is_mobile);
702		},
703		'androidUpdateAlert' : function (package) {
704			androidUpdateAlert(package);
705		},
706		'firstScrollFixed' : function(id){
707			firstScrollFixed(id);
708		},
709		'setBookMark' : function(){
710			setBookMark();
711		},
712		'setSnsShare' : function(type, snsDataOrEl){
713			setSnsShare(type, snsDataOrEl);
714		},
715		'showLightGallery' : function(d){
716			showLightGallery(d);
717		},
718		'hidePermissionMenu' : function(){
719			hidePermissionMenu();
720		},
721		'rebuildMobileTableMenu' : function(){
722			rebuildMobileTableMenu();
723		},
724		'rebuildSlideMenu' : function(){
725			rebuildSlideMenu();
726		},
727		'setViewportBtn' : function(color, background_color){
728			setViewportBtn(color, background_color);
729		},
730		'toggleViewport' : function(){
731			toggleViewport();
732		},
733		'loadAlarmTargetList' : function(board_code){
734			loadAlarmTargetList(board_code);
735		},
736		'initTermsModeElements': function() {
737			termsMode.init();
738		}
739	}
740
741}();
742
743var SITE_TWO_FACTOR_LOGIN = function(){
744	var limit_time;
745	var interval_time_event;
746	var $cert_request_btn;
747	var $cert_input_wrap;
748	var $limit_time_wrap;
749	var $cert_code;
750	var $two_factor_cert_save_btn;
751	var challenge_token;
752	// 인증 앱(OTP)은 발송이 없어 전송 버튼·남은 시간 타이머를 쓰지 않는다.
753	var two_factor_type;
754	// 등록 단계 QR 은 사내 vendor 라이브러리를 그때만 받아 그린다(외부 CDN 금지).
755	var renderOtpEnrollQr = function($html){
756		var $qr = $html.find('._otp_qr');
757		if($qr.length === 0) return;
758		var uri = $qr.attr('data-uri') || '';
759		var lib = $qr.attr('data-lib') || '';
760		if(uri === '' || lib === ''){
761			$qr.hide();
762			return;
763		}
764		var draw = function(){
765			try{
766				new QRCode($qr.get(0), {
767					text : uri,
768					width : 160,
769					height : 160,
770					correctLevel : QRCode.CorrectLevel.M
771				});
772			}catch(e){
773				// QR 을 못 그려도 링크·키로 등록할 수 있게 QR 영역만 숨긴다.
774				$qr.hide();
775			}
776		};
777		if(typeof QRCode !== 'undefined'){
778			draw();
779			return;
780		}
781		$.getScript(lib).done(draw).fail(function(){
782			$qr.hide();
783		});
784	};
785	var reloadByTwoFactorChallengeExpired = function(res){
786		if(res.reload == 'Y'){
787			alert(res.msg);
788			location.reload();
789			return true;
790		}
791		return false;
792	};
793	var openAdminTwoFactor = function(back_url,is_social){
794		$.cocoaDialog.close();
795		$.ajax({
796			type : 'POST',
797			data : {},
798			url : ('/dialog/admin_two_factor_login.cm'),
799			dataType : 'json',
800			async : true,
801			cache : false,
802			success : function(res){
803				if(res.msg == 'SUCCESS'){
804					var $html = $(res.html);
805
806					clearInterval(interval_time_event);
807					$html.on('hidden.bs.modal', function(){
808						clearInterval(interval_time_event);
809					});
810					challenge_token = $html.find("input[name='challenge_token']").val();
811					two_factor_type = $html.find("input[name='two_factor_type']").val() || '';
812					$cert_request_btn = $html.find('._cert_request_btn');
813					limit_time = $html.find("input[name='limit_time']").val();
814					$html.find("._lime_time_obj").html(limit_time);
815					$cert_input_wrap = $html.find("._cert_input_wrap");
816					$limit_time_wrap = $html.find("._limit_time_wrap");
817					$cert_code = $html.find("input[name='cert_code']");
818					$two_factor_cert_save_btn = $html.find("._two_factor_cert_save_btn");
819					// 인증 앱은 발송 요청 자체가 없어 전송 버튼과 남은 시간 타이머를 붙이지 않는다.
820					if(two_factor_type !== 'otp'){
821						$cert_request_btn.off("click.cert_request_btn").on("click.cert_request_btn", function(){
822							if($cert_request_btn.hasClass("disabled")) return false;
823							$.ajax({
824								type : 'POST',
825								data : {
826									'challenge_token' : challenge_token
827								},
828								url : ('/backpg/request_two_factor_certification.cm'),
829								dataType : 'json',
830								async : true,
831								cache : false,
832								success : function(res){
833									if(res.msg !== 'SUCCESS'){
834										if(reloadByTwoFactorChallengeExpired(res)) return false;
835										alert(res.msg);
836									}else{
837										$cert_input_wrap.show();
838										$cert_request_btn.addClass("disabled");
839										setTimeout(function(){
840											$cert_request_btn.removeClass("disabled");
841										},5000);
842
843										clearInterval(interval_time_event);
844										//모달 닫을때 이벤트 제거
845										$html.on('hidden.bs.modal', function () {
846											clearInterval(interval_time_event);
847										});
848
849										$limit_time_wrap.show();
850										$html.find("._lime_time_obj").html(limit_time);
851										interval_time_event = setInterval(function(){
852											var _limit_time = $html.find("._lime_time_obj").html();
853											$html.find("._lime_time_obj").html(_limit_time-1);
854											if((_limit_time-1) <= 0) clearInterval(interval_time_event);
855										},1000);
856									}
857								}
858							});
859						});
860					}
861
862					$two_factor_cert_save_btn.off("click.cert_save_btn").on("click.cert_save_btn",function(){
863						var cert_code = $cert_code.val();
864						if(cert_code === ""){
865							alert(LOCALIZE.설명_인증번호를입력해주세요());
866							$cert_code.focus();
867							return false;
868						}
869						$.ajax({
870							type: 'POST',
871							data:{
872								'cert_code' : cert_code,
873								'challenge_token' : challenge_token,
874								'back_url' : back_url,
875								'is_social' : is_social
876							},
877							url: ('/backpg/update_two_factor_certification.cm'),
878							dataType: 'json',
879							async: true,
880							cache: false,
881							success: function (res) {
882								if(res.msg === 'SUCCESS'){
883									alert(LOCALIZE.설명_인증이완료되었습니다());
884									// 운영자 세션이 새로 생긴 경우 이전 신원의 토큰을 지운다(login.cm 과 같은 키).
885									if(res.clear_admin_storage){
886										try {
887											window.sessionStorage.removeItem("imweb_site_auth_token");
888											var matchedKey = [];
889											for (var i = 0; i < localStorage.length; i++) {
890												var key = localStorage.key(i);
891												if (key && key.indexOf('c3ef8c14m') === 0) {
892													matchedKey.push(key);
893												}
894											}
895											matchedKey.forEach(function(key){ localStorage.removeItem(key); });
896										} catch (e) {}
897									}
898									if(back_url != 'Y'){
899										// 서버가 이동 주소를 주면 재POST 폼이 없는 경로(소셜·소유주)다.
900										if (is_social === 'Y' || typeof res.site_back_url !== 'undefined') {
901											if (res.site_back_url != '') {
902												window.parent.location.href = res.site_back_url;
903											} else {
904												location.reload();
905											}
906										} else {
907											$html.append(res.form);
908											var $admin_form = $html.find('#admin_two_factor_login_form');
909											$admin_form.submit();
910										}
911									}else{
912										if(res.site_back_url != '') window.parent.location.href = res.site_back_url;
913										else location.reload();
914									}
915								}else{
916									if(reloadByTwoFactorChallengeExpired(res)) return false;
917									alert(res.msg);
918								}
919							}
920						});
921					});
922					$.cocoaDialog.open({
923						type : 'site_two_factor_login', custom_popup : $html, hide_event : function(e){
924							if(confirm(getLocalizeString('설명_2단계인증을진행하지않으면로그인이불가능합니다', '', '2단계 인증을 진행하지 않으면 로그인이 불가능합니다. 인증을 중단할까요?'))){
925								$cert_code.val('');
926								$cert_input_wrap.hide();
927								clearTwoFactorLoginData();
928							}else{
929								e.preventDefault();	// 다이얼로그 닫기 중단
930								return false;
931							}
932						}
933					});
934					// 모달이 열려 DOM 에 붙은 뒤에 그린다.
935					renderOtpEnrollQr($html);
936				}else{
937					alert(res.msg);
938					clearTwoFactorLoginData();
939				}
940			}
941		});
942	};
943
944	var clearTwoFactorLoginData = function(){
945		$.ajax({
946			type : 'POST',
947			url : ('/backpg/clear_two_factor_login.cm'),
948			dataType : 'json',
949			async : true,
950			cache : false,
951			success : function(res){
952				if(res.msg == 'SUCCESS'){
953					location.href = '/';
954				}else{
955					alert(res.msg);
956				}
957			}
958		});
959	};
960
961	return {
962		'openAdminTwoFactor' : function(back_url,is_social){
963			openAdminTwoFactor(back_url,is_social);
964		},
965		'clearTwoFactorLoginData' : function(){
966			clearTwoFactorLoginData();
967		}
968	}
969
970}();
971

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.