PageSourceSearch

https://jeonju.go.kr/resource/www/js/wd_custom.js?v=22

js jeonju.go.kr collected 2026-10-02 06:03:45 UTC 18,522 bytes, 580 lines download raw bytes

1/*
2 * wd_custom.js
3 * 전주본청 js
4 *
5 */
6
7$(function(){
8	responsive();
9	searchControl();
10	topBtnControl();
11	snbControl();
12	darkMode();
13	tabControl();
14	if($('[data-main]').length > 0){
15		mainTabControl();
16		slideMainBanner();
17		slideMainAuto();
18	}
19});
20
21function darkMode(){
22   var modeSite = $('#hiddenSite').val();
23		var date = new Date();
24		$(document).on('click', '[data-darkView]' ,function(){
25			if($(this).hasClass('on')){
26				$('html').attr('data-mode','false');
27				$(this).attr('data-darkView','dark').removeClass('on').text('다크모드');
28
29
30        //darkOff
31
32        var data = {'modeType':"darkOff", 'modeSite':modeSite};
33        var jsonStr = JSON.stringify(data); // JSON 객체를 문자열로 변환
34        $.ajax({
35  				url: '/index.9is?contentUid=ff8080818bd75bf9018bd7b0c52f0885',
36  				type: 'post',
37  				data: jsonStr,
38  				contentType: "application/json; charset=utf-8",
39  				success: function(data){
40  					console.log(data);
41  					if(data.result_code == "0"){
42  						alert("입력 정보가 맞지 않습니다.");
43  					}else if(data.result_code == "1"){
44
45  					}
46  				},
47  				error:function(er){ //실패 시 실행
48  					alert(er);
49  				}
50  			});
51
52			}else{
53				$('html').attr('data-mode','true');
54				$(this).attr('data-darkView','light').addClass('on').text('라이트모드');
55
56
57        //darkOn
58        var data = {'modeType':"darkOn", 'modeSite':modeSite};
59        var jsonStr = JSON.stringify(data); // JSON 객체를 문자열로 변환
60        $.ajax({
61  				url: '/index.9is?contentUid=ff8080818bd75bf9018bd7b0c52f0885',
62  				type: 'post',
63  				data: jsonStr,
64  				contentType: "application/json; charset=utf-8",
65  				success: function(data){
66  					console.log(data);
67  					if(data.result_code == "0"){
68  						alert("입력 정보가 맞지 않습니다.");
69  					}else if(data.result_code == "1"){
70
71  					}
72  				},
73  				error:function(er){ //실패 시 실행
74  					alert(er);
75  				}
76  			});
77
78			}
79			return false;
80		});
81
82		var widthMatch = matchMedia("all and (max-width: 1200px)");
83		var widthHandler = function(matchList) {
84
85			if (matchList.matches) {
86
87				//$('html').removeAttr('data-mode');
88			//	$('[data-darkview]').attr('data-darkView','dark').removeClass('on').text('다크모드');
89
90			} else {
91
92				//$('html').attr('data-mode','false');
93				//$('[data-darkview]').attr('data-darkView','dark').removeClass('on').text('다크모드');
94			}
95		};
96	  widthMatch.addListener(widthHandler);
97		widthHandler(widthMatch);
98}
99function responsive(){
100	var res = ''
101	var param = $('#wrap');
102
103	//default
104	if(!($('.btn_menu_open').is(':hidden'))) res = 'mob';
105	else res = 'web';
106	param.attr('class',res);
107	def(param);
108
109	$(window).resize(function(){
110		if(!($('.btn_menu_open').is(':hidden'))) res2 = 'mob';
111		else res2 = "web";
112		param.attr("class",res2);
113		if(res != res2){
114			res = res2;
115			def(param);
116		}
117	});
118
119	function webGnb(){
120		$('#header .gnb > li').each(function(){
121			var gnbBox = $(this).find('.box'),
122				liSize = gnbBox.children('ul').children('li').length;
123			if(liSize <= 4){
124				$(this).attr('data-gnbSize',liSize);
125			}
126		});
127
128		$('#header .gnb > li > a').on({
129			mouseover: function(){
130				var ul_height = Math.floor($(this).parent().find('.box').outerHeight());
131				var gnb_height = ul_height;
132				if(isNaN(gnb_height)){
133					$('.gnb_bg').stop(true,false).animate({height:'0px'},300,function(){
134						$('.gnb_bg').removeClass('active');
135					});
136				}else{
137					$('.gnb_bg').addClass('active').stop(true,false).animate({height:gnb_height},300);
138				}
139
140				$('.gnb > li').removeClass('active').find('.box').removeClass('active');
141				$(this).parent().addClass('active').find('.box').addClass('active');
142
143				$('.gnb').hover(function() {
144				}, function(){
145					$('.gnb > li').removeClass('active').find('.box').removeClass('active');
146					$('.gnb_bg').stop(true,false).animate({height:'0px'},300,function(){
147						$('.gnb_bg').removeClass('active');
148					});
149				});
150				//console.log(ul_height)
151			},
152			focus: function(){
153				var ul_height = Math.floor($(this).parent().find('.box').outerHeight());
154				var gnb_height = ul_height;
155				if(isNaN(gnb_height)){
156					$('.gnb_bg').stop(true,false).animate({height:'0px'},300,function(){
157						$('.gnb_bg').removeClass('active');
158					});
159				}else{
160					$('.gnb_bg').addClass('active').stop(true,false).animate({height:gnb_height},300);
161				}
162
163				$('.gnb > li').removeClass('active').find('.box').removeClass('active');
164				$(this).parent().addClass('active').find('.box').addClass('active');
165
166				$('*').not('.gnb *').focus(function() {
167					$('.gnb > li').removeClass('active').find('.box').removeClass('active');
168					$('.gnb_bg').stop(true,false).animate({height:'0px'},300,function(){
169						$('.gnb_bg').removeClass('active');
170					});
171				});
172			}
173		});
174
175		$('.gnb li').each(function(){
176			if(!($(this).find('ul').length > 0)){
177				$(this).addClass('only');
178			}
179		});
180	}
181
182	function mobAllGnb(){
183		$('.gnb .box li').each(function(){
184			var allLink = $(this).children('a');
185			if(allLink.next('ul').length > 0){
186				$(this).children('a').addClass('open').append('<i>하위메뉴열기</i>');
187				if($(this).children('a').hasClass('on')){
188					var iText = $(this).children('a').find('i').text();
189					$(this).addClass('active').children('a').addClass('active').find('i').text(iText == '하위메뉴열기' ? '하위메뉴닫기' : '하위메뉴열기');
190				}
191				allLink.click(menuShow);
192			}
193		});
194
195		$('.gnb').each(function(){
196			var gnbLink = $(this).children('li').children('a'),
197				gnbBox = gnbLink.siblings('.box');
198			gnbLink.on('click',function(){
199				gnbLink.removeClass('active');
200				gnbBox.removeClass('active');
201				$(this).addClass('active').siblings('.box').addClass('active');
202				return false;
203			});
204			gnbLink.eq(0).click();
205		});
206
207		$('.btn_menu_open').on('click',function(){
208			if($(this).hasClass('active')){
209				$(this).removeClass('active').find('span').text('모바일메뉴열기');
210				$('.area_menu_all').removeClass('active');
211				$('body').removeClass('mobShow');
212			}else{
213				$(this).addClass('active').find('span').text('모바일메뉴닫기')
214				$('.area_menu_all').addClass('active');
215				$('body').addClass('mobShow');
216			}
217		});
218	}
219
220	//util setting
221	var utilHtml = $('.top_util .list_util').html();
222	$('.mob_gnb_control').append(utilHtml);
223	$('.mob_gnb_control [data-util="language"]').remove();
224
225	function def(param){
226		if(param.attr("class") == "web"){
227			webGnb();
228			$('#header nav .gnb > li a').off('click');
229			$('.btn_menu_open').off('click');
230			$('#header nav .gnb > li ul').removeAttr('style');
231			$('body').removeClass('mobShow');
232			$('#header nav .area_menu_all, #header nav .menu_all').contents().unwrap();
233			$('#header nav .gnb > li, .btn_menu_open').removeClass('active');
234			$('#header nav .gnb li a.open').removeClass('open').find('i').remove();
235			$('#header nav').append('<div class="gnb_bg"><span></span></div>');
236		} else if (param.attr("class") == "mob"){
237			mobAllGnb();
238			$('.gnb_bg').remove();
239			$('#header nav .gnb').wrapAll('<div class="menu_all"></div>');
240			$('#header nav .mob_gnb_control, #header nav .menu_all').wrapAll('<div class="area_menu_all"></div>');
241			$('#header nav .gnb > li').removeClass('active');
242			$('#header nav .gnb, #header nav .gnb li a').off('mouseenter mouseleave mouseover focus');
243		}
244	}
245}
246
247function menuShow(){
248	var openText = $(this).parent().find('> a > i').text();
249	$(this).parent().siblings().find('> a').removeClass('active').end().removeClass('active').children('ul').stop().slideUp('fast');
250	$(this).parent().siblings().find('> a > i').text('하위메뉴열기');
251	$(this).toggleClass('active');
252	$(this).parent('li:first').toggleClass('active').children('ul').stop().slideToggle('fast');
253	$(this).parent().find('> a > i').text(openText == '하위메뉴닫기' ? '하위메뉴열기' : '하위메뉴닫기');
254
255	return false;
256}
257
258//snb
259function snbControl(){
260    if(!($('.area_snb .snb').length > 0)) return;
261
262    var widthMatch = matchMedia("all and (max-width: 768px)");
263
264    var widthHandler = function(matchList) {
265        if (matchList.matches) {
266
267            $('.area_snb').each(function(){
268                var $wrap  = $(this);
269                var $btn   = $wrap.find('.btn_snb_mob');
270                var $ul    = $wrap.find('.snb');
271
272                // 중복 바인딩 방지
273                $btn.off('click.snb').on('click.snb', function(){
274                    if($(this).hasClass('active')){
275                        $(this).removeClass('active').attr('title','하위메뉴열기');
276                        $ul.stop().slideUp();
277                    }else{
278                        $(this).addClass('active').attr('title','하위메뉴닫기');
279                        $ul.stop().slideDown('fast');
280                    }
281                });
282
283                // 링크(a) 클릭은 기본 이동, 단 특정 링크만 예외 처리
284                $ul.find('a').off('click.snb').on('click.snb', function(e){
285                    var href = $(this).attr('href') || '';
286                    var target = $(this).attr('target') || '';
287
288                    // 새창 또는 safe 링크는 그대로 이동 (토글 영향 없음)
289                    if (target === '_blank' || href.indexOf('/safe/index.9is') > -1) {
290                        return;
291                    }
292
293                    // (선택) 모바일에서 메뉴 클릭 후 닫고 싶으면 아래만 실행
294                    $btn.removeClass('active').attr('title','하위메뉴열기');
295                    $ul.stop().slideUp();
296                });
297            });
298
299            // 바깥 클릭/포커스 시 닫기 (문서에 1번만 바인딩)
300            $(document).off('click.snbClose').on('click.snbClose', function(e){
301                if($(e.target).closest('.area_snb').length === 0){
302                    $('.area_snb .btn_snb_mob').removeClass('active').attr('title','하위메뉴열기');
303                    $('.area_snb .snb').stop().slideUp();
304                }
305            });
306
307        } else {
308            $('.area_snb .snb').removeAttr('style');
309            $('.btn_snb_mob').removeClass('active').off('click.snb');
310            $(document).off('click.snbClose');
311        }
312    };
313
314    // 구형 addListener 유지
315    widthMatch.addListener(widthHandler);
316    widthHandler(widthMatch);
317}
318
319
320//tab
321function tabControl(){
322    if(!($('.area_snb .tab').length > 0)) return;
323
324    var widthMatch = matchMedia("all and (max-width: 768px)");
325
326    var widthHandler = function(matchList) {
327        if (matchList.matches) {
328
329            $('.area_snb').each(function(){
330                var $wrap = $(this);
331                var $btn  = $wrap.find('.btn_snb_mob');
332                var $tab  = $wrap.find('.tab');
333
334                $btn.off('click.tab').on('click.tab', function(){
335                    if($(this).hasClass('active')){
336                        $(this).removeClass('active').attr('title','하위메뉴열기');
337                        $tab.stop().slideUp();
338                    }else{
339                        $(this).addClass('active').attr('title','하위메뉴닫기');
340                        $tab.stop().slideDown('fast');
341                    }
342                });
343            });
344
345        } else {
346            $('.area_snb .tab').removeAttr('style');
347            $('.btn_snb_mob').removeClass('active').off('click.tab');
348        }
349    };
350
351    widthMatch.addListener(widthHandler);
352    widthHandler(widthMatch);
353}
354//gnb 통합검색
355function searchControl(){
356	$('button[data-util="search"]').on('click',function(){
357		opSearch = $(event.target);
358		if($('.area_totalSearch').hasClass('active')){
359			$('.area_totalSearch').removeClass('active');
360		}else{
361			$('.area_totalSearch').addClass('active');
362		}
363	});
364	var closeBtn = $('.area_totalSearch').find('[data-layerpop="close"]');
365	closeBtn.on('click',function(){
366		$('.area_totalSearch').removeClass('active');
367		opSearch.focus();
368	});
369
370	$('*').not('.area_totalSearch *').on({
371		focus: function(){
372			$('.area_totalSearch').removeClass('active');
373		},
374	})
375}
376
377//footer top control
378function topBtnControl(){
379	if(!($('#btn_top').length > 0)) return;
380
381	var sideHeight = $(window).height() / 2,
382		btnTopPos = $('#btn_top').position().top;
383
384	$(window).scroll(function(){
385		var winTop = $(window).scrollTop();
386		if(sideHeight < winTop){
387			$('#btn_top').addClass('active');
388		}else{
389			$('#btn_top').removeClass('active');
390		}
391	});
392}
393
394function mainTabControl(){
395	$('.control_main_tab').each(function(){
396		var btnTab = $(this).find('[data-tabcont]'),
397			btnTabConts = $(this).find('.conts_tab');
398
399		btnTab.on('click', function(){
400			var tabId = $(this).data('tabcont');
401			btnTab.parent().removeClass('active');
402			btnTabConts.removeClass('active');
403			$(this).parent().addClass('active').closest('.control_main_tab').find('#'+ tabId).addClass('active');
404		});
405
406		btnTab.eq(0).click();
407	});
408}
409
410function slideMainBanner(){
411	if(!($('[data-main] .swiper').length > 0)) return;
412
413	var swiper = [];
414	$('[data-main]:not([data-slideAuto]) .swiper').each(function(i) {
415		var el = $(this).parent().attr('id');
416
417		var viewNum = 1,
418			slideNum = $('#'+el+' .swiper-slide').length;
419		if (slideNum > viewNum){
420			loopChk = true;
421		}else{
422			loopChk = false;
423		}
424
425		var effectType = $(this).parent().data('effect');
426		if(typeof effectType == '' || effectType == null || effectType == 'undefined'){
427			effectType = 'slide';
428		}else{
429			effectType = effectType
430		}
431
432		swiperM = 'swiper_'+el;
433		console.log(swiperM+"<-----swiperM");
434		var swiperM = new Swiper('#'+el+' .mySwiper', {
435			loop: loopChk,
436			autoplay: {
437				delay: 4000,
438				disableOnInteraction: false,
439			},
440			effect: effectType,
441			fadeEffect: {
442			    crossFade: true,
443			},
444			freeMode:false,
445			slideActiveClass:'active',
446			speed: 1000,
447			slidesPerView: 'auto',
448			lazy : {
449				loadPrevNext : true
450			},
451			on: {
452				init:function(swiper){
453					$('#'+el+' .swiper-slide-duplicate').not('.swiper-slide-active').attr('aria-hidden','true');
454					$('#'+el+' .swiper-slide-duplicate').not('.swiper-slide-active').find('a').attr('tabindex','-1');
455					var proTitle = $('#'+el+' .mySwiper').find('.active').find('[data-alt]').text();
456					$('#'+el+' .slide_subject span').text(proTitle);
457					console.log(proTitle+"<-----proTitle");
458					var slideBtn = $('#'+el).closest('.control_main_tab').find('[data-tabcont='+el+']');
459					console.log(slideBtn);
460					slideBtn.on('click',function(){
461						console.log($(this).parent().index());
462						swiperM.slideTo(0);
463						return false;
464					});
465				},
466			},
467			pagination: {
468				el: '#'+el+' .swiper_page',
469				type: 'fraction',
470				renderFraction: function (currentClass, totalClass) {
471					console.log(currentClass+"<-----currentClass");
472					console.log(totalClass+"<-----totalClass");
473					return '<span class="' + currentClass + '"></span> <span><i>/</i> <em class="' + totalClass + '"></em></span>';
474				}
475			},
476			navigation: {
477				nextEl: '#'+el+' .swiper_next',
478				prevEl: '#'+el+' .swiper_prev',
479			},
480			observer: true,
481		    observeParents: true,
482		});
483
484		swiperM.on('transitionStart', function () {
485			var proTitle = $('#'+el+' .mySwiper').find('.active').find('[data-alt]').text();
486			$('#'+el+' .slide_subject span').text(proTitle);
487		});
488
489		$(document).on('focus','#'+el+' .slide_item', function(){
490			swiperM.autoplay.stop();
491			$(this).parents('#'+el+' .mySwiper').scrollLeft(0);
492			swiperM.slideTo($(this).parent().index());
493			$('#'+el+' .swiper_auto').addClass('paused').children().html('자동재생시작');
494		});
495
496		$(document).on('click', '#'+el+' .swiper_auto' , function(e){
497			if($(this).hasClass('paused')){
498				$(this).removeClass('paused').children().html('자동재생정지');
499				swiperM.autoplay.start();
500			}else{
501				$(this).addClass('paused').children().html('자동재생시작');
502				swiperM.autoplay.stop();
503			}
504		});
505
506		$('.btn_slide_allView.open').on('click', function(){
507			banTarget = $(event.target);
508			showBan = $(this).closest('[data-main]').find('.area_ban_all');
509			showBan.attr('tabindex', '0').focus();
510			showBan.addClass('active');
511			$('.area_ban_all .list_all').scrollTop(0);
512			$('body').addClass('noneSCroll');
513		});
514		$('.btn_slide_allView.close').on('click', function(){
515			$(this).closest('.area_ban_all').removeClass('active');
516			$('body').removeClass('noneSCroll');
517			banTarget.focus();
518		});
519	});
520
521}
522
523function slideMainAuto(){
524	if(!($('[data-slideAuto]').length > 0)) return;
525
526	var swiper = [];
527	$('[data-slideAuto] .swiper').each(function(i) {
528		var el = $(this).parent().attr('id');
529		console.log(el+"<-----el");
530		var swiperSector = new Swiper('#'+el+' .mySwiper', {
531			freeMode:false,
532			slideActiveClass:'active',
533			speed: 1000,
534			slidesPerView: 'auto',
535			lazy : {
536				loadPrevNext : true
537			},
538			on: {
539				init:function(swiper){
540					$('#'+el+' .swiper-slide-duplicate').not('.swiper-slide-active').attr('aria-hidden','true');
541					$('#'+el+' .swiper-slide-duplicate').not('.swiper-slide-active').find('a').attr('tabindex','-1');
542
543					var slideBtn = $('#'+el).closest('[data-slideAuto]').find('[data-tabcont='+el+']');
544					slideBtn.on('click',function(){
545						swiperSector.slideTo(0);
546						return false;
547					});
548				},
549			},
550			navigation: {
551				nextEl: '#'+el+' .swiper_next',
552				prevEl: '#'+el+' .swiper_prev',
553			},
554			observer: true,
555		    observeParents: true,
556		});
557
558		$(document).on('focus','#'+el+' .slide_item', function(){
559			swiperSector.autoplay.stop();
560			$(this).parents('#'+el+' .mySwiper').scrollLeft(0);
561			swiperSector.slideTo($(this).parent().index());
562		});
563	});
564}
565
566// 분야별정보 - 인구정책
567$(document).ready(function(){
568  $(".updown_list>li>button").click(function(){
569	var $parentLi = $(this).parent("li");
570	var $span = $(this).find("span");
571	if ($parentLi.hasClass("active")) {
572	  $parentLi.removeClass("active");
573	   $span.text("닫힘");
574	} else {
575	  $(".updown_list>li").removeClass("active");
576	  $parentLi.addClass("active");
577	   $span.text("열림");
578	}
579  });
580});

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.