PageSourceSearch

https://bexco.co.kr/resources/_Js/core/common_base_util.js

js bexco.co.kr collected 2026-10-02 07:46:14 UTC 13,574 bytes, 340 lines download raw bytes

1//------------------------------------------------------------------------------------------------------------------------------------  기본 util :: 시작
2function isNullOrBlank(obj){
3	if(obj == null || obj == "")return true;
4	else return false;
5}
6
7function isNull(obj){
8	if(obj == null)return true;
9	else return false;
10}
11
12function isBlank(obj){
13	if(obj == "")return true;
14	else return false;
15}
16
17//속성 만들기
18function _createElement_formAdd(form, type, name, value){
19	var buyIdObject = document.createElement("input");
20	buyIdObject.setAttribute("type", type);
21	buyIdObject.setAttribute("name", name);
22	buyIdObject.setAttribute("value",value);
23	form.appendChild(buyIdObject);
24}
25
26/*스크립트 날짜 포맷 자동 완성 함수*/
27Date.prototype.format = function(f) {
28    if(!this.valueOf()) return " ";
29
30    var weekName = ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"];
31    var d = this;
32
33    return f.replace(/(yyyy|yy|MM|dd|E|hh|mm|ss|a\/p)/gi, function($1) {
34        switch ($1) {
35            case "yyyy": return d.getFullYear();
36            case "yy": return (d.getFullYear() % 1000).zf(2);
37            case "MM": return (d.getMonth() + 1).zf(2);
38            case "dd": return d.getDate().zf(2);
39            case "E": return weekName[d.getDay()];
40            case "HH": return d.getHours().zf(2);
41            case "hh": return ((h = d.getHours() % 12) ? h : 12).zf(2);
42            case "mm": return d.getMinutes().zf(2);
43            case "ss": return d.getSeconds().zf(2);
44            case "a/p": return d.getHours() < 12 ? "오전" : "오후";
45            default: return $1;
46        }
47    });
48};
49
50String.prototype.string = function(len){var s = '', i = 0; while (i++ < len) { s += this; } return s;};
51String.prototype.zf = function(len){return "0".string(len - this.length) + this;};
52Number.prototype.zf = function(len){return this.toString().zf(len);};
53//------------------------------------------------------------------------------------------------------------------------------------  기본 util :: 종료
54
55//------------------------------------------------------------------------------------------------------------------------------------  팝업 띄우기
56//팝업 띄우기 :: 공통
57function popupOpen( option, form ) {
58	var name = option.name;
59	var url = "";
60	if ( option.url != null && option.url != "" ) {
61		url = option.url;
62		if ( !isNullOrBlank(option.parameter) ) {
63			var keys = Object.keys(option.parameter);
64			for ( var index=0; index<keys.length; index++ ) {
65				var key = keys[index];
66				if ( index == 0 ) {
67					url += "?" + key + "=" + option.parameter[key];
68				} else {
69					url += "&" + key + "=" + option.parameter[key];
70				}
71			}
72		}
73	}
74	var option_str = "";
75	//default 셋팅
76	if ( isNullOrBlank(option.width) ) 			option.width = "400";
77	if ( isNullOrBlank(option.height) ) 		option.height = "400";
78	if ( isNullOrBlank(option.toolbar) ) 		option.toolbar = "no";
79	if ( isNullOrBlank(option.menubar) ) 		option.menubar = "no";
80	if ( isNullOrBlank(option.location) ) 		option.location = "no";
81	if ( isNullOrBlank(option.scrollbars) )		option.scrollbars = "no";
82	if ( isNullOrBlank(option.status) ) 		option.status = "no";
83	if ( isNullOrBlank(option.resizable) ) 		option.resizable = "no";
84	// 옵션 적용
85	if ( !isNullOrBlank(option.width) ) 		option_str += "width=" + option.width
86	if ( !isNullOrBlank(option.height) ) 		option_str += ", height=" + option.height
87	if ( !isNullOrBlank(option.toolbar) ) 		option_str += ", toolbar=" + option.toolbar
88	if ( !isNullOrBlank(option.menubar) ) 		option_str += ", menubar=" + option.menubar
89	if ( !isNullOrBlank(option.location) )		option_str += ", location=" + option.location
90	if ( !isNullOrBlank(option.scrollbars) ) 	option_str += ", scrollbars=" + option.scrollbars
91	if ( !isNullOrBlank(option.status) ) 		option_str += ", status=" + option.status
92	if ( !isNullOrBlank(option.resizable) ) 	option_str += ", resizable=" + option.resizable
93	if ( !isNullOrBlank(option.fullscreen) ) 	option_str += ", fullscreen=" + option.fullscreen
94	if ( !isNullOrBlank(option.channelmode) )	option_str += ", channelmode=" + option.channelmode
95	if ( !isNullOrBlank(option.left) ) 			option_str += ", left=" + option.left
96	if ( !isNullOrBlank(option.top) ) 			option_str += ", top=" + option.top
97	var win_pop = window.open( url, name, option_str );
98	if ( form != null && form !="" ) {
99		form.target = name;
100		form.submit();
101	}
102	return win_pop;
103}
104
105//팝업 띄우기 :: 공통
106function popupOpenDecoration(option, form){
107	var name = option.name;
108	var url = "";
109	if(option.url != null && option.url != "")url = option.url;
110	var option_str = "";
111
112	//default 셋팅
113	if(isNullOrBlank(option.width)) 					option.width = "400";
114	if(isNullOrBlank(option.height)) 					option.height = "400";
115	if(isNullOrBlank(option.toolbar)) 					option.toolbar = "no";
116	if(isNullOrBlank(option.menubar)) 					option.menubar = "no";
117	if(isNullOrBlank(option.location)) 					option.location = "no";
118	if(isNullOrBlank(option.scrollbars))				option.scrollbars = "no";
119	if(isNullOrBlank(option.status)) 					option.status = "no";
120	if(isNullOrBlank(option.resizable)) 				option.resizable = "no";
121
122	// 옵션 적용
123	if(!isNullOrBlank(option.width)) 					option_str += "width=" + option.width
124	if(!isNullOrBlank(option.height)) 					option_str += ", height=" + option.height
125	if(!isNullOrBlank(option.toolbar)) 					option_str += ", toolbar=" + option.toolbar
126	if(!isNullOrBlank(option.menubar)) 					option_str += ", menubar=" + option.menubar
127	if(!isNullOrBlank(option.location))					option_str += ", location=" + option.location
128	if(!isNullOrBlank(option.scrollbars)) 				option_str += ", scrollbars=" + option.scrollbars
129	if(!isNullOrBlank(option.status)) 					option_str += ", status=" + option.status
130	if(!isNullOrBlank(option.resizable)) 				option_str += ", resizable=" + option.resizable
131	if(!isNullOrBlank(option.fullscreen)) 				option_str += ", fullscreen=" + option.fullscreen
132	if(!isNullOrBlank(option.channelmode))				option_str += ", channelmode=" + option.channelmode
133	if(!isNullOrBlank(option.left)) 					option_str += ", left=" + option.left
134	if(!isNullOrBlank(option.top)) 						option_str += ", top=" + option.top
135
136	var win_pop = window.open(url, name, option_str);
137
138	if(form != null && form !=""){
139		form.target = name;
140		form.submit();
141	}
142
143	return win_pop;
144}
145
146/*메뉴관리, 링크 탑입의 팝업 오픈*/
147function menuPopup(url, width, height){
148	var name = new Date();
149	var option ={
150			name : name,
151			url : url,
152			width : width,
153			height : height,
154			scrollbars : "yes",
155			resizable : "yes"
156		};
157	popupOpen(option, null);
158}
159
160/*팝업존, 윈도우 팝업 기능*/
161function open_popTop(sitecode, w, h, l, t, pop_seq){
162	var hh = parseInt(h,10) +50;
163	var option ={
164			name : "open_menu_search",
165			width : w,
166			height : hh,
167			left : l,
168			top : t,
169			scrollbars : "no",
170			resizable : "no"
171		};
172
173	var obj_frm = document.createElement("form");
174	obj_frm.setAttribute("method","post");
175	obj_frm.action = "/" + sitecode + "/CMS/PopupMgr/popup.do";
176	document.body.appendChild(obj_frm);
177
178	_createElement_formAdd(obj_frm, "hidden", "pop_seq", pop_seq);
179
180	popupOpen(option, obj_frm);
181
182}
183
184/*팝업존, 윈도우 팝업 기능*/
185function open_popMain(sitecode, w, h, l, t, pop_seq){
186	var hh = parseInt(h,10) +50;
187	var option ={
188			name : "open_menu_search",
189			width : w,
190			height : hh,
191			left : l,
192			top : t,
193			scrollbars : "no",
194			resizable : "no"
195		};
196
197	var obj_frm = document.createElement("form");
198	obj_frm.setAttribute("method","post");
199	obj_frm.action = "/" + sitecode + "/CMS/PopupMgr/popup.do";
200	document.body.appendChild(obj_frm);
201
202	_createElement_formAdd(obj_frm, "hidden", "pop_seq", pop_seq);
203
204	popupOpen(option, obj_frm);
205
206}
207//------------------------------------------------------------------------------------------------------------------------------------  팝업 띄우기
208
209//------------------------------------------------------------------------------------------------------------------------------------ 데이터 합하기
210function setDataSum(data1, data2, data3, data4, result, hip){
211	var v_data1 = $("#" + data1).val();
212	var v_data2 = $("#" + data2).val();
213	var v_data3 = $("#" + data3).val();
214	var v_data4 = $("#" + data4).val();
215
216	var result_value = "";
217
218	if(hip == "-" && (v_data1 != null && v_data1 != "")&& (v_data2 != null && v_data2 != "")&& (v_data3 != null && v_data3 != "")){
219		result_value = v_data1+ hip + v_data2 + hip + v_data3 ;
220		$("#"+result).val(result_value);
221	}else if(hip == "@" && (v_data1 != null && v_data1 != "")&& (v_data2 != null && v_data2 != "")){
222		result_value = v_data1+ hip + v_data2;
223		$("#"+result).val(result_value);
224	}else if(hip == " " && (v_data1 != null && v_data1 != "")&& (v_data2 != null && v_data2 != "")){
225		result_value = v_data1+ hip + v_data2;
226		$("#"+result).val(result_value);
227	}else if(hip == ":" && (v_data1 != null && v_data1 != "")&& (v_data2 != null && v_data2 != "")){
228		result_value = v_data1+ hip + v_data2;
229		$("#"+result).val(result_value);
230	}
231	else	$("#"+result).val("");
232}
233//------------------------------------------------------------------------------------------------------------------------------------ 데이터 합하기
234
235//------------------------------------------------------------------------------------------------------------------------------------ 방문자 통계
236function onVisit(site_code){
237	var gScreenWidth        = screen.width;
238    var gScreenHeight       = screen.height;
239    var gScreenAvailWidth   = screen.availWidth;
240    var gScreenAvailHeight  = screen.availHeight;
241    var gScreenColor        = screen.colorDepth
242    var gScreenDepth        = screen.pixelDepth
243    var gNavigate           = $("#_Navigate").val();
244    var gBrowser            = BrowserDetect.browser
245    var gBrowserVersion     = BrowserDetect.version
246    var gBrowserOS          = BrowserDetect.OS
247
248    try {
249      var gAppCodeName        = navigator.appCodeName
250      var gAppMinorVersion    = navigator.appMinorVersion
251      var gAppName            = navigator.appName
252      var gAppVersion         = navigator.appVersion
253      var gCookieEnabled      = navigator.cookieEnabled
254      var gCpuClass           = navigator.cpuClass
255      var gPlatform           = navigator.platform
256      var gSystemLanguage     = navigator.systemLanguage
257      var gUserAgent          = navigator.userAgent
258      var gUserAgentOS        = navigator.userAgentOS
259      var gUserLanguage       = navigator.userLanguage
260    } catch (e) {   }
261    if(!gLanguageID) var gLanguageID = ""
262    if(location.href.toUpperCase().indexOf("/_") > 0) return false;
263    if(location.href.toUpperCase().indexOf("/%5F") > 0) return false;
264
265    $.ajax({
266        type:"post",
267        url:"/"+site_code+"/ajx_json/Visit/inputVisit.json",
268        cache: false,
269        data: {
270        	navigate:gNavigate,
271      	    screen_width:gScreenWidth,
272      	    screen_height:gScreenHeight,
273      	    screen_color:gScreenColor,
274      	    browser:gBrowser,
275      	    browser_version:gBrowserVersion,
276      	    browser_os:gBrowserOS,
277      	    system_language:gSystemLanguage,
278      	    user_language:gUserLanguage,
279    		agent:gUserAgent,
280    		cpu:gCpuClass,
281    		platform:gPlatform,
282    		app_version:gAppVersion,
283      	    url:location.href.replace("http://", "").replace(window.location.hostname, "").split("?")[0].toUpperCase(),
284      	    postdata:location.href.replace("http://", "").replace(window.location.hostname, "").split("?")[1],
285      	    pre_url:document.referrer
286        },
287        dataType:"json", // TEXT 형의 JSON으로 받음
288        success : function(data) {
289            if(data.result.result == "OK"){
290                // 처리 완료되면 이쪽으로 옴
291            }else{
292                // 실패하면 이쪽으로 옴
293            }
294        },
295        complete : function(data) {},        // 통신이 실패했어도 완료가 되었을 때 이 함수를 타게 된다.
296        error : function(xhr, status, error) {
297            alert("에러발생:" + error + status + xhr);
298        }
299    });
300}
301//------------------------------------------------------------------------------------------------------------------------------------ 방문자 통계
302
303
304function twitter(url,msg) {
305	var href = "http://twitter.com/home?status=" + encodeURIComponent(msg) + " " + encodeURIComponent(url);
306	var a = window.open(href, 'twitter', 'top=100px,left=100px,height=400px,width=500px');
307	if(a){
308		a.focus();
309	}
310	return false;
311}
312
313function facebook(url,msg) {
314	var href = "http://www.facebook.com/sharer.php?u=" + encodeURIComponent(url)+ "&t=" + encodeURIComponent(msg);
315	var a = window.open(href,'facebook','top=100px,left=100px,height=400px,width=500px');
316	if(a){
317		a.focus();
318	}
319	return false;
320}
321
322$(function(){
323	$('.board-view-contents').each(function(){
324		var $this = $(this);
325		var t = $this.html();
326	});
327	$('.faq-contents').each(function(){
328		var $this = $(this);
329		var t = $this.html();
330	});
331	$('.contents_view_wrap').each(function(){
332		var $this = $(this);
333		var t = $this.html();
334	});
335	$('.privacy-cont').each(function(){
336		var $this = $(this);
337		var t = $this.html();
338		$this.html(t.replace(/&lt;/gi, "<").replace(/&gt;/gi, ">"));
339	});
340});

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.