PageSourceSearch

http://kms21com.com/js/common.js?ver=171222

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

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.