PageSourceSearch

https://nkbada.com/js/common.js?ver=1791076402

js nkbada.com collected 2026-10-04 01:13:30 UTC 21,233 bytes, 769 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=0,top=0,width=600,height=730,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=0,top=0,width=600,height=780,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        setTimeout(function(){
445            of[frm_addr2].focus();
446        } , 100);
447    };
448
449    switch(zip_case) {
450        case 1 :    //iframe을 이용하여 페이지에 끼워 넣기
451            var daum_pape_id = 'daum_juso_page'+frm_zip,
452                element_wrap = document.getElementById(daum_pape_id),
453                currentScroll = Math.max(document.body.scrollTop, document.documentElement.scrollTop);
454            if (element_wrap == null) {
455                element_wrap = document.createElement("div");
456                element_wrap.setAttribute("id", daum_pape_id);
457                element_wrap.style.cssText = 'display:none;border:1px solid;left:0;width:100%;height:300px;margin:5px 0;position:relative;-webkit-overflow-scrolling:touch;';
458                element_wrap.innerHTML = '<img src="//i1.daumcdn.net/localimg/localimages/07/postcode/320/close.png" id="bt
458nFoldWrap" style="cursor:pointer;position:absolute;right:0px;top:-21px;z-index:1" class="close_daum_juso" alt="접기 버튼">';
459                jQuery('form[name="'+frm_name+'"]').find('input[name="'+frm_addr1+'"]').before(element_wrap);
460                jQuery("#"+daum_pape_id).off("click", ".close_daum_juso").on("click", ".close_daum_juso", function(e){
461                    e.preventDefault();
462                    jQuery(this).parent().hide();
463                });
464            }
465
466            new daum.Postcode({
467                oncomplete: function(data) {
468                    complete_fn(data);
469                    // iframe을 넣은 element를 안보이게 한다.
470                    element_wrap.style.display = 'none';
471                    // 우편번호 찾기 화면이 보이기 이전으로 scroll 위치를 되돌린다.
472                    document.body.scrollTop = currentScroll;
473                },
474                // 우편번호 찾기 화면 크기가 조정되었을때 실행할 코드를 작성하는 부분.
475                // iframe을 넣은 element의 높이값을 조정한다.
476                onresize : function(size) {
477                    element_wrap.style.height = size.height + "px";
478                },
479                maxSuggestItems : g5_is_mobile ? 6 : 10,
480                width : '100%',
481                height : '100%'
482            }).embed(element_wrap);
483
484            // iframe을 넣은 element를 보이게 한다.
485            element_wrap.style.display = 'block';
486            break;
487        case 2 :    //새창으로 띄우기
488            new daum.Postcode({
489                oncomplete: function(data) {
490                    complete_fn(data);
491                }
492            }).open();
493            break;
494        default :   //iframe을 이용하여 레이어 띄우기
495            var rayer_id = 'daum_juso_rayer'+frm_zip,
496                element_layer = document.getElementById(rayer_id);
497            if (element_layer == null) {
498                element_layer = document.createElement("div");
499                element_layer.setAttribute("id", rayer_id);
500                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';
501                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="닫기 버튼">';
502                document.body.appendChild(element_layer);
503                jQuery("#"+rayer_id).off("click", ".close_daum_juso").on("click", ".close_daum_juso", function(e){
504                    e.preventDefault();
505                    jQuery(this).parent().hide();
506                });
507            }
508
509            new daum.Postcode({
510                oncomplete: function(data) {
511                    complete_fn(data);
512                    // iframe을 넣은 element를 안보이게 한다.
513                    element_layer.style.display = 'none';
514                },
515                maxSuggestItems : g5_is_mobile ? 6 : 10,
516                width : '100%',
517                height : '100%'
518            }).embed(element_layer);
519
520            // iframe을 넣은 element를 보이게 한다.
521            element_layer.style.display = 'block';
522    }
523}
524
525/**
526 * 새로운 비밀번호 분실 창 : 101123
527 **/
528win_password_lost = function(href)
529{
530    var new_win = window.open(href, 'win_password_lost', 'left=0,top=0,width=600, height=420, scrollbars=1');
531    new_win.focus();
532}
533
534/**
535 * 설문조사 결과
536 **/
537var win_poll = function(href) {
538    var new_win = window.open(href, 'win_poll', 'width=616, height=500, scrollbars=1');
539    new_win.focus();
540}
541
542/**
543 * 스크린리더 미사용자를 위한 스크립트 - 지운아빠 2013-04-22
544 * alt 값만 갖는 그래픽 링크에 마우스오버 시 title 값 부여, 마우스아웃 시 title 값 제거
545 **/
546$(function() {
547    $('a img').mouseover(function() {
548        $a_img_title = $(this).attr('alt');
549        $(this).attr('title', $a_img_title);
550    }).mouseout(function() {
551        $(this).attr('title', '');
552    });
553});
554
555/**
556 * 텍스트 리사이즈
557**/
558function font_resize(id, rmv_class, add_class, othis)
559{
560    var $el = $("#"+id);
561
562    $el.removeClass(rmv_class).addClass(add_class);
563
564    set_cookie("ck_font_resize_rmv_class", rmv_class, 1, g5_cookie_domain);
565    set_cookie("ck_font_resize_add_class", add_class, 1, g5_cookie_domain);
566
567    if(typeof othis !== "undefined"){
568        $(othis).addClass('select').siblings().removeClass('select');
569    }
570}
571
572/**
573 * 댓글 수정 토큰
574**/
575function set_comment_token(f)
576{
577    if(typeof f.token === "undefined")
578        $(f).prepend('<input type="hidden" name="token" value="">');
579
580    $.ajax({
581        url: g5_bbs_url+"/ajax.comment_token.php",
582        type: "GET",
583        dataType: "json",
584        async: false,
585        cache: false,
586        success: function(data, textStatus) {
587            f.token.value = data.token;
588        }
589    });
590}
591
592$(function(){
593    $(".win_point").click(function() {
594        win_point(this.href);
595        return false;
596    });
597
598    $(".win_memo").click(function() {
599        win_memo(this.href);
600        return false;
601    });
602
603    $(".win_email").click(function() {
604        win_email(this.href);
605        return false;
606    });
607
608    $(".win_scrap").click(function() {
609        win_scrap(this.href);
610        return false;
611    });
612
613    $(".win_profile").click(function() {
614        win_profile(this.href);
615        return false;
616    });
617
618    $(".win_homepage").click(function() {
619        win_homepage(this.href);
620        return false;
621    });
622
623    $(".win_password_lost").click(function() {
624        win_password_lost(this.href);
625        return false;
626    });
627
628    /*
629    $(".win_poll").click(function() {
630        win_poll(this.href);
631        return false;
632    });
633    */
634
635    // 사이드뷰
636    var sv_hide = false;
637    $(".sv_member, .sv_guest").click(function() {
638        $(".sv").removeClass("sv_on");
639        $(this).closest(".sv_wrap").find(".sv").addClass("sv_on");
640    });
641
642    $(".sv, .sv_wrap").hover(
643        function() {
644            sv_hide = false;
645        },
646        function() {
647            sv_hide = true;
648        }
649    );
650
651    $(".sv_member, .sv_guest").focusin(function() {
652        sv_hide = false;
653        $(".sv").removeClass("sv_on");
654        $(this).closest(".sv_wrap").find(".sv").addClass("sv_on");
655    });
656
657    $(".sv a").focusin(function() {
658        sv_hide = false;
659    });
660
661    $(".sv a").focusout(function() {
662        sv_hide = true;
663    });
664
665    // 셀렉트 ul
666    var sel_hide = false;
667    $('.sel_btn').click(function() {
668        $('.sel_ul').removeClass('sel_on');
669        $(this).siblings('.sel_ul').addClass('sel_on');
670    });
671
672    $(".sel_wrap").hover(
673        function() {
674            sel_hide = false;
675        },
676        function() {
677            sel_hide = true;
678        }
679    );
680
681    $('.sel_a').focusin(function() {
682        sel_hide = false;
683    });
684
685    $('.sel_a').focusout(function() {
686        sel_hide = true;
687    });
688
689    $(document).click(function() {
690        if(sv_hide) { // 사이드뷰 해제
691            $(".sv").removeClass("sv_on");
692        }
693        if (sel_hide) { // 셀렉트 ul 해제
694            $('.sel_ul').removeClass('sel_on');
695        }
696    });
697
698    $(document).focusin(function() {
699        if(sv_hide) { // 사이드뷰 해제
700            $(".sv").removeClass("sv_on");
701        }
702        if (sel_hide) { // 셀렉트 ul 해제
703            $('.sel_ul').removeClass('sel_on');
704        }
705    });
706
707    $(document).on( "keyup change", "textarea#wr_content[maxlength]", function(){
708        var str = $(this).val();
709        var mx = parseInt($(this).attr("maxlength"));
710        if (str.length > mx) {
711            $(this).val(str.substr(0, mx));
712            return false;
713        }
714    });
715});
716
717function get_write_token(bo_table)
718{
719    var token = "";
720
721    $.ajax({
722        type: "POST",
723        url: g5_bbs_url+"/write_token.php",
724        data: { bo_table: bo_table },
725        cache: false,
726        async: false,
727        dataType: "json",
728        success: function(data) {
729            if(data.error) {
730                alert(data.error);
731                if(data.url)
732                    document.location.href = data.url;
733
734                return false;
735            }
736
737            token = data.token;
738        }
739    });
740
741    return token;
742}
743
744$(function() {
745    $(document).on("click", "form[name=fwrite] input:submit, form[name=fwrite] button:submit, form[name=fwrite] input:image", function() {
746       /* var f = this.form;
747
748        if (typeof(f.bo_table) == "undefined") {
749            return;
750        }
751
752        var bo_table = f.bo_table.value;
753        var token = get_write_token(bo_table);
754
755        if(!token) {
756            alert("토큰 정보가 올바르지 않습니다.");
757            return false;
758        }
759
760        var $f = $(f);
761
762        if(typeof f.token === "undefined")
763            $f.prepend('<input type="hidden" name="token" value="">');
764
765        $f.find("input[name=token]").val(token);*/
766
767        return true;
768    });
769});

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.