PageSourceSearch

https://www.kf.or.kr/00_common/js/common.js

js kf.or.kr collected 2026-10-02 03:04:05 UTC 13,784 bytes, 512 lines download raw bytes

1$(document).ready(function(){
2	if($('#meta-url').attr('content') == ""){
3		document.querySelector('#meta-url').setAttribute('content', location.href);
4	}
5});
6
7function searchGo(ctx){
8	if($("#query").val() == "") {
9		alert("검색어를 입력해주세요");
10		return;
11	}
12
13    $("#searchForm").attr("action","/"+ctx+"/search.do").submit();
14    return true;
15}
16
17
18function koreanaSearchGo(ctx){
19	if($("#query").val() == "") {
20		alert("검색어를 입력해주세요");
21		return;
22	}
23
24    $("#searchForm").attr("action","/"+ctx+"/search.do").submit();
25    return true;
26}
27
28//인쇄
29/*$(document).on("click", ".btnPrint", function(){
30	var initBody = document.body.innerHTML;
31
32	window.onbeforeprint = function () {
33		document.body.innerHTML = document.getElementById("subContent").innerHTML;
34	}
35
36	window.onafterprint = function () {
37		document.body.innerHTML = initBody;
38	}
39	window.print();
40   
41});*/
42
43
44	function kf_Print(){
45		 
46	    var browser = navigator.userAgent.toLowerCase();
47	    if ( -1 != browser.indexOf('chrome') ){
48	               window.print();
49	    }else if ( -1 != browser.indexOf('trident') ){
50	       try{
51	            //웹 페이지에 객체 삽입
52	            window.onbeforeprint = function () {
53	        		document.body.innerHTML = document.getElementById("subContent").innerHTML;
54	        	}
55	            window.onafterprint = function () {
56	        		document.body.innerHTML = initBody;
57	        	}
58	            //ExexWB 메쏘드 실행 (7 : 미리보기 , 8 : 페이지 설정 , 6 : 인쇄하기(대화상자))
59	            previewWeb.ExecWB(7, 1);
60
61	            //객체 해제
62	            previewWeb.outerHTML = "";
63	       }catch (e) {
64	            alert("- 도구 > 인터넷 옵션 > 보안 탭 > 신뢰할 수 있는 사이트 선택\n   1. 사이트 버튼 클릭 > 사이트 추가\n   2. 사용자 지정 수준 클릭 > 스크립팅하기 안전하지 않은 것으로 표시된 ActiveX 컨트롤 (사용)으로 체크\n\n※ 위 설정은 프린트 기능을 사용하기 위함임");
65	       }
66	    }else{
67	    	 window.print();
68	    }
69	}
70
71
72	
73
74
75//아세안문화원 고도화 인쇄
76$(document).on("click", ".btnPrintNew", function(){
77	var initBody = document.body.innerHTML;
78
79	window.onbeforeprint = function () {
80		document.body.innerHTML = document.getElementById("sub_contents_wrap").innerHTML;
81	}
82
83	window.onafterprint = function () {
84		document.body.innerHTML = initBody;
85	}
86
87	window.print();
88});
89
90/** 공유 하기 url 생성 */
91function makeUrl() {
92	var url = location.href;
93	var viewForm = $('#cntntsView form');
94	var mi = viewForm.find('input[name=mi]').val();
95	var dgtlSn = viewForm.find('input[name=nttSn]').val();
96	var dgtlType = viewForm.find('input[name=dgtlType]').val();
97	if (mi && dgtlSn && dgtlType)
98		url = url + '?mi=' + mi + "&dgtlSn=" + dgtlSn + "&dgtlType=" + dgtlType
99	url = url.replace('#', '')
100	return url;
101}
102
103/*
104* 네이버 공유하기
105*/
106$(document).on("click", ".snsBox .xi-naver", function() {
107	var url = encodeURI(encodeURIComponent(makeUrl()));
108    var title = encodeURI(encodeURIComponent($(document).find("title").text()));
109    if(title == null || title == ''){
110    	title = '한국국제교류재단';
111    }
112
113	window.open('https://share.naver.com/web/shareView.nhn?url='+url+'&title='+title, 'naver', 'width=436,height=626');
114});
115
116/*
117* 구글 공유하기
118*/
119$(document).on("click", ".snsBox .xi-google", function() {
120	var url = makeUrl();
121    var title = $(document).find("title").text();
122    if(title == null || title == ''){
123    	title = '한국국제교류재단';
124    }
125    window.open("https://plus.google.com/share?url=" + encodeURIComponent(url), 'google', 'width=436,height=626');
126});
127
128/*
129 * 카카오톡 공유하기
130 */
131function sendLink(){
132
133	var url = makeUrl();
134    var title = $(document).find("title").text();
135    if(title == null || title == ''){
136    	title = '한국국제교류재단';
137    }
138
139	Kakao.init('750b4c63e096dd35ded33b0ee5666deb');
140    // // 카카오링크 버튼을 생성합니다. 처음 한번만 호출하면 됩니다.
141    Kakao.Link.createDefaultButton({
142      container: '#kakao-link-btn',
143      objectType: 'feed',
144      content: {
145        title: title,
146        description:"한국국제교류재단은 대한민국의 대표 공공기관으로서 외국과의 교류사업을 통해 한국에 대한 이해를 제고하고 국제적 우호친선을 증진",
147        imageUrl: 'https://www.kf.or.kr/images/web/kf/main/f_logo.png',
148        link: {
149          mobileWebUrl: url,
150          webUrl: url
151        }
152      },
153      buttons: [
154        {
155          title: '웹으로 보기',
156          link: {
157            mobileWebUrl: url,
158            webUrl: url
159          }
160        },
161        {
162          title: '앱으로 보기',
163          link: {
164            mobileWebUrl: url,
165            webUrl: url
166          }
167        }
168      ]
169    });
170}
171
172/*
173* 트위터 공유하기
174*/
175$(document).on("click", ".s-twitter-icon", function() {
176
177	var url = makeUrl();
178    var title = $(document).find("title").text();
179    if(title == null || title == ''){
180    	title = '한국국제교류재단';
181    }
182    window.open("http://twitter.com/share?url=" + encodeURIComponent(url)+"&text="+encodeURI(title), 'twitter', 'width=436,height=626');
183});
184
185/*
186* 페이스북 공유하기
187*/
188$(document).on("click", ".snsBox .xi-facebook", function() {
189
190	var url = makeUrl();
191    var title = $(document).find("title").text();
192    if(title == null || title == ''){
193    	title = '한국국제교류재단';
194    }
195    window.open("http://www.facebook.com/sharer.php?u=" + encodeURIComponent(url) + "&t=" + encodeURI(title), 'facebook', 'width=436,height=626');
196});
197
198/*
199 * 링크 공유하기
200 */
201function fn_shareCopyLink() {
202    const url = window.location.href; // 현재 페이지 URL
203    if (navigator.clipboard) {
204        navigator.clipboard.writeText(url).then(() => {
205            alert("링크가 복사되었습니다.");
206        }).catch((err) => {
207            alert("링크 복사에 실패했습니다.");
208            console.error("Clipboard error:", err);
209        });
210    } else {
211        // Clipboard API가 지원되지 않으면 execCommand로 복사 시도
212        const textArea = document.createElement('textarea');
213        textArea.value = url;
214        document.body.appendChild(textArea);
215        textArea.select();
216        try {
217            document.execCommand('copy');
218            alert("링크가 복사되었습니다.");
219        } catch (err) {
220            alert("클립보드 복사에 실패했습니다.");
221        }
222        document.body.removeChild(textArea);
223    }
224}
225
226// sysId 없이 로그인 페이지 이동
227function goUnityLoginPage(sysId, cmmSysId, langTy) {
228
229	var finalSysId = sysId;
230	var subscripAt = "";
231	if('kid' == sysId) {
232		finalSysId = cmmSysId;
233	} else if ('koreanaSub' == cmmSysId){ // 코리아나 구독페이지 임시 변수
234		subscripAt = "K";
235	} else if ('qnList' == cmmSysId) { // 설문조사 리스트 페이지
236		subscripAt = "L";
237	} else if ('qnRspns' == cmmSysId) { // 설문조사 작성 페이지
238		subscripAt = "R";
239	}
240
241	var newForm = document.createElement('form');
242
243	newForm.name = 'newForm';
244	newForm.method = 'post';
245	newForm.action = '/kid/lo/login/loginPage.do';
246
247	var input1 = document.createElement('input');
248	var input2 = document.createElement('input');
249
250	input1.setAttribute("type", "hidden");
251	input1.setAttribute("name", "sysId");
252	input1.setAttribute("value", finalSysId);
253	newForm.appendChild(input1);
254
255	if(langTy != "" && langTy != undefined){
256		input2.setAttribute("type", "hidden");
257		input2.setAttribute("name", "langTy");
258		input2.setAttribute("value", langTy);
259		newForm.appendChild(input2);
260		$.ajax({
261			url : "/kid/saveLangTy.do",
262			data:{langTy:langTy
263				  ,sysId:finalSysId
264				  ,subscripAt : subscripAt
265			},
266			type : "post",
267			dataType:"json",
268			async : "true",
269			success:function(data){
270
271			}
272		});
273
274		input2.setAttribute("type", "hidden");
275		input2.setAttribute("name", "rtnSysUrl");
276		input2.setAttribute("value", finalSysId);
277		newForm.appendChild(input2);
278
279	} else {
280		$.ajax({
281			url : "/kid/saveLangTy.do",
282			data:{langTy:"KOR"
283				  ,sysId:finalSysId
284				  ,subscripAt : subscripAt
285			},
286			type : "post",
287			dataType:"json",
288			async : "true",
289			success:function(data){
290
291			}
292		});
293
294		input2.setAttribute("type", "hidden");
295		input2.setAttribute("name", "rtnSysUrl");
296		input2.setAttribute("value", finalSysId);
297		newForm.appendChild(input2);
298	}
299	document.body.appendChild(newForm);
300	newForm.submit();
301
302}
303
304// 구독관리 클릭 시
305function goUnityLoginSubscrip(sysId, subscripAt) {
306
307	var newForm = document.createElement('form');
308
309	newForm.name = 'newForm';
310	newForm.method = 'post';
311	newForm.action = '/kid/lo/login/beforeSubscription.do';
312
313	var input1 = document.createElement('input');
314	var input2 = document.createElement('input');
315
316	input1.setAttribute("type", "hidden");
317	input1.setAttribute("name", "sysId");
318	input1.setAttribute("value", sysId);
319
320	input2.setAttribute("type", "hidden");
321	input2.setAttribute("name", "subscripAt");
322	input2.setAttribute("value", subscripAt);
323
324	newForm.appendChild(input1);
325	newForm.appendChild(input2);
326
327	document.body.appendChild(newForm);
328	newForm.submit();
329
330}
331
332// sysId 없이 마이페이지 이동
333function goUnityMyPage(sysId, cmmSysId) {
334	var finalSysId = sysId;
335
336	if('kid' == sysId) {
337		finalSysId = cmmSysId;
338	}
339
340	var newForm = document.createElement('form');
341
342	newForm.name = 'newForm';
343	newForm.method = 'post';
344	newForm.action = '/kid/mypage.do';
345
346	var input1 = document.createElement('input');
347
348	input1.setAttribute("type", "hidden");
349	input1.setAttribute("name", "sysId");
350	input1.setAttribute("value", finalSysId);
351
352	newForm.appendChild(input1);
353
354	document.body.appendChild(newForm);
355	newForm.submit();
356}
357
358function goUnityJoinPage(sysId, cmmSysId) {
359	var finalSysId = sysId;
360
361	if('kid' == sysId) {
362		finalSysId = cmmSysId;
363	}
364
365	var newForm = document.createElement('form');
366
367	newForm.name = 'newForm';
368	newForm.method = 'post';
369	// ssjeong 회원가입페이지 kf.or.kr로 통일(local test시에는 기존소스('/kid/sb/..) 사용하세요.
370	newForm.action = '/kid/sb/sbscrb/insertSbscrbInfo00.do';
371	//적용 보류
372	//newForm.action = 'https://www.kf.or.kr/kid/sb/sbscrb/insertSbscrbInfo00.do';
373
374	var input1 = document.createElement('input');
375
376	input1.setAttribute("type", "hidden");
377	input1.setAttribute("name", "sysId");
378	input1.setAttribute("value", finalSysId);
379
380	newForm.appendChild(input1);
381
382	document.body.appendChild(newForm);
383	newForm.submit();
384}
385
386function goCommonMyPage(sysId, cmmSysId, url) {
387	var finalSysId = sysId;
388
389	if('kid' == sysId) {
390		finalSysId = cmmSysId;
391	}
392
393	var newForm = document.createElement('form');
394
395	newForm.name = 'newForm';
396	newForm.method = 'post';
397	newForm.action = url;
398
399	var input1 = document.createElement('input');
400
401	input1.setAttribute("type", "hidden");
402	input1.setAttribute("name", "sysId");
403	input1.setAttribute("value", finalSysId);
404
405	newForm.appendChild(input1);
406
407	document.body.appendChild(newForm);
408	newForm.submit();
409}
410
411function goCommonSearchPage(sysId, cmmSysId, searchType) {
412	var finalSysId = sysId;
413	var url = "";
414
415	if('kid' == sysId) {
416		finalSysId = cmmSysId;
417	}
418
419	if(searchType == 'id') {
420		url = "/kid/lo/login/searchIdPage.do";
421	} else if (searchType == 'pw'){
422		url = "/kid/lo/login/searchPwPage.do";
423	}
424	var newForm = document.createElement('form');
425
426	newForm.name = 'newForm';
427	newForm.method = 'post';
428	newForm.action = url;
429
430	var input1 = document.createElement('input');
431
432	input1.setAttribute("type", "hidden");
433	input1.setAttribute("name", "sysId");
434	input1.setAttribute("value", finalSysId);
435
436	newForm.appendChild(input1);
437
438	document.body.appendChild(newForm);
439	newForm.submit();
440}
441
442
443
444//파라미터 페이지 이동
445function goParamPage( setVal, setNm, setUrl ) {
446   $("#paramNm").val(setNm);
447   $("#paramVal").val(setVal);
448   location.href = setUrl+"?"+setNm+"="+setVal;
449};
450
451//메뉴 접근 권한 체크
452function menuAccessCheck(mi, sysId){
453	var url = "/" + sysId + "/mn/menu/menuAccess.do"
454
455	$.ajax({
456		type : "post",
457		url : url,
458		data : {
459			menuId : mi
460		},
461		dataType : "json",
462		success : function(data) {
463			var accessVal = JSON.parse(data.accessVal);
464
465			if (accessVal == "Y") {
466				var accessUrl = JSON.parse(data.menuUrl);
467				location.href = accessUrl;
468			} else {
469				alert("접근 권한이 없습니다.");
470				return false;
471			}
472		},
473		error : function(data) {
474			alert("오류가 발생하였습니다.\n관리자에게 문의하세요.");
475		}
476	});
477}
478/*
479 * 아세안문화원
480 * 시설소개 floor 포커스 이동
481 * */
482$(document).on('click','.floorInfo', function(){
483	var floorData = $(this).attr('data-id');
484	$('#con_com'+floorData)[0].scrollIntoView();
485 })
486
487//null 값이면 빈공백으로 return
488function nullToBlank(val) {
489	if( !val && val != 0){
490		return "";
491	}
492
493	return val;
494}
495
496function goKf(url,lang){
497	var uri = document.location.href;
498	var loginAt = $("#loginAt").val();
499	if(uri.indexOf("localhost") < 0 && uri.indexOf("115.94.11.18") < 0){
500		if(loginAt == "Y"){
501			if(lang == "K"){
502				location.href = "https://www.kf.or.kr/kf/ssoInfo.do?rtnUrl="+url;
503			} else {
504				location.href = "https://www.kf.or.kr/kfEng/ssoInfo.do?rtnUrl="+url;
505			}
506		} else {
507			location.href = url;
508		}
509	} else {
510		location.href = "/kf/main.do"
511	}
512}

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.