PageSourceSearch

https://guponoodle.co.kr/js/common.js

js guponoodle.co.kr collected 2026-10-06 13:17:03 UTC 20,619 bytes, 750 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 win_email = function(href) {
350    var new_win = window.open(href, 'win_email', 'left=100,top=100,width=600,height=580,scrollbars=0');
351    new_win.focus();
352}
353
354/**
355 * 자기소개 창
356 **/
357var win_profile = function(href) {
358    var new_win = window.open(href, 'win_profile', 'left=100,top=100,width=620,height=510,scrollbars=1');
359    new_win.focus();
360}
361
362/**
363 * 스크랩 창
364 **/
365var win_scrap = function(href) {
366    var new_win = window.open(href, 'win_scrap', 'left=100,top=100,width=600,height=600,scrollbars=1');
367    new_win.focus();
368}
369
370/**
371 * 홈페이지 창
372 **/
373var win_homepage = function(href) {
374    var new_win = window.open(href, 'win_homepage', '');
375    new_win.focus();
376}
377
378/**
379 * 우편번호 창
380 **/
381var win_zip = function(frm_name, frm_zip, frm_addr1, frm_addr2, frm_addr3, frm_jibeon) {
382    if(typeof daum === 'undefined'){
383        alert("다음 우편번호 postcode.v2.js 파일이 로드되지 않았습니다.");
384        return false;
385    }
386
387    var zip_case = 1;   //0이면 레이어, 1이면 페이지에 끼워 넣기, 2이면 새창
388
389    var complete_fn = function(data){
390        // 팝업에서 검색결과 항목을 클릭했을때 실행할 코드를 작성하는 부분.
391
392        // 각 주소의 노출 규칙에 따라 주소를 조합한다.
393        // 내려오는 변수가 값이 없는 경우엔 공백('')값을 가지므로, 이를 참고하여 분기 한다.
394        var fullAddr = ''; // 최종 주소 변수
395        var extraAddr = ''; // 조합형 주소 변수
396
397        // 사용자가 선택한 주소 타입에 따라 해당 주소 값을 가져온다.
398        if (data.userSelectedType === 'R') { // 사용자가 도로명 주소를 선택했을 경우
399            fullAddr = data.roadAddress;
400
401        } else { // 사용자가 지번 주소를 선택했을 경우(J)
402            fullAddr = data.jibunAddress;
403        }
404
405        // 사용자가 선택한 주소가 도로명 타입일때 조합한다.
406        if(data.userSelectedType === 'R'){
407            //법정동명이 있을 경우 추가한다.
408            if(data.bname !== ''){
409                extraAddr += data.bname;
410            }
411            // 건물명이 있을 경우 추가한다.
412            if(data.buildingName !== ''){
413                extraAddr += (extraAddr !== '' ? ', ' + data.buildingName : data.buildingName);
414            }
415            // 조합형주소의 유무에 따라 양쪽에 괄호를 추가하여 최종 주소를 만든다.
416            extraAddr = (extraAddr !== '' ? ' ('+ extraAddr +')' : '');
417        }
418
419        // 우편번호와 주소 정보를 해당 필드에 넣고, 커서를 상세주소 필드로 이동한다.
420        var of = document[frm_name];
421
422        of[frm_zip].value = data.zonecode;
423
424        of[frm_addr1].value = fullAddr;
425        of[frm_addr3].value = extraAddr;
426
427        if(of[frm_jibeon] !== undefined){
428            of[frm_jibeon].value = data.userSelectedType;
429        }
430
431        of[frm_addr2].focus();
432    };
433
434    switch(zip_case) {
435        case 1 :    //iframe을 이용하여 페이지에 끼워 넣기
436            var daum_pape_id = 'daum_juso_page'+frm_zip,
437                element_wrap = document.getElementById(daum_pape_id),
438                currentScroll = Math.max(document.body.scrollTop, document.documentElement.scrollTop);
439            if (element_wrap == null) {
440                element_wrap = document.createElement("div");
441                element_wrap.setAttribute("id", daum_pape_id);
442                element_wrap.style.cssText = 'display:none;border:1px solid;left:0;width:100%;height:300px;margin:5px 0;position:relative;-webkit-overflow-scrolling:touch;';
443                element_wrap.innerHTML = '<img src="//i1.daumcdn.net/localimg/localimages/07/postcode/320/close.png" id="bt
443nFoldWrap" style="cursor:pointer;position:absolute;right:0px;top:-21px;z-index:1" class="close_daum_juso" alt="접기 버튼">';
444                jQuery('form[name="'+frm_name+'"]').find('input[name="'+frm_addr1+'"]').before(element_wrap);
445                jQuery("#"+daum_pape_id).off("click", ".close_daum_juso").on("click", ".close_daum_juso", function(e){
446                    e.preventDefault();
447                    jQuery(this).parent().hide();
448                });
449            }
450
451            new kakao.Postcode({
452                oncomplete: function(data) {
453                    complete_fn(data);
454                    // iframe을 넣은 element를 안보이게 한다.
455                    element_wrap.style.display = 'none';
456                    // 우편번호 찾기 화면이 보이기 이전으로 scroll 위치를 되돌린다.
457                    document.body.scrollTop = currentScroll;
458                },
459                // 우편번호 찾기 화면 크기가 조정되었을때 실행할 코드를 작성하는 부분.
460                // iframe을 넣은 element의 높이값을 조정한다.
461                onresize : function(size) {
462                    element_wrap.style.height = size.height + "px";
463                },
464                maxSuggestItems : g5_is_mobile ? 6 : 10,
465                width : '100%',
466                height : '100%'
467            }).embed(element_wrap);
468
469            // iframe을 넣은 element를 보이게 한다.
470            element_wrap.style.display = 'block';
471            break;
472        case 2 :    //새창으로 띄우기
473            new kakao.Postcode({
474                oncomplete: function(data) {
475                    complete_fn(data);
476                }
477            }).open();
478            break;
479        default :   //iframe을 이용하여 레이어 띄우기
480            var rayer_id = 'daum_juso_rayer'+frm_zip,
481                element_layer = document.getElementById(rayer_id);
482            if (element_layer == null) {
483                element_layer = document.createElement("div");
484                element_layer.setAttribute("id", rayer_id);
485                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';
486                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="닫기 버튼">';
487                document.body.appendChild(element_layer);
488                jQuery("#"+rayer_id).off("click", ".close_daum_juso").on("click", ".close_daum_juso", function(e){
489                    e.preventDefault();
490                    jQuery(this).parent().hide();
491                });
492            }
493
494            new kakao.Postcode({
495                oncomplete: function(data) {
496                    complete_fn(data);
497                    // iframe을 넣은 element를 안보이게 한다.
498                    element_layer.style.display = 'none';
499                },
500                maxSuggestItems : g5_is_mobile ? 6 : 10,
501                width : '100%',
502                height : '100%'
503            }).embed(element_layer);
504
505            // iframe을 넣은 element를 보이게 한다.
506            element_layer.style.display = 'block';
507    }
508}
509
510/**
511 * 새로운 비밀번호 분실 창 : 101123
512 **/
513win_password_lost = function(href)
514{
515    var new_win = window.open(href, 'win_password_lost', 'width=617, height=330, scrollbars=1');
516    new_win.focus();
517}
518
519/**
520 * 설문조사 결과
521 **/
522var win_poll = function(href) {
523    var new_win = window.open(href, 'win_poll', 'width=616, height=500, scrollbars=1');
524    new_win.focus();
525}
526
527/**
528 * 스크린리더 미사용자를 위한 스크립트 - 지운아빠 2013-04-22
529 * alt 값만 갖는 그래픽 링크에 마우스오버 시 title 값 부여, 마우스아웃 시 title 값 제거
530 **/
531$(function() {
532    $('a img').mouseover(function() {
533        $a_img_title = $(this).attr('alt');
534        $(this).attr('title', $a_img_title);
535    }).mouseout(function() {
536        $(this).attr('title', '');
537    });
538});
539
540/**
541 * 텍스트 리사이즈
542**/
543function font_resize(id, rmv_class, add_class)
544{
545    var $el = $("#"+id);
546
547    $el.removeClass(rmv_class).addClass(add_class);
548
549    set_cookie("ck_font_resize_rmv_class", rmv_class, 1, g5_cookie_domain);
550    set_cookie("ck_font_resize_add_class", add_class, 1, g5_cookie_domain);
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    // 사이드뷰
617    var sv_hide = false;
618    $(".sv_member, .sv_guest").click(function() {
619        $(".sv").removeClass("sv_on");
620        $(this).closest(".sv_wrap").find(".sv").addClass("sv_on");
621    });
622
623    $(".sv, .sv_wrap").hover(
624        function() {
625            sv_hide = false;
626        },
627        function() {
628            sv_hide = true;
629        }
630    );
631
632    $(".sv_member, .sv_guest").focusin(function() {
633        sv_hide = false;
634        $(".sv").removeClass("sv_on");
635        $(this).closest(".sv_wrap").find(".sv").addClass("sv_on");
636    });
637
638    $(".sv a").focusin(function() {
639        sv_hide = false;
640    });
641
642    $(".sv a").focusout(function() {
643        sv_hide = true;
644    });
645
646    // 셀렉트 ul
647    var sel_hide = false;
648    $('.sel_btn').click(function() {
649        $('.sel_ul').removeClass('sel_on');
650        $(this).siblings('.sel_ul').addClass('sel_on');
651    });
652
653    $(".sel_wrap").hover(
654        function() {
655            sel_hide = false;
656        },
657        function() {
658            sel_hide = true;
659        }
660    );
661
662    $('.sel_a').focusin(function() {
663        sel_hide = false;
664    });
665
666    $('.sel_a').focusout(function() {
667        sel_hide = true;
668    });
669
670    $(document).click(function() {
671        if(sv_hide) { // 사이드뷰 해제
672            $(".sv").removeClass("sv_on");
673        }
674        if (sel_hide) { // 셀렉트 ul 해제
675            $('.sel_ul').removeClass('sel_on');
676        }
677    });
678
679    $(document).focusin(function() {
680        if(sv_hide) { // 사이드뷰 해제
681            $(".sv").removeClass("sv_on");
682        }
683        if (sel_hide) { // 셀렉트 ul 해제
684            $('.sel_ul').removeClass('sel_on');
685        }
686    });
687
688    $(document).on( "keyup change", "textarea#wr_content[maxlength]", function(){
689        var str = $(this).val();
690        var mx = parseInt($(this).attr("maxlength"));
691        if (str.length > mx) {
692            $(this).val(str.substr(0, mx));
693            return false;
694        }
695    });
696});
697
698function get_write_token(bo_table)
699{
700    var token = "";
701
702    $.ajax({
703        type: "POST",
704        url: g5_bbs_url+"/write_token.php",
705        data: { bo_table: bo_table },
706        cache: false,
707        async: false,
708        dataType: "json",
709        success: function(data) {
710            if(data.error) {
711                alert(data.error);
712                if(data.url)
713                    document.location.href = data.url;
714
715                return false;
716            }
717
718            token = data.token;
719        }
720    });
721
722    return token;
723}
724
725$(function() {
726    $(document).on("click", "form[name=fwrite] input:submit, form[name=fwrite] button:submit, form[name=fwrite] input:image", function() {
727        var f = this.form;
728
729        if (typeof(f.bo_table) == "undefined") {
730            return;
731        }
732
733        var bo_table = f.bo_table.value;
734        var token = get_write_token(bo_table);
735
736        if(!token) {
737            alert("토큰 정보가 올바르지 않습니다.");
738            return false;
739        }
740
741        var $f = $(f);
742
743        if(typeof f.token === "undefined")
744            $f.prepend('<input type="hidden" name="token" value="">');
745
746        $f.find("input[name=token]").val(token);
747
748        return true;
749    });
750});

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.