PageSourceSearch

https://neweducation.co.kr/js/common.js?ver=20260925001951

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

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.