PageSourceSearch

https://catholicpress.kr/js/common.js

js catholicpress.kr collected 2026-10-05 11:39:02 UTC 18,749 bytes, 574 lines download raw bytes

1if (typeof(COMMON_JS) == 'undefined') { // 한번만 실행
2    var COMMON_JS = true;
3
4    // 전역 변수
5    var errmsg = "";
6    var errfld;
7
8    // 필드 검사
9    function check_field(fld, msg) 
10    {
11        if ((fld.value = trim(fld.value)) == "") 			   
12            error_field(fld, msg);
13        else
14            clear_field(fld);
15        return;
16    }
17
18    // 필드 오류 표시
19    function error_field(fld, msg) 
20    {
21        if (msg != "")
22            errmsg += msg + "\n";
23        if (!errfld) errfld = fld;
24        fld.style.background = "#BDDEF7";
25    }
26
27    // 필드를 깨끗하게
28    function clear_field(fld) 
29    {
30        fld.style.background = "#FFFFFF";
31    }
32
33    function trim(s)
34    {
35        var t = "";
36        var from_pos = to_pos = 0;
37
38        for (i=0; i<s.length; i++)
39        {
40            if (s.charAt(i) == ' ')
41                continue;
42            else 
43            {
44                from_pos = i;
45                break;
46            }
47        }
48
49        for (i=s.length; i>=0; i--)
50        {
51            if (s.charAt(i-1) == ' ')
52                continue;
53            else 
54            {
55                to_pos = i;
56                break;
57            }
58        }	
59
60        t = s.substring(from_pos, to_pos);
61        //				alert(from_pos + ',' + to_pos + ',' + t+'.');
62        return t;
63    }
64
65    // 자바스크립트로 PHP의 number_format 흉내를 냄
66    // 숫자에 , 를 출력
67    function number_format(data) 
68    {
69        
70        var tmp = '';
71        var number = '';
72        var cutlen = 3;
73        var comma = ',';
74        var i;
75       
76        len = data.length;
77        mod = (len % cutlen);
78        k = cutlen - mod;
79        for (i=0; i<data.length; i++) 
80        {
81            number = number + data.charAt(i);
82            
83            if (i < data.length - 1) 
84            {
85                k++;
86                if ((k % cutlen) == 0) 
87                {
88                    number = number + comma;
89                    k = 0;
90                }
91            }
92        }
93
94        return number;
95    }
96
97    // 새 창
98    function popup_window(url, winname, opt)
99    {
100        window.open(url, winname, opt);
101    }
102
103    // 새 창
104    function popup_cache(url)
105    {
106        opt = 'scrollbars=yes,resizable=yes,width=990,top=20,left=20';
107        popup_window(url, "미리보기", opt);
108    }
109
110    // 폼메일 창
111    function popup_formmail(url)
112    {
113        opt = 'scrollbars=yes,width=417,height=385,top=10,left=20';
114        popup_window(url, "wformmail", opt);
115    }
116
117    // , 를 없앤다.
118    function no_comma(data)
119    {
120        var tmp = '';
121        var comma = ',';
122        var i;
123
124        for (i=0; i<data.length; i++)
125        {
126            if (data.charAt(i) != comma)
127                tmp += data.charAt(i);
128        }
129        return tmp;
130    }
131
132    // 삭제 검사 확인
133    function del(href) 
134    {
135        if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?")) {
136            if (g4_charset.toUpperCase() == 'EUC-KR') 
137                document.location.href = href;
138            else
139                document.location.href = encodeURI(href);
140        }
141    }
142
143    // 쿠키 입력
144    function set_cookie(name, value, expirehours, domain) 
145    {
146        var today = new Date();
147        today.setTime(today.getTime() + (60*60*1000*expirehours));
148        document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";";
149        if (domain) {
150            document.cookie += "domain=" + domain + ";";
151        }
152    }
153
154    // 쿠키 얻음
155    function get_cookie(name) 
156    {
157        var find_sw = false;
158        var start, end;
159        var i = 0;
160
161        for (i=0; i<= document.cookie.length; i++)
162        {
163            start = i;
164            end = start + name.length;
165
166            if(document.cookie.substring(start, end) == name) 
167            {
168                find_sw = true
169                break
170            }
171        }
172
173        if (find_sw == true) 
174        {
175            start = end + 1;
176            end = document.cookie.indexOf(";", start);
177
178            if(end < start)
179                end = document.cookie.length;
180
181            return document.cookie.substring(start, end);
182        }
183        return "";
184    }
185
186    // 쿠키 지움
187    function delete_cookie(name) 
188    {
189        var today = new Date();
190
191        today.setTime(today.getTime() - 1);
192        var value = get_cookie(name);
193        if(value != "")
194            document.cookie = name + "=" + value + "; path=/; expires=" + today.toGMTString();
195    }
196
197    // 이미지의 크기에 따라 새창의 크기가 변경됩니다.
198    // zzzz님께서 알려주셨습니다. 2005/04/12
199    function image_window(img)
200    {
201        var w = img.tmp_width; 
202        var h = img.tmp_height; 
203        var winl = (screen.width-w)/2; 
204        var wint = (screen.height-h)/3; 
205
206        if (w >= screen.width) { 
207            winl = 0; 
208            h = (parseInt)(w * (h / w)); 
209        } 
210
211        if (h >= screen.height) { 
212            wint = 0; 
213            w = (parseInt)(h * (w / h)); 
214        } 
215
216        var js_url = "<script type='text/javascript'> \n"; 
217            js_url += "<!-- \n"; 
218            js_url += "var ie=document.all; \n"; 
219            js_url += "var nn6=document.getElementById&&!document.all; \n"; 
220            js_url += "var isdrag=false;
220 \n"; 
221            js_url += "var x,y; \n"; 
222            js_url += "var dobj; \n"; 
223            js_url += "function movemouse(e) \n"; 
224            js_url += "{ \n"; 
225            js_url += "  if (isdrag) \n"; 
226            js_url += "  { \n"; 
227            js_url += "    dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x; \n"; 
228            js_url += "    dobj.style.top  = nn6 ? ty + e.clientY - y : ty + event.clientY - y; \n"; 
229            js_url += "    return false; \n"; 
230            js_url += "  } \n"; 
231            js_url += "} \n"; 
232            js_url += "function selectmouse(e) \n"; 
233            js_url += "{ \n"; 
234            js_url += "  var fobj      = nn6 ? e.target : event.srcElement; \n"; 
235            js_url += "  var topelement = nn6 ? 'HTML' : 'BODY'; \n"; 
236            js_url += "  while (fobj.tagName != topelement && fobj.className != 'dragme') \n"; 
237            js_url += "  { \n"; 
238            js_url += "    fobj = nn6 ? fobj.parentNode : fobj.parentElement; \n"; 
239            js_url += "  } \n"; 
240            js_url += "  if (fobj.className=='dragme') \n"; 
241            js_url += "  { \n"; 
242            js_url += "    isdrag = true; \n"; 
243            js_url += "    dobj = fobj; \n"; 
244            js_url += "    tx = parseInt(dobj.style.left+0); \n"; 
245            js_url += "    ty = parseInt(dobj.style.top+0); \n"; 
246            js_url += "    x = nn6 ? e.clientX : event.clientX; \n"; 
247            js_url += "    y = nn6 ? e.clientY : event.clientY; \n"; 
248            js_url += "    document.onmousemove=movemouse; \n"; 
249            js_url += "    return false; \n"; 
250            js_url += "  } \n"; 
251            js_url += "} \n"; 
252            js_url += "document.onmousedown=selectmouse; \n"; 
253            js_url += "document.onmouseup=new Function('isdrag=false'); \n"; 
254            js_url += "//--> \n"; 
255            js_url += "</"+"script> \n"; 
256
257        var settings;
258
259        if (g4_is_gecko) {
260            settings  ='width='+(w+10)+','; 
261            settings +='height='+(h+10)+','; 
262        } else {
263            settings  ='width='+w+','; 
264            settings +='height='+h+','; 
265        }
266        settings +='top='+wint+','; 
267        settings +='left='+winl+','; 
268        settings +='scrollbars=no,'; 
269        settings +='resizable=yes,'; 
270        settings +='status=no'; 
271
272
273        win=window.open("","image_window",settings); 
274        win.document.open(); 
275        win.document.write ("<html><head> \n<meta http-equiv='imagetoolbar' CONTENT='no'> \n<meta http-equiv='content-type' content='text/html; charset="+g4_charset+"'>\n"); 
276        var size = "이미지 사이즈 : "+w+" x "+h;
277        win.document.write ("<title>"+size+"</title> \n"); 
278        if(w >= screen.width || h >= screen.height) { 
279            win.document.write (js_url); 
280            var click = "ondblclick='window.close();
280' style='cursor:move' title=' "+size+" \n\n 이미지 사이즈가 화면보다 큽니다. \n 왼쪽 버튼을 클릭한 후 마우스를 움직여서 보세요. \n\n 더블 클릭하면 닫혀요. '"; 
281        } 
282        else 
283            var click = "onclick='window.close();' style='cursor:pointer' title=' "+size+" \n\n 클릭하면 닫혀요. '"; 
284        win.document.write ("<style>.dragme{position:relative;}</style> \n"); 
285        win.document.write ("</head> \n\n"); 
286        win.document.write ("<body leftmargin=0 topmargin=0 bgcolor=#dddddd style='cursor:arrow;'> \n"); 
287        win.document.write ("<table width=100% height=100% cellpadding=0 cellspacing=0><tr><td align=center valign=middle><img src='"+img.src+"' width='"+w+"' height='"+h+"' border=0 class='dragme' "+click+"></td></tr></table>");
288        win.document.write ("</body></html>"); 
289        win.document.close(); 
290
291        if(parseInt(navigator.appVersion) >= 4){win.window.focus();} 
292    }
293
294    // a 태그에서 onclick 이벤트를 사용하지 않기 위해
295    function win_open(url, name, option)
296    {
297        var popup = window.open(url, name, option);
298        popup.focus();
299    }
300
301    // 도로명 우편번호 창
302    function win_zip(frm_name, frm_zip1, frm_zip2, frm_addr1, frm_addr2, frm_addr3, frm_jibeon)
303    {
304        url = g4_path + "/" + g4_bbs + "/zip.php?frm_name="+frm_name+"&frm_zip1="+frm_zip1+"&frm_zip2="+frm_zip2+"&frm_addr1="+frm_addr1+"&frm_addr2="+frm_addr2+"&frm_addr3="+frm_addr3+"&frm_jibeon="+frm_jibeon;
305        win_open(url, "winZip", "left=50,top=50,width=616,height=460,scrollbars=1");
306    }
307
308    /*
309    // 우편번호 창
310    function win_zip(frm_name, frm_zip1, frm_zip2, frm_addr1, frm_addr2)
311    {
312        url = g4_path + "/" + g4_bbs + "/zip.php?frm_name="+frm_name+"&frm_zip1="+frm_zip1+"&frm_zip2="+frm_zip2+"&frm_addr1="+frm_addr1+"&frm_addr2="+frm_addr2;
313        win_open(url, "winZip", "left=50,top=50,width=616,height=460,scrollbars=1");
314    }
315    */
316
317    // 쪽지 창
318    function win_memo(url)
319    {
320        if (!url)
321            url = g4_path + "/" + g4_bbs + "/memo.php";
322        win_open(url, "winMemo", "left=50,top=50,width=620,height=460,scrollbars=1");
323    }
324
325    // 포인트 창
326    function win_point(url)
327    {
328        win_open(g4_path + "/" + g4_bbs + "/point.php", "winPoint", "left=20, top=20, width=616, height=635, scrollbars=1");
329    }
330
331    // 스크랩 창
332    function win_scrap(url)
333    {
334        if (!url)
335            url = g4_path + "/" + g4_bbs + "/scrap.php";
336        win_open(url, "scrap", "left=20, top=20, width=616, height=500, scrollbars=1");
337    }
338
339    // 새로운 패스워드 분실 창 : 100902
340    function win_password_lost()
341    {
342        win_open(g4_path + "/" + g4_bbs + "/password_lost.php", 'winPasswordLost', 'left=50, top=50, width=617, height=330, scrollbars=1');
343    }
344
345    // 패스워드 분실 창
346    function win_password_forget()
347    {
348        win_open(g4_path + "/" + g4_bbs + "/password_forget.php", 'winPasswordForget', 'left=50, top=50, width=616, height=500, scrollbars=1');
349    }
350
351    // 코멘트 창
352    function win_comment(url)
353    {
354        win_open(url, "winComment", "left=50, top=50, width=800, height=600, scrollbars=1");
355    }
356
357    // 폼메일 창
358    function win_formmail(mb_id, name, email)
359    {
360		if (g4_charset.toLowerCase() == 'euc-kr')
361	        win_open(g4_path+"/" + g4_bbs + "/formmail.php?mb_id="+mb_id+"&name="+name+"&email="+email, "winFormmail", "left=50, top=50, width=600, height=500, scrollbars=0");
362		else
363	        win_open(g4_path+"/" + g4_bbs + "/formmail.php?mb_id="+mb_id+"&name="+encodeURIComponent(name)+"&email="+email, "winFormmail", "left=50, top=50, width=600, height=480, scrollbars=0");
364    }
365
366    // 달력 창
367    function win_calendar(fld, cur_date, delimiter, opt)
368    {
369        if (!opt)
370            opt = "left=50, top=50, width=240, height=230, scrollbars=0,status=0,resizable=0";
371        win_open(g4_path+"/" + g4_bbs + "/calendar.php?fld="+fld+"&cur_date="+cur_date+"&delimiter="+delimiter, "winCalendar", opt);
372    }
373
374    // 설문조사 창
375    function win_poll(url)
376    {
377        if (!url)
378            url = "";
379        win_open(url, "winPoll", "left=50, top=50, width=616, height=500, scrollbars=1");
380    }
381
382    // 자기소개 창
383    function win_profile(mb_id)
384    {
385        win_open(g4_path+"/" + g4_bbs + "/profile.php?mb_id="+mb_id, 'winProfile', 'left=50,top=50,width=620,height=510,scrollbars=1');
386    }
387
388    var last_id = null;
389    function menu(id)
390    {
391        if (id != last_id)
392        {
393            if (last_id != null)
394                document.getElementById(last_id).style.display = "none";
395            document.getElementById(id).style.display = "block";
396            last_id = id;
397        }
398        else
399        {
400            document.getElementById(id).style.display = "none";
401            last_id = null;
402        }
403    }
404
405    function textarea_decrease(id, row)
406    {
407        if (document.getElementById(id).rows - row > 0)
408            document.getElementById(id).rows -= row;
409    }
410
411    function textarea_original(id, row)
412    {
413        document.getElementById(id).rows = row;
414    }
415
416    function textarea_increase(id, row)
417    {
418        document.getElementById(id).rows += row;
419    }
420
421    // 글숫자 검사
422    function check_byte(content, target)
423    {
424        var i = 0;
425        var cnt = 0;
426        var ch = '';
427        var cont = document.getElementById(content).value;
428
429        for (i=0; i<cont.length; i++) {
430            ch = cont.charAt(i);
431            if (escape(ch).length > 4) {
432                cnt += 2;
433            } else {
434                cnt += 1;
435            }
436        }
437        // 숫자를 출력
438        document.getElementById(target).innerHTML = cnt;
439
440        return cnt;
441    }
442
443    // 브라우저에서 오브젝트의 왼쪽 좌표
444    function get_left_pos(obj)
445    {
446        var parentObj = null;
447        var clientObj = obj;
448        //var left = obj.offsetLeft + document.body.clientLeft;
449        var left = obj.offsetLeft;
450
451        while((parentObj=clientObj.offsetParent) != null)
452        {
453            left = left + parentObj.offsetLeft;
454            clientObj = parentObj;
455        }
456
457        return left;
458    }
459
460    // 브라우저에서 오브젝트의 상단 좌표
461    function get_top_pos(obj)
462    {
463        var parentObj = null;
464        var clientObj = obj;
465        //var top = obj.offsetTop + document.body.clientTop;
466        var top = obj.offsetTop;
467
468        while((parentObj=clientObj.offsetParent) != null)
469        {
470            top = top + parentObj.offsetTop;
471            clientObj = parentObj;
472        }
473
474        return top;
475    }
476
477    function flash_movie(src, ids, width, height, wmode)
478    {
479        var wh = "";
480        if (parseInt(width) && parseInt(height)) 
481            wh = " width='"+width+"' height='"+height+"' ";
482        return "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' "+wh+" id="+ids+"><param name=wmode value="+wmode+"><param name=movie value="+src+"><param name=quality value=high><embed src="+src+" quality=high wmode="+wmode+" type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash' "+wh+"></embed></object>";
483    }
484
485    function obj_movie(src, ids, width, height, autostart)
486    {
487        var wh = "";
488        if (parseInt(width) && parseInt(height)) 
489            wh = " width='"+width+"' height='"+height+"' ";
490        if (!autostart) autostart = false;
491        return "<embed src='"+src+"' "+wh+" autostart='"+autostart+"'></embed>";
492    }
493
494    function doc_write(cont)
495    {
496        document.write(cont);
497    }
498}
499
500function setCookie(cname, cvalue, exdays) {
501    var exdays = exdays || 0;
502    var d = new Date();
503    d.setTime(d.getTime() + (exdays*24*60*60*1000));
504    var expires = "expires="+ d.toUTCString();
505    document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
506}
507
508function getCookie(cname) {
509    var name = cname + "=";
510    var decodedCookie = decodeURIComponent(document.cookie);
511    var ca = decodedCookie.split(';');
512    for (var i = 0; i <ca.length; i++) {
513        var c = ca[i];
514        while (c.charAt(0) == ' ') {
515            c = c.substring(1);
516        }
517        if (c.indexOf(name) == 0) {
518            return c.substring(name.length, c.length);
519        }
520    }
521    return "";
522}
523
524function deleteCookie (cname) {
525    document.cookie = cname + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
526}
527
528// parse url
529function getLocation(href) {
530    var l = document.createElement("a");
531    l.href = href;
532    return l;
533};
534
535//로고가로크기
536(function($){
537    $(document).ready(function(){
538        /*
539        var topLogoWidth = $(".topLogo img").outerWidth();
540        $(".topLogo").css({
541            "width" : topLogoWidth + "px"
542        })
543
544        $(".topLogoWrap01 .srchInput").css({
545            "left" : topLogoWidth + 20 + "px"
546        })
547
548        $("#headline").css({"border-bottom" : "none"});
549        */
550    })
551})(jQuery);
552
553
554//SNS 공유
555function goFacebook(msg,url){
556	var href ='http://www.facebook.com/sharer.php?u=' + encodeURIComponent(url);
557	var open = window.open(href,'facebook','');
558}
559function goTwitter(msg,url){
560	var href ='http://twitter.com/intent/tweet?url=' + encodeURIComponent(url)+ '&text=' + encodeURIComponent(msg) ;
561	var open = window.open(href,'twitter','');
562}
563function goGoogleplus(msg,url){
564	var href ='https://plus.google.com/share?url=' + encodeURIComponent(url);
565	var open = window.open(href,'','');
566}
567function goCyworld(msg,url){
568	var href ='http://csp.cyworld.com/bi/bi_recommend_pop.php?url=' + encodeURIComponent(url);
569	var open = window.open(href,'','');
570}
571function goNaverBookmark(msg,url){
572	var href ='http://bookmark.naver.com/post?title=' + encodeURIComponent(msg) + '&url=' + encodeURIComponent(url);
573	var open = window.open(href,'','');
574}

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.