PageSourceSearch

https://www.kisa.or.kr/resource/eng/js/common.js

js kisa.or.kr collected 2026-09-24 08:27:38 UTC 8,768 bytes, 281 lines download raw bytes

1
2/*************************************************************************************************
3 
4 *  Common JS
5 
6 *************************************************************************************************/
7
8$(function(){
9	
10	"use strict";
11
12
13	
14/*---------------------------------------------------------------------------------------------------------------------------
15 * 	 PC Menu
16 *--------------------------------------------------------------------------------------------------------------------------*/
17
18	$('#gnb > ul > li > a').on("mouseenter focusin",function(e){
19		$('#gnb > ul > li').removeClass('on');
20
21		$(this).parent('li').addClass('on')
22		$('#header').addClass('open');
23		
24		var hd = $(this).next('.depth02_menu_wrap').stop().innerHeight();
25		var num = hd + 100;
26		
27		$('#header').stop().animate({height: num}, 350);
28		e.preventDefault();
29	})
30
31	$('.gnb_depth2').find('a').on("focusin",function(e){
32		$('#gnb > ul > li').removeClass('on');
33
34		$(this).parents('#gnb > ul > li').addClass('on')
35		$('#header').addClass('open');
36		
37		var hd = $(this).parents('.depth02_menu_wrap').stop().innerHeight();
38		var num = hd + 100;
39		
40		$('#header').stop().animate({height: num}, 350);
41	})
42
43	// 모바일에서 작동 안하게
44	if (matchMedia("screen and (min-width: 1000px)").matches) {
45		$('#header, .all_search_pop').on("mouseleave",function(){
46			gnb_close();
47		})
48	}
49	
50	$('#gnb').find("a").last().on("focusout",function(){
51		gnb_close();
52	});
53
54	function gnb_close(){
55		$('#header').stop().css({height: 100});
56		
57		$('#gnb > ul > li').removeClass('on');
58		$('#header').removeClass('open');
59	}
60
61
62	
63	
64
65
66/*---------------------------------------------------------------------------------------------------------------------------
67 * 	 Mobile Menu
68 *--------------------------------------------------------------------------------------------------------------------------*/
69	$('.mobile_menu').on('click', function(){
70		$('.menuMo_bg').fadeIn();
71		$('.menuMo').fadeIn();
72	})
73	
74	$('.menuMo .close').on('click', function(){
75		$('.menuMo_bg').fadeOut();
76		$('.menuMo').fadeOut();
77	})
78
79	$('#mo_gnb > ul > li.more > a , #mo_gnb > ul > li.more > button').on('click',function(){
80		if($(this).hasClass('on')){
81			$(this).removeClass('on');
82			$(this).next('.mo_gnb_depth2').stop().slideUp();
83		} else {
84			$(this).addClass('on');
85			$(this).next('.mo_gnb_depth2').stop().slideDown();
86		}
87	})
88
89	$('.mo_gnb_depth2 > li.more > a').on('click',function(){
90		if($(this).hasClass('on')){
91			$(this).removeClass('on');
92			$(this).next('.mo_gnb_depth3').stop().slideUp();
93		} else {
94			$(this).addClass('on');
95			$(this).next('.mo_gnb_depth3').stop().slideDown();
96		}
97	})
98
99	
100/*---------------------------------------------------------------------------------------------------------------------------
101 * 	 Head Search Pop
102 *--------------------------------------------------------------------------------------------------------------------------*/
103	$('.all_search').on('click', function(){
104		// $('.all_search_pop').insertAfter('#header .rb');
105		if($(this).hasClass('on')){
106			$(this).removeClass('on');
107			$('#header').removeClass('sc_b');
108			$('.all_search_pop').hide();
109		} else {
110			$(this).addClass('on');
111			$('#header').addClass('sc_b');
112			$('.all_search_pop').show();
113		}
114	})
115
116
117	$('.mobie_allSearch').on('click', function(){
118		if($(this).hasClass('on')){
119			$(this).removeClass('on');
120			$('.all_search_pop').fadeOut();
121		} else {
122			$(this).addClass('on');
123			$('.all_search_pop').fadeIn();
124		}
125	})
126
127
128
129	
130/*---------------------------------------------------------------------------------------------------------------------------
131 * 	 PC SUB Menu
132 *--------------------------------------------------------------------------------------------------------------------------*/
133	$('.sub_menu > li').on('mouseenter', function(){
134		$('.sub_menu > li').removeClass('on');
135		$('.sub_menu > li').not('.active').children('.sub_menu_depth2').stop().slideUp(300);
136		$(this).addClass('on');
137		$(this).children('.sub_menu_depth2').stop().slideDown(300);
138	})
139
140	$('.sub_menu').on('mouseleave', function(){
141		$('.sub_menu > li').removeClass('on');
142		$('.sub_menu > li').not('.active').children('.sub_menu_depth2').stop().slideUp(300);
143	})
144	
145	$('.sub_menu > li > a').on('focusin', function(){
146		$('.sub_menu > li > a').parent().removeClass('on');
147		$('.sub_menu > li').not('.active').find('a').next('.sub_menu_depth2').stop().slideUp(300);
148		$(this).parent().addClass('on');
149		$(this).next('.sub_menu_depth2').stop().slideDown(300);
150	})
151
152
153
154
155/*---------------------------------------------------------------------------------------------------------------------------
156 *  File Field
157 *--------------------------------------------------------------------------------------------------------------------------*/
158 
159	var fileTarget = $('.file_upload');
160
161    fileTarget.on('change', function(){
162        if(window.FileReader){
163            var filename = $(this)[0].files[0].name;
164        } else {
165            var filename = $(this).val().split('/').pop().split('\\').pop();
166        }
167
168        $(this).siblings('.upload_name').val(filename);
169    });
170		
171
172/*---------------------------------------------------------------------------------------------------------------------------
173* 	 SUB Sns Pop
174*--------------------------------------------------------------------------------------------------------------------------*/
175	$('.btn_tops.snsShare').on('click',function(){
176		$(this).toggleClass('on')
177	})
178
179	$('.sns_share_pop .btn_close').on('click',function(){
180		$('.btn_tops.snsShare').removeClass('on');
181		$('.sns_share_pop').hide('on');
182	})
183
184	
185});
186
187/*---------------------------------------------------------------------------------------------------------------------------
188 * 	 Top Zoom Control Function
189 *--------------------------------------------------------------------------------------------------------------------------*/
190
191var nowZoom = 100;
192
193function zoomOut() {   // 화면크기축소
194   nowZoom = nowZoom - 10;
195   if(nowZoom <= 70) nowZoom = 70;   // 화면크기 최대 축소율 70%
196   zooms();
197}
198
199function zoomIn() {   // 화면크기확대
200   nowZoom = nowZoom + 20;
201   if(nowZoom >= 200) nowZoom = 200;   // 화면크기 최대 확대율 200%
202   zooms();
203}
204
205function zoomReset() {
206   nowZoom = 100;   // 원래 화면크기로 되돌아가기
207   zooms();
208}
209
210function zooms() {
211   document.body.style.zoom = nowZoom + "%";
212   if(nowZoom == 70) {
213      alert("더 이상 축소할 수 없습니다.");
213   // 화면 축소율이 70% 이하일 경우 경고창
214   }
215   if(nowZoom == 200) {
216      alert("더 이상 확대할 수 없습니다.");   // 화면 확대율이 200% 이상일 경우 경고창
217   }
218}
219
220
221
222/*---------------------------------------------------------------------------------------------------------------------------
223 *  Print
224 *--------------------------------------------------------------------------------------------------------------------------*/
225function printPc() {
226	window.print();
227}
228
229
230/*---------------------------------------------------------------------------------------------------------------------------
231 * 	 Tab Function
232 *--------------------------------------------------------------------------------------------------------------------------*/
233function tab(e, num) {
234	var num = num || 0;
235	var menu = $(e).children();
236	var con = $(e + '_con').children();
237	var select = $(menu).eq(num);
238	var i = num;
239  
240	select.addClass('active');
241	con.hide();
242	con.eq(num).show();
243  
244	menu.click(function () {
245	  if (select !== null) {
246		select.removeClass("active");
247		con.eq(i).hide();
248	  }
249  
250	  select = $(this);
251	  i = $(this).index();
252  
253	  select.addClass('active');
254	  con.eq(i).show();
255	});
256  
257}
258
259/**
260 * 첨부파일 다운로드
261 * */     
262function fnPostAttachDownload(menu_seq, post_seq, attach_seq, lang_type) {
263	
264	$('<form></form>').attr("id","attachForm").attr("method","get").attr("action","/post/fileDownload")
265		.append($('<input/>', {type: 'hidden', name: 'menuSeq', value:menu_seq}))
266		.append($('<input/>', {type: 'hidden', name: 'postSeq', value:post_seq}))
267		.append($('<input/>', {type: 'hidden', name: 'attachSeq', value:attach_seq}))
268		.append($('<input/>', {type: 'hidden', name: 'lang_type', value:lang_type}))
269		.appendTo('body').submit();
270	if ($('#attachForm').length > 0) {
271		$('#attachForm').remove();
272	}
273}
274
275/*
276검색어 글자수 제한
277 */
278window.onload = function (){
279	$("input[class=txt_search]").prop('maxlength', '255');
280}
281  

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.