PageSourceSearch

https://postech.ac.kr/search/front/wpdldptm/search.js

js postech.ac.kr collected 2026-09-24 08:32:54 UTC 13,755 bytes, 375 lines download raw bytes

1/**
2 * @Description: RSS 검색솔루션 자바스크립트	<br>
3 * @author : 주레피	<br>
4 * @Date : 2022.-12-13	<br>
5 * @Version : 1.0	<br>
6 * 
7 * <pre>
8 * << 개정이력(Modification Information) >>
9 * 수정일         수정자       수정내용
10 * ----------    --------    ---------------------------
11 * 2022-12-12    주레피       최초 생성
12 * 2022-12-12    주레피       keydownFocus() 키보드 포커스 함수 추가
13 * 2022-01-11    김민규       keydownFocus() 검색어의 값이 있는데 엔터를 누르는 경우 검색어가 없어지고 "검색결과를 입력해주세요." 팝업이 뜨는 것 개선
14 * 2023-01-31    이범진       keydownFocus() 특수키, 펑션키 입력 시 포커스 이동 예외처리
15 * 2024-07-22	 이규헌	    함수 리팩터링
16 * </pre>
17 * 
18 * 
19 */
20
21/* Function */
22function formSubmit(){
23	if(document.RsaSearchForm1.qt.value==""){
24		clickFldSet(document.RsaSearchForm1,'menu', '통합검색' );
25	}else{
26		document.RsaSearchForm1.submit();
27	}
28}
29
30	
31	function content_view(){
32		document.RsaSearchForm2.submit();
33	}
34
35function keydownFocus() {
36	$is_focused = false;
37	$("body").keydown(function(e) {
38		if($is_focused == false) {
39			// 최초 키보드 입력시 값 초기화
40			if($("#qt").val()==''){ // qt의 값이 없으면 초기화 및 포커싱
41				$("#qt").val('');
42				$("#qt").focus();
43			}else if(e.keyCode < 47 || e.keyCode > 111 ){ // 특수키, 펑션키 사용 가능
44				return;
45			}else if(e.ctrlKey || e.altKey || e.shiftKey){ // ctrl, alt, shift 키가 눌려져있을 시 키 동시 입력
46				if(e.keyCode > 47 || e.keyCode < 112){
47					return;
48				}
49			}else{
50				// qt의 값이 있으면
51				if (e.key === 'Enter' || e.keyCode === 13){ // 엔터가 되지 않게 하고, 포커싱도 안되게 하고
52					e.preventDefault();
53				}
54				else{ // 엔터 외의 키를 누르면 qt를 초기화하고 포커싱 가도록 조치
55					$("#qt").val('');
56					$("#qt").focus();
57				
58				}
59			}
60		}
61	});
62
63	$("#qt").focus(function(e) {
64		if($is_focused == false) {
65			// this.select();
66			// console.log(e);
67			$is_focused = true;
68			return false;
69		};
70	});
71
72	$("#qt").focusout(function() {
73		if($is_focused == true) {
74			$is_focused = false;
75		};
76	});
77}
78
79function openPopWin(div,px,py){
80  var divObj=document.getElementById(div);
81  divObj.style.left=px+"px";
82  divObj.style.top=py+"px";
83  divObj.style.display="block";
84}
85
86function closePop(div){
87  document.getElementById(div).style.display="none";
88}
89
90// image rollover 
91function dr( obj ) {
92    obj.src = obj.src.replace( 'off.gif', 'on.gif' );
93}
94function outImg( obj ) {
95    obj.src = obj.src.replace( 'on.gif', 'off.gif' );
96}
97
98var nowOpenedSelectBox = "";
99var mousePosition = "";
100
101function selectThisValue(thisId,thisIndex,thisValue,thisString) {
102	var objId = thisId;
103	var nowIndex = thisIndex;
104	var valueString = thisString;
105	var sourceObj = document.getElementById(objId);
106	var nowSelectedValue = document.getElementById(objId+"SelectBoxOptionValue"+nowIndex).value;
107	hideOptionLayer(objId);
108	if (sourceObj) sourceObj.value = nowSelectedValue;
109	settingValue(objId,valueString);
110	selectBoxFocus(objId);
111	if (sourceObj.onchange) sourceObj.onchange();
112}
113
114function selectThisValueMyMenu(thisId,thisIndex,thisValue,thisString, className) {
115	var objId = thisId;
116	var nowIndex = thisIndex;
117	var valueString = thisString;
118	var sourceObj = document.getElementById(objId);
119	var nowSelectedValue = document.getElementById(objId+"SelectBoxOptionValue"+nowIndex).value;
120	hideOptionLayer(objId);
121	if (sourceObj) sourceObj.value = nowSelectedValue;
122	settingValue(objId,valueString);
123	selectBoxFocusMyMenu(objId, className);
124	if (sourceObj.onchange) sourceObj.onchange();
125}
126
127function settingValue(thisId,thisString) {
128	var objId = thisId;
129	var valueString = thisString;
130	var selectedArea = document.getElementById(objId+"selectBoxSelectedValue");
131	if (selectedArea) selectedArea.innerHTML = valueString.replace("&","&");
132}
133
134function viewOptionLayer(thisId) {
135	var objId = thisId;
136	var optionLayer = document.getElementById(objId+"selectBoxOptionLayer");
137	if (optionLayer) optionLayer.style.display = "";
138	nowOpenedSelectBox = objId;
139	setMousePosition("inBox");
140}
141
142function hideOptionLayer(thisId) {
143	var objId = thisId;
144	var optionLayer = document.getElementById(objId+"selectBoxOptionLayer");
145	if (optionLayer) optionLayer.style.display = "none";
146}
147
148function setMousePosition(thisValue) {
149	var positionValue = thisValue;
150	mousePosition = positionValue;
151}
152
153function clickMouse() {
154	if (mousePosition == "out") hideOptionLayer(nowOpenedSelectBox);
155}
156
157function selectBoxFocus(thisId) {
158	var objId = thisId;
159	var obj = document.getElementById(objId + "selectBoxSelectedValue");
160	obj.className = "selectBoxSelectedAreaFocus";
161	obj.focus();
162}
163
164function selectBoxFocusMyMenu(thisId, classNameFocus) { //MyMeny
165	var objId = thisId;
166	var obj = document.getElementById(objId + "selectBoxSelectedValue");
167	obj.className = classNameFocus;
168	obj.focus();
169}
170
171function selectBoxBlurMyMenu(thisId, classNameFocus) {
172	var objId = thisId;
173	var obj = document.getElementById(objId + "selectBoxSelectedValue");
174	obj.className = classNameFocus;
175}
176
177function selectBoxBlur(thisId) {
178	var objId = thisId;
179	var obj = document.getElementById(objId + "selectBoxSelectedValue");
180	obj.className = "selectBoxSelectedArea";
181}
182
183
184function makeSelectBoxGlobal(thisId, selectBoxSelectedArea, lineColor, downArrowSrcPath, selectBoxOption, selectBoxSelectedAreaFocus, selectBoxOptionOver) {
185	var downArrowSrc = downArrowSrcPath; //rightArrow
186	var downArrowSrcWidth = 16;	//rightQrrow Image width
187	var optionHeight = 16; // option heigh
188	var optionMaxNum = 10; // option Maxnum
189	var optionInnerLayerHeight = "";
190	var objId = thisId;
191	var obj = document.getElementById(objId);
192	var selectBoxWidth = parseInt(obj.style.width);
193	var selectBoxHeight = parseInt(obj.style.height);
194	if (obj.options.length > optionMaxNum) optionInnerLayerHeight = "height:"+ (optionHeight * optionMaxNum) + "px";
195	newSelect  = "<table id='" + objId + "selectBoxOptionLayer' cellpadding='0' cellspacing='0' border='0' style='position:absolute;z-index:100;display:none;' onMouseOver=\"viewOptionLayer('"+ objId + "')\" onMouseOut=\"setMousePosition('out')\">";
196	newSelect += "	<tr>";
197	newSelect += "		<td height='" + (selectBoxHeight - 1) + "' style='cursor:hand;' onClick=\"hideOptionLayer('"+ objId + "')\" onMouseOut=\"hideOptionLayer('"+ objId + "')\"></td>";
198	newSelect += "	</tr>";
199	newSelect += "	<tr>";
200	newSelect += "		<td bgcolor='"+lineColor+"' style='padding:0px 1px 1px 1px'>";
201	newSelect += "		<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
202	newSelect += "			<tr>";
203	newSelect += "				<td height='3' bgcolor='#ffffff'></td>";
204	newSelect += "			</tr>";
205	newSelect += "		</table>";
206	newSelect += "		<div id='"+ objId + "SelectBoxOptionArea' class='selectBoxOptionInnerLayer' style='width:" + (selectBoxWidth-2) + "px;" + optionInnerLayerHeight + "' onMouseOut=\"hideOptionLayer('"+ objId + "')\">";
207	newSelect += "		<table cellpadding='0' cellspacing='0' border='0' width='100%' style='table-layout:fixed;word-break:break-all;'>";
208	for (var i=0 ; i < obj.options.length ; i++) {
209		var nowValue = obj.options[i].value;
210		var nowText = obj.options[i].text;
211		if (nowValue != null && nowValue != "") { // value.
212			newSelect += "	<tr>";
213			newSelect += "		<td height='" + optionHeight + "' class='"+selectBoxOption+"' onMouseOver=\"this.className='"+selectBoxOptionOver+"'\" onMouseOut=\"this.className='"+selectBoxOption+"'\" onClick=\"selectThisValueMyMenu('"+ objId + "'," + i + ",'" + nowValue + "','" + nowText + "','"+selectBoxSelectedAreaFocus+"')\" style='cursor:hand;'>" + nowText + "</td>";
214			newSelect += "		<input type='hidden' id='"+ objId + "SelectBoxOptionValue" + i + "' value='" + nowValue + "'>";
215			newSelect += "	</tr>";
216		}
217	}
218	newSelect += "		</table>";
219	newSelect += "		</div>";
220	newSelect += "		<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
221	newSelect += "			<tr>";
222	newSelect += "				<td height='4' bgcolor='#ffffff'></td>";
223	newSelect += "			</tr>";
224	newSelect += "		</table>";
225	newSelect += "		</td>";
226	newSelect += "	</tr>";
227	newSelect += "</table>";
228	newSelect += "<table cellpadding='0' cellspacing='1' border='0' bgcolor='"+lineColor+"' onClick=\"viewOptionLayer('"+ objId + "')\" style='cursor:hand;' onMouseOut=\"setMousePosition('out')\">";
229	newSelect += "	<tr>";
230	newSelect += "		<td bgcolor='#ffffff'>";
231	newSelect += "		<table cellpadding='0' cellspacing='0' border='0'>";
232	newSelect += "			<tr>";
233	newSelect += "				<td><div id='" + objId + "selectBoxSelectedValue' class='"+selectBoxSelectedArea+"' style='width:" + (selectBoxWidth - downArrowSrcWidth - 2) + "px;height:" + (selectBoxHeight - 2) + "px;overflow:hidden;' onBlur=\"selectBoxBlurMyMenu('" + objId + "', '"+selectBoxSelectedAreaFocus+"')\"></div></td>";
234	newSelect += "				<td><img src='" + downArrowSrc + "' width='" + downArrowSrcWidth + "' border='0'></td>";
235	newSelect += "			</tr>";
236	newSelect += "		</table>";
237	newSelect += "		</td>";
238	newSelect += "	</tr>";
239	newSelect += "</table>";
240	document.write(newSelect);
241	
242	var haveSelectedValue = false;
243	for (var i=0 ; i < obj.options.length ; i++) {
244		if (obj.options[i].selected == true) {
245			haveSelectedValue = true;
246			settingValue(objId,obj.options[i].text);
247		}
248	}
249	if (!haveSelectedValue) settingValue(objId,obj.options[0].text);
250}
251/* Select Box Design Script End */
252function goLeftSelectBoxMenu(thisURL,thisTarget) {
253	if (thisURL == "" || thisURL == null || thisURL == "separator") return;
254	var nowTarget = "_self";
255	if (thisTarget != null && thisTarget != "" ) nowTarget = thisTarget;
256	window.open(thisURL, nowTarget, "");
257}
258
259function imageReset(){
260		$('img').each( function(){
261			let instance = $(this);
262			let img = new Image();
263
264			$(img).error(function(){
265				if(instance.hasClass('thumb_img'))
266				{
267					instance.attr('src', 'images/noimage.png');
268				}
269				else if(instance.hasClass('file_icn'))
270				{
271					instance.attr('src', 'images/file_icn_unknown.png');
272				}
273			}).attr('src', instance.attr('src'));
274
275			if(instance.hasClass('sect_image') && instance.attr('src')!='')
276				instance.show();
277		});
278}
279
280/* Document Ready */
281
282	$(document).ready(function($) {
283		/* 검색 창 */
284		$(".sc_input").attr("autocomplete", "off"); /* 시스템 자동 완성 해제 */
285		$(".sc_input").css("ime-mode", "active"); /* 한글 기본 */
286
287		/* 인기 검색어 상태 저장 */
288		let fMode=readCookie("fMode");
289		if(fMode=='day') $('#pc_title_on2').trigger('click');
290		else if(fMode=="week")
291		{
292			$('#pc_title_on3').trigger('click');
293		}
294		else if(fMode=='month') $('#pc_title_on4').trigger('click');
295
296		/* 카테고리 상태 저장 */
297		let cMode=readCookie("cMode");
298		if(cMode=='open')
299		{
300			$('.nav-wrap button').attr('class', 'open');
301			$('.nav-wrap button').trigger('click');
302		}
303
304		/* 상세보기 상태 저장 */
305		let advMode=readCookie("advMode");
306		if(advMode=='open')detailOpen();
307		
308		imageReset();
309			/*
310		
311		$.ajax({
312			url: '/search/mTool/common/getdirectList.do'       // 요청 할 주소
313			, async: true           // false 일 경우 동기 요청으로 변경
314			, type: 'post'          // GET, PUT
315			, data: $('form[name="RsaSearchForm1"]').serialize()    // 전송할 데이터
316			, dataType: 'text' // xml, json, script, html
317			, beforeSend: function(jqXHR) {}        // 서버 요청 전 호출 되는 함수 return false; 일 경우 요청 중단
318			, success: function(jqXHR) {            // 요청 완료 시
319				var data = jqXHR;
320 				if(data.length>100)
321				{
322					$('div.totalSearch_golink').html(data);
323					$('div.totalSearch_golink').show();
324				}
325			}
326			, error: function(jqXHR) {}                     // 요청 실패
327			, complete: function(jqXHR) {}          // 요청의 실패, 성공과 상관 없이 완료 될 경우 호출
328		});
329
330		$.ajax({
331				url: '/search/mTool/common/getcontentList.do'      // 요청 할 주소
332				, async: true           // false 일 경우 동기 요청으로 변경
333				, type: 'post'          // GET, PUT
334				, data: $('form[name="RsaSearchForm1"]').serialize()    // 전송할 데이터
335				, dataType: 'text' // xml, json, script, html
336				, beforeSend: function(jqXHR) {}        // 서버 요청 전 호출 되는 함수 return false; 일 경우 요청 중단
337				, success: function(jqXHR) {            // 요청 완료 시
338					var data = jqXHR;
339					if(data.length>100)
340				{
341					$('div.totalSearch_goTheme').html(data);
342					$('div.totalSearch_goTheme').show();
343				}
344				}
345				, error: function(jqXHR) {}                     // 요청 실패
346				, complete: function(jqXHR) {}          // 요청의 실패, 성공과 상관 없이 완료 될 경우 호출
347			});
348		
349            $.ajax({
350				url: '/search/mTool/common/getSaurusList.do'       // 요청 할 주소
351				, async: true           // false 일 경우 동기 요청으로 변경
352				, type: 'post'          // GET, PUT
353				, data: $('input[name="qt"]').serialize()	// 전송할 데이터
354				, dataType: 'text' // xml, json, script, html
355				, beforeSend: function(jqXHR) {}        // 서버 요청 전 호출 되는 함수 return false; 일 경우 요청 중단
356				, success: function(jqXHR) {            // 요청 완료 시
357					var data = jqXHR;
358	 				if(data.length>100)
359					{
360						$('div#cont').html(data);
361						$('div#cont').show();
362					}
363				}
364				, error: function(jqXHR) {}                     // 요청 실패
365				, complete: function(jqXHR) {}          // 요청의 실패, 성공과 상관 없이 완료 될 경우 호출
366			});
367            */
368			$("#btuniv").change(function() {
369				$("#btuniv option:selected").each(function() {
370					$("#menu").val($(this).val());
371					$("#section").val($(this).val());
372				});
373			});
374	});
375

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.