PageSourceSearch

https://busansinbo.or.kr/_guide/js/contents.js

js busansinbo.or.kr collected 2026-10-05 06:06:00 UTC 9,976 bytes, 268 lines download raw bytes

1/***************************************************
2 * 공통 선언부분 * 
3 - 공통으로 한번만 선언합니다.
4 - 주로 common.js 에 선언해두면 좋습니다.
5 - 중복으로 선언되지 않도록 주의하세요.
6****************************************************/
7
8// 접근성 적용 시 필수로 들어가야 할 코드 : 마우스/키보드 이벤트 구분
9var is_event_mouse = false;
10var is_event_keyboard = false;
11$(function() {
12	$(document).mousedown(function() {
13		is_event_mouse=true;
14		is_event_keyboard=false;
15	});
16	$(document).keydown(function() {
17		is_event_mouse=false;
18		is_event_keyboard=true;
19	});
20});
21//----------------------------------------------------
22
23// Swiper Slider 공통 사용 함수 선언
24var swiper_slider = [];
25function fn_slider(mycode, option) {
26	if(swiper_slider[mycode] != null) {
27		swiper_slider[mycode].destroy(true, true);
28		swiper_slider[mycode] = null;
29		$("."+mycode+" .stop").off('click');
30		$("."+mycode+" .play").off('click');
31	}
32	
33	var i_autoplay = false;
34	var i_effect = 'slide';
35	var i_pagination = false;
36	var i_slidesPerView = 1;
37	var i_breakpoints = false;
38	var i_spaceBetween = 0;
39	var i_loop = false;
40	
41	if(typeof(option.autoplay) != "undefined") i_autoplay = option.autoplay;
42	if(typeof(option.effect) != "undefined") i_effect = option.effect;
43	if(typeof(option.pagination) != "undefined") i_pagination = option.pagination;
44	if(typeof(option.slidesPerView) != "undefined") i_slidesPerView = option.slidesPerView;
45	if(typeof(option.breakpoints) != "undefined") i_breakpoints = option.breakpoints;
46	if(typeof(option.spaceBetween) != "undefined") i_spaceBetween = option.spaceBetween;
47	if(typeof(option.loop) != "undefined") i_loop = option.loop;
48			
49	if($("."+mycode+" .swiper-slide").length > 0) {
50		swiper_slider[mycode] = new Swiper("."+mycode+" .slider .swiper-container", {
51			navigation: {prevEl: "."+mycode+" .prev", nextEl: "."+mycode+" .next"},
52			pagination: i_pagination,
53			slidesPerView: i_slidesPerView,
54			spaceBetween: i_spaceBetween,
55			effect: i_effect,
56			autoplay: i_autoplay,
57			breakpoints: i_breakpoints,
58			loop: i_loop,
59			on: {
60				init:function() {
61					/* 접근성을 위한 추가 코드. 아래의 내용들을 적용 시 접근성에 위배되지 않는다. (HTML / CSS 확인) */
62					$("."+mycode+" .swiper-container .swiper-slide *").on('focus', function() {if(is_event_keyboard) { if(!$("."+mycode).hasClass('view-all')) $("."+mycode).addClass('fix-scroll');} else { if(!$("."+mycode).hasClass('view-all')) $("."+mycode).removeClass('fix-scroll');}});
63					$("."+mycode+" .goto-control").on('focus', function() {$("."+mycode).removeClass('fix-scroll');});
64					$("."+mycode+" .control *").on('focus', function() {$("."+mycode).removeClass('fix-scroll');});
65				}
66			}
67		});
68		if(i_autoplay != false) {
69			$("."+mycode+" .stop").click(function(){ swiper_slider[mycode].autoplay.stop(); $("."+mycode+" .stop").hide(); $("."+mycode+" .play").show().focus();	});
70			$("."+mycode+" .play").click(function(){ swiper_slider[mycode].autoplay.start(); $("."+mycode+" .play").hide(); $("."+mycode+" .stop").show().focus(); });
71		}
72	} else {
73		$("."+mycode+" .control").hide();
74	}
75}
76
77//슬라이드 전체보기 : 여러개 슬라이드가 있을 경우, 하나만 선언해줍니다.
78function fn_popup_all_show(obj) {
79	// 전체 팝업 영역 있는지 체크
80	var popup = $(obj).closest('.pop-view-box').find('.popup-slide-view');
81	if(popup.length > 0) {
82		// 전체 팝업영역이 있을 경우
83		var pannel = $(obj).closest('.pop-view-box');
84		var list = pannel.find('.slider').find('ul').clone();
85		var total_count = list.find('li').length;
86		var popup_list = popup.find('.list');
87
88		// 클래스 및 스타일 먹혀 있는 것 모두 제거
89		list.removeAttr('class').removeAttr('style').find('*').removeAttr('class').removeAttr('style');
90		popup_list.empty().append(list);
91		popup.attr('tabIndex', '0').show().focus();
92		popup.find('.pop-title').find('i').text(total_count);
93	} else {
94		alert("전체보기 영역을 찾을 수 없습니다.");
95	}
96}
97//슬라이드 전체보기 닫기
98function fn_popup_all_close(obj) {
99	// 전체 팝업 영역 있는지 체크
100	$(obj).closest('.pop-view-box').find('.popup-slide-view').hide();
101	$(obj).closest('.pop-view-box').find('button.total').focus();
102}
103
104
105function fn_tabs_content(obj) {
106	var target = $(obj).attr('data-tab');
107	var parents = $(obj).closest('.tab-group');
108	var now_content = $('.tab-con[data-content="'+target+'"]', parents);
109
110	parents.find('.on').removeClass('on');
111	parents.find('.selected').remove();
112	parents.find('.tab-active').removeClass('tab-active');
113	$(obj).addClass('on').closest('li').addClass('tab-active');
114	$(obj).append($('<span class="selected">선택됨</span>'));
115	now_content.addClass('on');
116	
117	if(typeof(fn_tabs_event_content) == 'function') {
118		fn_tabs_event_content(obj);
119	}
120}
121
122
123// 팝업 닫기
124function fn_popup_close(obj) {
125	var pop_parent = $(obj).closest('.layerPopup');
126	var target = pop_parent.attr('id');
127	var checkObj = $(obj).closest('.layerPopup').find('.dayCloseCheck');
128	if(checkObj.length > 0 && checkObj.is(':checked')) {
129		// 오늘 하루 열지 않기가 체크 되어 있을 경우, 쿠키값을 저장
130		var value = checkObj.val();
131		var days = 1; // 열지 않기 정보를 저장할 날짜 수
132		// 쿠키 저장하기
133		var exdate = new Date();
134		exdate.setDate(exdate.getDate() + days);
135		var cookie_value = escape(value) + ((days == null) ? '' : '; expires=' + exdate.toUTCString());
136		document.cookie = target + '=' + cookie_value;
137	}
138	pop_parent.hide();
139}
140
141// 팝업 열기
142function fn_popup_open(obj) {
143	var target = $(obj).attr('data-target');
144
145	if($('#' + target).find('.dayCloseCheck').length > 0) {
146		// 오늘 하루 열지 않기가 있을 경우, 쿠키 리셋
147		document.cookie = target + '=; expires=Thu, 01 Jan 1999 00:00:10 GMT;';
148	}
149	$('#' + target).show();	
150}
151
152// 쿠키가 없을 경우 자동으로 LayerPopup 띄우기
153// 만약 자동으로 띄우고 싶지 않은 팝업의 경우, layerPopup 에 off 클래스를 추가한다.
154$(function() {
155	$('.layerPopup').each(function() {
156		if(!$(this).hasClass('off')) {
157			if($(this).find('.dayCloseCheck').length > 0) {
158				var cookie_name = document.cookie.match('(^|;) ?' + $(this).attr('id') + '=([^;]*)(;|$)');
159				cookie_name = cookie_name ? cookie_name[2] : false;
160				if(!cookie_name) {
161					$(this).show();
162				}
163			} else {
164				$(this).show();
165			}
166		}
167	});
168});
169
170
171/**************************************
172	Step Flow
173***************************************/
174function set_stepflow() {
175	$('.stepflow *').removeAttr('style');
176	$('.stepflow').each(function() {
177		var max_tit_height = 0;
178		var max_con_height = 0;
179		var max_total_height = 0;
180		var e_width = $(this).outerWidth();
181		var e_count = $(this).children('li').length;
182		var li_count = 0;
183		var min_width = typeof($(this).attr('data-min')) != 'undefined' ?  $(this).attr('data-min') * 1 : 0;
184		//min_width = min_width ? min_width : 300;
185		
186		for(let i = e_count; i > 0; i--) {
187			let check_value = e_width/i;
188			if(check_value >= min_width && li_count == 0) {
189				li_count = i;
190			}
191		}
192				
193		$(this).children('li').children('.item').each(function() {
194			let _tit_height = $(this).find('.tit').outerHeight();
195			let _con_height = $(this).find('.con').outerHeight();
196			let _total_height = (_tit_height*1) + (_con_height * 1);
197			
198			max_tit_height = max_tit_height < _tit_height ? _tit_height : max_tit_height;
199			max_con_height = max_con_height < _con_height ? _con_height : max_con_height;
200			max_total_height = max_total_height < _total_height ? _total_height : max_total_height;
201			
202			if($(this).find('.tit').length < 1 || $(this).find('.con').length < 1) {
203				$(this).addClass('single');
204			}
205		});
206		
207		if(min_width > 0) $(this).children('li').css('width', (100/li_count)+"%");
208		$(this).children('li').children('.item').find('.tit').css('height', max_tit_height + "px");
209		$(this).children('li').children('.item').find('.con').css('height', max_con_height + "px");
210		$(this).children('li').children('.item.single').find('.tit').css('height', max_total_height + "px");
211		$(this).children('li').children('.item.single').find('.con').css('height', max_total_height + "px");
212	});
213	setTimeout(function(){$('.box-stepflow').addClass('complate');},500);
214}
215$(function() {set_stepflow();});
216$(window).resize(function(){set_stepflow();});
217
218
219/**************************************
220	Real Name Wrap Setting
221***************************************/
222$(function() {
223	if($('.realNameWrap').length > 0) {
224		set_realname_layout();
225		setTimeout(function(){$('.realNameWrap').addClass('complate');},300);
226	}
227});
228function set_realname_layout() {
229	var max_desc_height = 0;
230	$('.realNameWrap *').removeAttr('style');
231	$('.realNameWrap .item .desc').each(function() {
232		max_desc_height = max_desc_height < $(this).outerHeight() ? $(this).outerHeight() : max_desc_height;
233	});
234	$('.realNameWrap .item .desc').css('height', max_desc_height + "px");
235}
236$(window).resize(function(){set_realname_layout();});
237
238
239/**************************************
240	QnA Flip Script
241***************************************/
242
243function qna_flip_list(obj) {
244	$(obj).closest('li').toggleClass('on').slblings().removeClass('on');
245}
246
247
248
249/**************************************
250	Image Responsive
251***************************************/
252$(function() {
253	if($('.box-image.big-view').length > 0) {
254		$('.box-image.big-view').each(function() {
255			if($(this).find('.btn-big-view').length == 0) {
256				let src = $(this).find('img').attr('src');
257				let btn = $("<a>").addClass('btn-big-view').attr('href', src).attr('target', '_blank').text("이미지 크게보기");
258				$(this).append(btn);
259			}
260			
261		});
262	}
263});
264
265
266
267
268

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.