PageSourceSearch

https://data.kfri.re.kr/kfmb/js/common.js?ver=1790923441

js kfri.re.kr collected 2026-10-02 06:44:23 UTC 21,872 bytes, 755 lines download raw bytes

1// 전역 변수
2var errmsg = "";
3var errfld = null;
4
5// 필드 검사
6function check_field(fld, msg)
7{
8    if ((fld.value = trim(fld.value)) == "")
9        error_field(fld, msg);
10    else
11        clear_field(fld);
12    return;
13}
14
15// 필드 오류 표시
16function error_field(fld, msg)
17{
18    if (msg != "")
19        errmsg += msg + "\n";
20    if (!errfld) errfld = fld;
21    fld.style.background = "#BDDEF7";
22}
23
24// 필드를 깨끗하게
25function clear_field(fld)
26{
27    //fld.style.background = "#FFFFFF";
28}
29
30function trim(s)
31{
32    var t = "";
33    var from_pos = to_pos = 0;
34
35    for (i=0; i<s.length; i++)
36    {
37        if (s.charAt(i) == ' ')
38            continue;
39        else
40        {
41            from_pos = i;
42            break;
43        }
44    }
45
46    for (i=s.length; i>=0; i--)
47    {
48        if (s.charAt(i-1) == ' ')
49            continue;
50        else
51        {
52            to_pos = i;
53            break;
54        }
55    }
56
57    t = s.substring(from_pos, to_pos);
58    //				alert(from_pos + ',' + to_pos + ',' + t+'.');
59    return t;
60}
61
62// 자바스크립트로 PHP의 number_format 흉내를 냄
63// 숫자에 , 를 출력
64function number_format(data)
65{
66
67    var tmp = '';
68    var number = '';
69    var cutlen = 3;
70    var comma = ',';
71    var i;
72    
73    data = data + '';
74
75    var sign = data.match(/^[\+\-]/);
76    if(sign) {
77        data = data.replace(/^[\+\-]/, "");
78    }
79
80    len = data.length;
81    mod = (len % cutlen);
82    k = cutlen - mod;
83    for (i=0; i<data.length; i++)
84    {
85        number = number + data.charAt(i);
86
87        if (i < data.length - 1)
88        {
89            k++;
90            if ((k % cutlen) == 0)
91            {
92                number = number + comma;
93                k = 0;
94            }
95        }
96    }
97
98    if(sign != null)
99        number = sign+number;
100
101    return number;
102}
103
104// 새 창
105function popup_window(url, winname, opt)
106{
107    window.open(url, winname, opt);
108}
109
110
111// 폼메일 창
112function popup_formmail(url)
113{
114    opt = 'scrollbars=yes,width=417,height=385,top=10,left=20';
115    popup_window(url, "wformmail", opt);
116}
117
118// , 를 없앤다.
119function no_comma(data)
120{
121    var tmp = '';
122    var comma = ',';
123    var i;
124
125    for (i=0; i<data.length; i++)
126    {
127        if (data.charAt(i) != comma)
128            tmp += data.charAt(i);
129    }
130    return tmp;
131}
132
133// 삭제 검사 확인
134function del(href)
135{
136    if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?")) {
137        document.location.href = href;
138    }
139}
140
141// 쿠키 입력
142function set_cookie(name, value, expirehours, domain)
143{
144    var today = new Date();
145    today.setTime(today.getTime() + (60*60*1000*expirehours));
146    document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";";
147    if (domain) {
148        document.cookie += "domain=" + domain + ";";
149    }
150}
151
152// 쿠키 얻음
153function get_cookie(name)
154{
155	var match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
156	if (match) return unescape(match[2]);
157	return "";
158}
159
160// 쿠키 지움
161function delete_cookie(name)
162{
163    var today = new Date();
164
165    today.setTime(today.getTime() - 1);
166    var value = get_cookie(name);
167    if(value != "")
168        document.cookie = name + "=" + value + "; path=/; expires=" + today.toGMTString();
169}
170
171var last_id = null;
172function menu(id)
173{
174    if (id != last_id)
175    {
176        if (last_id != null)
177            document.getElementById(last_id).style.display = "none";
178        document.getElementById(id).style.display = "block";
179        last_id = id;
180    }
181    else
182    {
183        document.getElementById(id).style.display = "none";
184        last_id = null;
185    }
186}
187
188function textarea_decrease(id, row)
189{
190    if (document.getElementById(id).rows - row > 0)
191        document.getElementById(id).rows -= row;
192}
193
194function textarea_original(id, row)
195{
196    document.getElementById(id).rows = row;
197}
198
199function textarea_increase(id, row)
200{
201    document.getElementById(id).rows += row;
202}
203
204// 글숫자 검사
205function check_byte(content, target)
206{
207    var i = 0;
208    var cnt = 0;
209    var ch = '';
210    var cont = document.getElementById(content).value;
211
212    for (i=0; i<cont.length; i++) {
213        ch = cont.charAt(i);
214        if (escape(ch).length > 4) {
215            cnt += 2;
216        } else {
217            cnt += 1;
218        }
219    }
220    // 숫자를 출력
221    document.getElementById(target).innerHTML = cnt;
222
223    return cnt;
224}
225
226// 브라우저에서 오브젝트의 왼쪽 좌표
227function get_left_pos(obj)
228{
229    var parentObj = null;
230    var clientObj = obj;
231    //var left = obj.offsetLeft + document.body.clientLeft;
232    var left = obj.offsetLeft;
233
234    while((parentObj=clientObj.offsetParent) != null)
235    {
236        left = left + parentObj.offsetLeft;
237        clientObj = parentObj;
238    }
239
240    return left;
241}
242
243// 브라우저에서 오브젝트의 상단 좌표
244function get_top_pos(obj)
245{
246    var parentObj = null;
247    var clientObj = obj;
248    //var top = obj.offsetTop + document.body.clientTop;
249    var top = obj.offsetTop;
250
251    while((parentObj=clientObj.offsetParent) != null)
252    {
253        top = top + parentObj.offsetTop;
254        clientObj = parentObj;
255    }
256
257    return top;
258}
259
260function flash_movie(src, ids, width, height, wmode)
261{
262    var wh = "";
263    if (parseInt(width) && parseInt(height))
264        wh = " width='"+width+"' height='"+height+"' ";
265    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>";
266}
267
268function obj_movie(src, ids, width, height, autostart)
269{
270    var wh = "";
271    if (parseInt(width) && parseInt(height))
272        wh = " width='"+width+"' height='"+height+"' ";
273    if (!autostart) autostart = false;
274    return "<embed src='"+src+"' "+wh+" autostart='"+autostart+"'></embed>";
275}
276
277function doc_write(cont)
278{
279    document.write(cont);
280}
281
282var win_password_lost = function(href) {
283    window.open(href, "win_password_lost", "left=50, top=50, width=617, height=330, scrollbars=1");
284}
285
286$(document).ready(function(){
287    $("#login_password_lost, #ol_password_lost").click(function(){
288        win_password_lost(this.href);
289        return false;
290    });
291});
292
293/**
294 * 포인트 창
295 **/
296var win_point = function(href) {
297    var new_win = window.open(href, 'win_point', 'left=100,top=100,width=600, height=600, scrollbars=1');
298    new_win.focus();
299}
300
301/**
302 * 쪽지 창
303 **/
304var win_memo = function(href) {
305    var new_win = window.open(href, 'win_memo', 'left=100,top=100,width=620,height=500,scrollbars=1');
306    new_win.focus();
307}
308
309/**
310 * 쪽지 창
311 **/
312var check_goto_new = function(href, event) {
313    if( !(typeof g5_is_mobile != "undefined" && g5_is_mobile) ){
314        if (window.opener && window.opener.document && window.opener.document.getElementById) {
315            event.preventDefault ? event.preventDefault() : (event.returnValue = false);
316            window.open(href);
317            //window.opener.document.location.href = href;
318        }
319    }
320}
321
322/**
323 * 메일 창
324 **/
325var win_email = function(href) {
326    var new_win = window.open(href, 'win_email', 'left=100,top=100,width=600,height=580,scrollbars=1');
327    new_win.focus();
328}
329
330/**
331 * 자기소개 창
332 **/
333var win_profile = function(href) {
334    var new_win = window.open(href, 'win_profile', 'left=100,top=100,width=620,height=510,scrollbars=1');
335    new_win.focus();
336}
337
338/**
339 * 스크랩 창
340 **/
341var win_scrap = function(href) {
342    var new_win = window.open(href, 'win_scrap', 'left=100,top=100,width=600,height=600,scrollbars=1');
343    new_win.focus();
344}
345
346/**
347 * 홈페이지 창
348 **/
349var win_homepage = function(href) {
350    var new_win = window.open(href, 'win_homepage', '');
351    new_win.focus();
352}
353
354/**
355 * 우편번호 창
356 **/
357var win_zip = function(frm_name, frm_zip, frm_addr1, frm_addr2, frm_addr3, frm_jibeon) {
358    if(typeof daum === "undefined"){
359        alert("KAKAO 우편번호 서비스 postcode.v2.js 파일이 로드되지 않았습니다.");
360        return false;
361    }
362
363    // 핀치 줌 현상 제거
364    var vContent = "width=device-width,initial-scale=1.0,minimum-scale=0,maximum-scale=10";
365    $("#meta_viewport").attr("content", vContent + ",user-scalable=no");
366
367    var zip_case = 1;   //0이면 레이어, 1이면 페이지에 끼워 넣기, 2이면 새창
368
369    var complete_fn = function(data){
370        // 팝업에서 검색결과 항목을 클릭했을때 실행할 코드를 작성하는 부분.
371
372        // 각 주소의 노출 규칙에 따라 주소를 조합한다.
373        // 내려오는 변수가 값이 없는 경우엔 공백('')값을 가지므로, 이를 참고하여 분기 한다.
374        var fullAddr = ''; // 최종 주소 변수
375        var extraAddr = ''; // 조합형 주소 변수
376
377        // 사용자가 선택한 주소 타입에 따라 해당 주소 값을 가져온다.
378        if (data.userSelectedType === 'R') { // 사용자가 도로명 주소를 선택했을 경우
379            fullAddr = data.roadAddress;
380
381        } else { // 사용자가 지번 주소를 선택했을 경우(J)
382            fullAddr = data.jibunAddress;
383        }
384
385        // 사용자가 선택한 주소가 도로명 타입일때 조합한다.
386        if(data.userSelectedType === 'R'){
387            //법정동명이 있을 경우 추가한다.
388            if(data.bname !== ''){
389                extraAddr += data.bname;
390            }
391            // 건물명이 있을 경우 추가한다.
392            if(data.buildingName !== ''){
393                extraAddr += (extraAddr !== '' ? ', ' + data.buildingName : data.buildingName);
394            }
395            // 조합형주소의 유무에 따라 양쪽에 괄호를 추가하여 최종 주소를 만든다.
396            extraAddr = (extraAddr !== '' ? ' ('+ extraAddr +')' : '');
397        }
398
399        // 우편번호와 주소 정보를 해당 필드에 넣고, 커서를 상세주소 필드로 이동한다.
400        var of = document[frm_name];
401
402        of[frm_zip].value = data.zonecode;
403
404        of[frm_addr1].value = fullAddr;
405        of[frm_addr3].value = extraAddr;
406
407        if(of[frm_jibeon] !== undefined){
408            of[frm_jibeon].value = data.userSelectedType;
409        }
410        
411        setTimeout(function(){
412            $("#meta_viewport").attr("content", vContent);
413            of[frm_addr2].focus();
414        } , 100);
415    };
416
417    switch(zip_case) {
418        case 1 :    //iframe을 이용하여 페이지에 끼워 넣기
419            var daum_pape_id = 'daum_juso_page'+frm_zip,
420                element_wrap = document.getElementById(daum_pape_id),
421                currentScroll = Math.max(document.body.scrollTop, document.documentElement.scrollTop);
422            if (element_wrap == null) {
423                element_wrap = document.createElement("div");
424                element_wrap.setAttribute("id", daum_pape_id);
425                element_wrap.style.cssText = 'display:none;border:1px solid;left:0;width:100%;height:300px;margin:5px 0;position:relative;-webkit-overflow-scrolling:touch;';
426                element_wrap.innerHTML = '<img src="//t1.daumcdn.net/postcode/resource/images/close.png" id="btnFoldWrap" style="cursor:pointer;position:absolute;right:0px;top:-21px;z-index:1" class="close_daum_juso" alt="접기 버튼">';
427                jQuery('form[name="'+frm_name+'"]').find('input[name="'+frm_addr1+'"]').before(element_wrap);
428                jQuery("#"+daum_pape_id).off("click", ".close_daum_juso").on("click", ".close_daum_juso", function(e){
429                    e.preventDefault();
430                    $("#meta_viewport").attr("content", vContent);
431                    jQuery(this).parent().hide();
432                });
433            }
434
435            new daum.Postcode({
436                oncomplete: function(data) {
437                    complete_fn(data);
438                    // iframe을 넣은 element를 안보이게 한다.
439                    element_wrap.style.display = 'none';
440                    // 우편번호 찾기 화면이 보이기 이전으로 scroll 위치를 되돌린다.
441                    document.body.scrollTop = currentScroll;
442                },
443                // 우편번호 찾기 화면 크기가 조정되었을때 실행할 코드를 작성하는 부분.
444                // iframe을 넣은 element의 높이값을 조정한다.
445                onresize : function(size) {
446                    element_wrap.style.height = size.height + "px";
447                },
448                maxSuggestItems : g5_is_mobile ? 6 : 10,
449                width : '100%',
450                height : '100%'
451            }).embed(element_wrap);
452
453            // iframe을 넣은 element를 보이게 한다.
454            element_wrap.style.display = 'block';
455            break;
456        case 2 :    //새창으로 띄우기
457            new daum.Postcode({
458                oncomplete: function(data) {
459                    complete_fn(data);
460                }
461            }).open();
462            break;
463        default :   //iframe을 이용하여 레이어 띄우기
464            var rayer_id = 'daum_juso_rayer'+frm_zip,
465                element_layer = document.getElementById(rayer_id);
466            if (element_layer == null) {
467                element_layer = document.createElement("div");
468                element_layer.setAttribute("id", rayer_id);
469                element_layer.style.cssText = 'display:none;border:5px solid;position:fixed;width:300px;height:460px;left:50%;margin-left:-155px;top:50%;margin-top:-235px;overflow:hidden;-webkit-overflow-scrolling:touch;z-index:10000';
470                element_layer.innerHTML = '<img src="//i1.daumcdn.net/localimg/localimages/07/postcode/320/close.png" id="bt
470nCloseLayer" style="cursor:pointer;position:absolute;right:-3px;top:-3px;z-index:1" class="close_daum_juso" alt="닫기 버튼">';
471                document.body.appendChild(element_layer);
472                jQuery("#"+rayer_id).off("click", ".close_daum_juso").on("click", ".close_daum_juso", function(e){
473                    e.preventDefault();
474                    $("#meta_viewport").attr("content", vContent);
475                    jQuery(this).parent().hide();
476                });
477            }
478
479            new daum.Postcode({
480                oncomplete: function(data) {
481                    complete_fn(data);
482                    // iframe을 넣은 element를 안보이게 한다.
483                    element_layer.style.display = 'none';
484                },
485                maxSuggestItems : g5_is_mobile ? 6 : 10,
486                width : '100%',
487                height : '100%'
488            }).embed(element_layer);
489
490            // iframe을 넣은 element를 보이게 한다.
491            element_layer.style.display = 'block';
492    }
493}
494
495/**
496 * 새로운 비밀번호 분실 창 : 101123
497 **/
498win_password_lost = function(href)
499{
500    var new_win = window.open(href, 'win_password_lost', 'width=617, height=330, scrollbars=1');
501    new_win.focus();
502}
503
504/**
505 * 설문조사 결과
506 **/
507var win_poll = function(href) {
508    var new_win = window.open(href, 'win_poll', 'width=616, height=500, scrollbars=1');
509    new_win.focus();
510}
511
512/**
513 * 쿠폰
514 **/
515var win_coupon = function(href) {
516    var new_win = window.open(href, "win_coupon", "left=100,top=100,width=700, height=600, scrollbars=1");
517    new_win.focus();
518}
519
520
521/**
522 * 스크린리더 미사용자를 위한 스크립트 - 지운아빠 2013-04-22
523 * alt 값만 갖는 그래픽 링크에 마우스오버 시 title 값 부여, 마우스아웃 시 title 값 제거
524 **/
525$(function() {
526    $('a img').mouseover(function() {
527        $a_img_title = $(this).attr('alt');
528        $(this).attr('title', $a_img_title);
529    }).mouseout(function() {
530        $(this).attr('title', '');
531    });
532});
533
534/**
535 * 텍스트 리사이즈
536**/
537function font_resize(id, rmv_class, add_class, othis)
538{
539    var $el = $("#"+id);
540
541	if((typeof rmv_class !== "undefined" && rmv_class) || (typeof add_class !== "undefined" && add_class)){
542		$el.removeClass(rmv_class).addClass(add_class);
543
544		set_cookie("ck_font_resize_rmv_class", rmv_class, 1, g5_cookie_domain);
545		set_cookie("ck_font_resize_add_class", add_class, 1, g5_cookie_domain);
546	}
547
548    if(typeof othis !== "undefined"){
549        $(othis).addClass('select').siblings().removeClass('select');
550    }
551}
552
553/**
554 * 댓글 수정 토큰
555**/
556function set_comment_token(f)
557{
558    if(typeof f.token === "undefined")
559        $(f).prepend('<input type="hidden" name="token" value="">');
560
561    $.ajax({
562        url: g5_bbs_url+"/ajax.comment_token.php",
563        type: "GET",
564        dataType: "json",
565        async: false,
566        cache: false,
567        success: function(data, textStatus) {
568            f.token.value = data.token;
569        }
570    });
571}
572
573$(function(){
574    $(".win_point").click(function() {
575        win_point(this.href);
576        return false;
577    });
578
579    $(".win_memo").click(function() {
580        win_memo(this.href);
581        return false;
582    });
583
584    $(".win_email").click(function() {
585        win_email(this.href);
586        return false;
587    });
588
589    $(".win_scrap").click(function() {
590        win_scrap(this.href);
591        return false;
592    });
593
594    $(".win_profile").click(function() {
595        win_profile(this.href);
596        return false;
597    });
598
599    $(".win_homepage").click(function() {
600        win_homepage(this.href);
601        return false;
602    });
603
604    $(".win_password_lost").click(function() {
605        win_password_lost(this.href);
606        return false;
607    });
608
609    /*
610    $(".win_poll").click(function() {
611        win_poll(this.href);
612        return false;
613    });
614    */
615
616    $(".win_coupon").click(function() {
617        win_coupon(this.href);
618        return false;
619    });
620
621    // 사이드뷰
622    var sv_hide = false;
623    $(".sv_member, .sv_guest").click(function() {
624        $(".sv").removeClass("sv_on");
625        $(this).closest(".sv_wrap").find(".sv").addClass("sv_on");
626    });
627
628    $(".sv, .sv_wrap").hover(
629        function() {
630            sv_hide = false;
631        },
632        function() {
633            sv_hide = true;
634        }
635    );
636
637    $(".sv_member, .sv_guest").focusin(function() {
638        sv_hide = false;
639        $(".sv").removeClass("sv_on");
640        $(this).closest(".sv_wrap").find(".sv").addClass("sv_on");
641    });
642
643    $(".sv a").focusin(function() {
644        sv_hide = false;
645    });
646
647    $(".sv a").focusout(function() {
648        sv_hide = true;
649    });
650
651    // 셀렉트 ul
652    var sel_hide = false;
653    $('.sel_btn').click(function() {
654        $('.sel_ul').removeClass('sel_on');
655        $(this).siblings('.sel_ul').addClass('sel_on');
656    });
657
658    $(".sel_wrap").hover(
659        function() {
660            sel_hide = false;
661        },
662        function() {
663            sel_hide = true;
664        }
665    );
666
667    $('.sel_a').focusin(function() {
668        sel_hide = false;
669    });
670
671    $('.sel_a').focusout(function() {
672        sel_hide = true;
673    });
674
675    $(document).click(function() {
676        if(sv_hide) { // 사이드뷰 해제
677            $(".sv").removeClass("sv_on");
678        }
679        if (sel_hide) { // 셀렉트 ul 해제
680            $('.sel_ul').removeClass('sel_on');
681        }
682    });
683
684    $(document).focusin(function() {
685        if(sv_hide) { // 사이드뷰 해제
686            $(".sv").removeClass("sv_on");
687        }
688        if (sel_hide) { // 셀렉트 ul 해제
689            $('.sel_ul').removeClass('sel_on');
690        }
691    });
692
693    $(document).on( "keyup change", "textarea#wr_content[maxlength]", function(){
694        var str = $(this).val();
695        var mx = parseInt($(this).attr("maxlength"));
696        if (str.length > mx) {
697            $(this).val(str.substr(0, mx));
698            return false;
699        }
700    });
701});
702
703function get_write_token(bo_table)
704{
705    var token = "";
706
707    $.ajax({
708        type: "POST",
709        url: g5_bbs_url+"/write_token.php",
710        data: { bo_table: bo_table },
711        cache: false,
712        async: false,
713        dataType: "json",
714        success: function(data) {
715            if(data.error) {
716                alert(data.error);
717                if(data.url)
718                    document.location.href = data.url;
719
720                return false;
721            }
722
723            token = data.token;
724        }
725    });
726
727    return token;
728}
729
730$(function() {
731    $(document).on("click", "form[name=fwrite] input:submit, form[name=fwrite] button:submit, form[name=fwrite] input:image", function() {
732        var f = this.form;
733
734        if (typeof(f.bo_table) == "undefined") {
735            return;
736        }
737
738        var bo_table = f.bo_table.value;
739        var token = get_write_token(bo_table);
740
741        if(!token) {
742            alert("토큰 정보가 올바르지 않습니다.");
743            return false;
744        }
745
746        var $f = $(f);
747
748        if(typeof f.token === "undefined")
749            $f.prepend('<input type="hidden" name="token" value="">');
750
751        $f.find("input[name=token]").val(token);
752
753        return true;
754    });
755});

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.