PageSourceSearch

https://account.creverse.com/inc/js_24/Site.js?v=7715

js creverse.com collected 2026-09-25 03:08:57 UTC 55,084 bytes, 1,531 lines download raw bytes

1// Site 전반적으로 사용되는 스크립트 입니다.
2
3var Site = {};
4
5// IE 확인
6Site.IsIE = function () {
7    if (navigator.userAgent.toLowerCase().indexOf("chrome") != -1) return false;
8    if (navigator.userAgent.toLowerCase().indexOf("msie") != -1) return true;
9    if (navigator.userAgent.toLowerCase().indexOf("windows nt") != -1) return true;
10    return false;
11}
12
13// IE Version 체크
14Site.GetVersionOfIE = function () {
15
16    var word;
17
18    var agent = navigator.userAgent.toLowerCase();
19
20    // IE old version ( IE 10 or Lower ) 
21    if (navigator.appName == "Microsoft Internet Explorer") word = "msie ";
22
23        // IE 11 
24    else if (agent.search("trident") > -1) word = "trident/.*rv:";
25
26        // Microsoft Edge  
27    else if (agent.search("edge/") > -1) word = "edge/";
28
29        // 그외, IE가 아니라면 ( If it's not IE or Edge )  
30    else return -1;
31
32    var reg = new RegExp(word + "([0-9]{1,})(\\.{0,}[0-9]{0,1})");
33
34    if (reg.exec(agent) != null) return parseFloat(RegExp.$1 + RegExp.$2);
35
36    return -1;
37}
38
39// 현재위치 하이라이트
40Site.CheckCurrentLoactionAndHighlight = function () {
41
42    var pathname = document.location.pathname.toLowerCase();
43    
44    if (pathname.length > 2 && pathname.endsWith('/')) {
45        pathname = pathname.substring(0, pathname.length - 1);
46    }
47
48    var paths = pathname.split('/');
49    var lastPath = paths[paths.length - 1];
50
51    // 언더바가 있을경우 언더바 제외한 내용을 현재위치 검색어로 처리
52    if (lastPath.indexOf('_') > -1) {
53        paths[paths.length - 1] = lastPath.split('_')[0];
54        pathname = paths.join('/');
55    }
56
57    // gnb
58    $('#gnbBox').find('a').each(function () {
59        var $this = $(this);
60        var href = $this.attr('data-link');
61        if (href) {
62            href = href.toLowerCase();
63
64            if (href.indexOf('/', 1) == -1) {
65                pathname = '/' +  pathname.split('/')[1];
66            }
67
68            if (pathname == href) {
69                $this.parent().addClass('active');
70            }
71        }
72    });
73
74    // gnbm
75    $('#rightNavi').find('a').each(function () {
76        var $this = $(this);
77        var href = $this.attr('data-link');
78        if (href) {
79            href = href.toLowerCase();
80            if (href.indexOf('/', 1) == -1) {
81                pathname = '/' + pathname.split('/')[1];
82            }
83            if (pathname == href) {
84                $this.parent().addClass('active');
85            }
86        }
87    });
88}
89
90
91// 페이징
92Site.GeneratePagenation = function (containerSelector, pageIndex, pageSize, totalItemCount, nop, hrefFormat) {
93
94    var $container = $(containerSelector);
95
96    if ($container.length == 0)
97        return;
98
99    var prevIndex = null;
100    var nextIndex = null;
101    var totalPages = Math.ceil(totalItemCount / pageSize);
102    if (pageIndex < totalPages) nextIndex = pageIndex + 1;
103    if (pageIndex > 1) prevIndex = pageIndex - 1;
104
105    var start = 1;
106    if (pageIndex > nop) {
107        firstPageIndex = Math.floor();
108        start = Math.ceil(pageIndex / nop);
109        if (start != 1) start = (start - 1) * 10 + 1;
110    }
111    var $prev = $('<a class="pre">&laquo;</a>');
112    if (prevIndex == null) $prev.attr('href', 'javascript:void(0)');
113    else $prev.attr('href', 'javascript:setPage(' + prevIndex + ')');
114    $container.append($prev);
115
116    var tp = start;
117    for (var i = 0; i < nop; i++) {
118        if (tp > totalPages) {
119            break;
120        }
121        var $p = $('<a></a>');
122        $p.html(tp);
123        if (tp === pageIndex) {
124            $p.attr('href', 'javascript:void(0)');
125            $p.addClass('on');
126        }
127        else {
128            $p.attr('href', 'javascript:setPage(' + tp + ')');
129        }
130        $container.append($p);
131        tp++;
132    }
133    var $next = $('<a class="nxt">&raquo;</a>');
134    if (nextIndex == null) $next.attr('href', 'javascript:void(0)');
135    else $next.attr('href', 'javascript:setPage(' + nextIndex + ')');
136    $container.append($next);
137}
138
139// 팝업클릭 초기화
140Site.PopWrapping = function (e) {
141
142    e.preventDefault();
143
144    // 레이어 팝업할 html elememt
145    var target = $(this).attr('data-target');
146
147    // 레이어 팝업할 url
148    var url = $(this).attr('data-url');
149    console.log('PopWrapping');
150    // 우선순위
151    // target > url
152
153    // jquery.popupoverlay
154    if (target) {
155
156        $('#' + target).popup('show');
157
158        var onloadFunc = $(this).attr('data-onload');
159        if (onloadFunc) {
160            setTimeout(eval(onloadFunc), 0);
161        }
162    }
163    else if (url) {
164        // url은 아직 필요치 않아서 구현하지 않음
165    }
166}
167
168// 클립보드 복사
169Site.ClipboardCopy = function (content) {
170    if (Site.IsIE() && Site.GetVersionOfIE() < 10) {
171        window.clipboardData.setData("Text", content);
172    }
173    else {
174        var $dummy = $('#hdnClipboardDummy');
175        if ($dummy.length == 0) {
176            $dummy = $('<input id="hdnClipboardDummy" type="text" style="position:absolute;top:-100px; left:-100px;" />');
177            $dummy.val(content);
178            $('body').append($dummy);
179        }
180        $dummy.select();
181        document.execCommand("Copy");
182        $dummy.remove();
183    }
184    alert('클립보드에 복사 하였습니다.');
185}
186
187// javascript a click with target _blank
188Site.LnikClickNewWIndow = function (href) {
189    // anchor click은 jquery로 정상적 작동이 안됨
190    // native javascript로 구현
191    var anchor = document.createElement('a');
192    anchor.href = href;
193    anchor.id = 'dummyLink';
194    anchor.target = '_blank';
195    document.body.appendChild(anchor);
196    anchor.click();
197    $('#dummyLink').remove();
198}
199
200// jwt token refresh
201Site.TokenRefresh = function () {
202    $.ajax({
203        type: "POST",
204        contentType: "application/json; charset=utf-8",
205        url: '/Authentication/TokenRefresh',
206        data: null,
207        dataType: 'json'
208    })
209        .done(function (data) {
210            if (data.result != 'ok') {
211                if (console) {
212                    console.log(data);
213                }
214            }
215        })
216        .fail(function (xhr, status, error) {
217            if (console) {
218                console.log(error);
219            }
220        })
221        .always(function (data) {
222        });
223}
224
225// .insert 하위 엘리먼트 focus 처리
226Site.InsertElementFocused = function () {
227    var $container = $(this).parent();
228    if (!$container.hasClass('insert'))
229        return;
230
231    if (!$container.hasClass('open'))
232        $container.addClass('open');
233
234    $container.children("label.move").animate({ "top": "15px", "font-size": "0.9em" }, { "duration": "fast" });
235    $container.children("p.guide").hide();
236}
237
238// .insert 하위 엘리먼트 blur 처리
239Site.InsertElementBlured = function ($item) {
240
241    var $container = $(this).parent();
242
243    if (!$container.hasClass('insert'))
244        return;
245
246    var val = $(this).val() != undefined ? $(this).val().trim() :"";
247
248    if (val.length == 0) {
249        $container.removeClass('open');
250        $container.children("label.move").animate({ "top": "41px", "font-size": "1.2em" }, { "duration": "fast" });
251        if (!$container.hasClass('error'))
252            $container.children("p.guide").show();
253    }
254    else {
255        if (!$container.hasClass('open'))
256            $container.addClass('open');
257        $container.children("label.move").animate({ "top": "15px", "font-size": "0.9em" }, { "duration": "fast" });
258        $container.children("p.guide").hide();
259    }
260}
261
262// 이동처리
263// action : 이동하고자 하는 url 필수
264Site.Go = function (action, method) {
265    if (!action)
266        return;
267    var $f = $('#frmGo');
268
269    if (method)
270        $f.attr('method', method);
271
272    var method = $f.attr('method');
273
274    //if (console) console.log("Site.Go : ");
275
276    // Allim4.0 메뉴 처리 추가 ----------------------------
277    var agent = navigator.userAgent.toLowerCase();
278    var actionLow = action.toLowerCase();
279    if (agent.indexOf("inappbrowser") > -1) {
280        if (agent.indexOf("com.chungdahm.allim") > -1) {
281            try {
282
283                // 통합회원 sub path 부터 시작하는 경우 페이지 이동
284                if (actionLow.indexOf("/") == 0) {
285                    ;
286                    // account 로 시작하는 도메인은 하단 action 처리 되도록 함
287                }
288                else {
289
290
291                    // 통합회원인 경우 page 이동되도록 함 (올림 통합 로그인 사용)
292                    if (actionLow.indexOf("/account.") == -1 && actionLow.indexOf("/account-vlc.") == -1) {
293
294
295                        // 도메인 붙어서 오는 경우 올림에서 오류 발생하므로 window.open으로 변경
296                        if (actionLow.indexOf("http://") == 0 || actionLow.indexOf("https://") == 0) {
297
298                            try {
299                                window.parent.postMessage('open:' + encodeURIComponent(JSON.stringify({ url: action })), '*');
300                            } catch (e) {
301                                window.open(action); // 올림 인터페이스로 수정 예정 > ios 에서 동작 안함
302                            }
303                            return; // 다음 처리 안되도록 
304                        }
305                        return;// 종료
306                    }
307
308                    // account 로 시작하는 도메인은 하단 action 처리 되도록 함
309                }
310
311                ////if (console) console.log("Site.Go : " + actionLow + "-------------------");
312                //// iframe 인지 inappbrowser 인지  타이틀 없는 창에서도 실행되도록 둠
313                //switch (actionLow) {
314                //    case "/login":
315                //        window.parent.postMessage('move:Login', '*');
316                //        break;
317                //    case "/join":
318                //    case "/join/index":                        
319                //        window.parent.postMessage('move:Join', '*');
320                //        break;
321                //    case "/find":
322                //    case "/find/id":
323                //        window.parent.postMessage('move:FindId', '*');
324                //        break;
325                //    case "/find/password":
326                //        window.parent.postMessage('move:FindPassword', '*');
327                //        break;
328                //    case "/my/relation_list":
329                //        window.parent.postMessage('move:RelationList', '*');
330                //        break;
331                //    case "/my/relation_add":
332                //    case "/my/relation_link":
333                //        window.parent.postMessage('move:RelationAdd', '*');
334                //        break;
335                //    default:
336                //        // 통합회원인 경우 page 이동되도록 함 (올림 통합 로그인 사용)
337                //        if (actionLow.indexOf("/account.") == -1 && actionLow.indexOf("/account-vlc.") == -1) {
338
339                        
340                //            // 도메인 붙어서 오는 경우 올림에서 오류 발생하므로 window.open으로 변경
341                //            if (actionLow.indexOf("http://") == 0 || actionLow.indexOf("https://") == 0) {
342                            
343                //                try {
344                //                    window.parent.postMessage('open:' + encodeURIComponent(JSON.stringify({ url: action })), '*');
345                //                } catch (e) {
346                //                    window.open(action); // 올림 인터페이스로 수정 예정 > ios 에서 동작 안함
347                //                }
348                //                return; // 다음 처리 안되도록 
349                //            }
350                //        }
351
352                //        break;
353                //}
354            } catch (e) {
355                if (console)
356                    console.log(e.message);
357            }
358            
359        }
360        ////헤더는 goHeaderCIClick 실행하도록 수정 함
361        //else if ((agent.indexOf("com.chungdahm.nscreen") > -1 || agent.indexOf("com.chungdahm.april") > -1) && action == "https://www.chungdahm.com") {
362        //    // 닷컴 로고 이동시에만 
363        //    try {
364        //        window.NI.util.openUrl(
365        //            { url: action },
366        //            function () {
367        //                console.log('success');
368        //            },
369        //            function () {
370        //                console.log('failed');
371        //            }
372        //        );
373        //    } catch (e) {
374        //        if (console)
375        //            console.log(e.message);
376        //    }
377        //    return;// 다음 실행  불가처리
378        //}
379    }
380    // Allim4.0 메뉴 처리 끝 ------------------------------
381
382    // get일 경우 필수 필드만 전송
383    if (method == 'get') {
384
385        var form = document.createElement("form");
386        form.setAttribute("method", method);
387        form.setAttribute("action", action);
388
389        $('input[data-is-common="1"]').each(function () {
390            var hiddenField = document.createElement("input");
391            hiddenField.setAttribute("type", "hidden");
392            hiddenField.setAttribute("name", $(this).attr('name'));
393            hiddenField.setAttribute("value", $(this).val());
394            form.appendChild(hiddenField);
395        });
396
397        document.body.appendChild(form);
398        form.submit();
399    }
400    else {
401        $f.attr('action', action);
402        $f.submit();
403    }
404}
405
406// 추 후 common에 병합
407function isValidMobile(mobile) {
408    mobile = mobile.autoHypenPhone();
409    // 아래는 일반전화번호도 ok
410    //var pattern = /^(01[016789]{1}|02|0[3-9]{1}[0-9]{1})-?[0-9]{3,4}-?[0-9]{4}$/;
411    // 휴대폰만 ok
412    var pattern = /^(01[016789]{1})-?[0-9]{3,4}-?[0-9]{4}$/;
413    return pattern.test(mobile);
414}
415// 일반 전화도 ok(배송지 에서 사용)
416function isValidMobileAndTel(mobile) {
417    mobile = mobile.autoHypenPhone();
418    // 아래는 일반전화번호도 ok
419    var pattern = /^(01[016789]{1}|02|0[3-9]{1}[0-9]{1})-?[0-9]{3,4}-?[0-9]{4}$/;
420    return pattern.test(mobile);
421}
422
423function isValidBirthdate(birthdate) {
424    birthdate = birthdate.autoHypenBirthdate();
425    ///[0-9]{4}-[0-9]{2}-[0-9]{2})/
426    var pattern = /(1[0-9]{3}|2[0-9]{3})-(0[0-9]{1}|1[0-9]{1})-(0[0-9]{1}|1[0-9]{1}|2[0-9]{1}|3[0-9]{1})/;
427    return pattern.test(birthdate);
428}
429
430function autoHypenPhone(str) {
431    str = str.replace(/[^0-9]/g, '');
432    return str.replace(/(^02.{0}|^01.{1}|[0-9]{3})([0-9]+)([0-9]{4})/, "$1-$2-$3");
433}
434
435String.prototype.autoHypenPhone = function () {
436    var str = this.replace(/[^0-9]/g, '');
437    return str.replace(/(^02.{0}|^01.{1}|[0-9]{3})([0-9]+)([0-9]{4})/, "$1-$2-$3");
438}
439String.prototype.autoHypenBirthdate = function () {
440    var str = this.replace(/[^0-9]/g, '');
441    return str.replace(/(^1.{3}|^2.{3}|[0-9]{4})([0-9]{2})([0-9]{2})/, "$1-$2-$3");
442}
443
444function getVonMarketingToken(child_std_id) {
445    var vonToken = "";
446    $.ajax({
447        type: "POST",
448        contentType: "application/json; charset=utf-8",
449        url: '/Login/getVonMarketingToken',
450        data: JSON.stringify({ child_std_id: child_std_id }),
451        async: false,
452        dataType: 'json'
453    }).done(function (data) {
454        if (data.result == 'ok') {
455            vonToken = data.data;
456        }
457
458    }).fail(function (xhr, status, error) {
459
460        if (console)
461            console.log(error);
462
463    });
464    return vonToken;
465
466}
467function goVonPortalLogin(child_std_id, url, rdr, isNewWindow) {
468    var vonToken = getVonMarketingToken(child_std_id);
469    if (vonToken != "") {
470
471        var form = document.createElement("form");
472        form.setAttribute("method", "post");
473        form.setAttribute("action", url);
474
475        var hiddenField1 = document.createElement("input");
476        hiddenField1.setAttribute("type", "hidden");
477        hiddenField1.setAttribute("name", "redirect");
478        hiddenField1.setAttribute("value", rdr);
479        form.appendChild(hiddenField1);
480
481        var hiddenField2 = document.createElement("input");
482        hiddenField2.setAttribute("type", "hidden");
483        hiddenField2.setAttribute("name", "auth");
484        hiddenField2.setAttribute("value", vonToken);
485        form.appendChild(hiddenField2);
486
487        document.body.appendChild(form);
488
489        if (isNewWindow) {
490            form.setAttribute("target", "_blank");
491        }
492
493        //window.open('', 'vonPortal');
494
495        form.submit();
496
497
498    } else {
499        if (console)
500            console.log("vonToken is null");
501    }
502
503}
504
505
506
507
508
509function goPortalLoginCheck(audience, sso_url, rdr, isNewWindow, target) {
510    //audience =von_marketing
511    //PortalLoginCheck(string audience, string sso_url, string redirect = "", 
512
513    var form = document.createElement("form");
514    form.setAttribute("method", "post");
515    form.setAttribute("action", "/Login/PortalLoginCheck");
516
517    var hiddenField1 = document.createElement("input");
518    hiddenField1.setAttribute("type", "hidden");
519    hiddenField1.setAttribute("name", "redirect");
520    hiddenField1.setAttribute("value", rdr);
521    form.appendChild(hiddenField1);
522
523    var hiddenField2 = document.createElement("input");
524    hiddenField2.setAttribute("type", "hidden");
525    hiddenField2.setAttribute("name", "audience");
526    hiddenField2.setAttribute("value", audience);
527    form.appendChild(hiddenField2);
528
529    var hiddenField3 = document.createElement("input");
530    hiddenField3.setAttribute("type", "hidden");
531    hiddenField3.setAttribute("name", "sso_url");
532    hiddenField3.setAttribute("value", sso_url);
533    form.appendChild(hiddenField3);
534
535
536    document.body.appendChild(form);
537
538    if (isNewWindow) {
539        if (target)
540            form.setAttribute("target", target);
541        else
542            form.setAttribute("target", "_blank");
543    }
544
545
546    form.submit();
547}
548
549function setConsoleErrorLog(msg) {
550    if (console)
551        console.log(msg);
552
553}
554
555function setConsolelog(txt) {
556    // 개발일때만 노출 함
557    //if ($('#spAppConsole') != undefined) {
558    //    $('#spAppConsole').html($('#spAppConsole').html() + "<br/>" + txt);
559    //}
560}
561
562// header 청담 CI 클릭 시 https://www.chungdahm.com 이동 링크 수정
563function goHeaderCIClick(action) {
564
565    if (!action)
566        return;
567
568    // Allim4.0 메뉴 처리 추가 ----------------------------
569    var agent = navigator.userAgent.toLowerCase();
570    var actionLow = action.toLowerCase();
571    if (agent.indexOf("inappbrowser") > -1) {
572        if (agent.indexOf("com.chungdahm.allim") > -1) {
573            try {
574
575                // 도메인 붙어서 오는 경우 올림에서 오류 발생하므로 window.open으로 변경
576                if (actionLow.indexOf("http://") == 0 || actionLow.indexOf("https://") == 0) {
577
578                    try {
579                        window.parent.postMessage('open:' + encodeURIComponent(JSON.stringify({ url: action })), '*');
580                    } catch (e) {
581                        window.open(action); // 올림 인터페이스로 수정 예정 > ios 에서 동작 안함
582                    }
583                    return; // 다음 처리 안되도록 
584                }
585
586                       
587            } catch (e) {
588                if (console)
589                    console.log(e.message);
590            }
591
592        } else if (agent.indexOf("com.chungdahm.nscreen") > -1 || agent.indexOf("com.chungdahm.april") > -1 ) {
593            // 닷컴 로고 이동시에만 
594            window.NI.util.openUrl(
595                { url: action },
596                function () {
597                    //console.log('success');
598                },
599                function () {
600                    console.log('failed');
601                }
602            );
603            return;// 다음 실행  불가처리
604        }
605    }
606    // Allim4.0 메뉴 처리 끝 ------------------------------
607
608
609    //그 외의 경우 그냥 이동
610    document.location.href = action;
611
612}
613
614// 헤더 돌아가기(이전) 버튼 클릭 이벤트
615function goBackpageClick(portalUrl, redirectUrl, isAllimJoin, isFrame) {
616    //setConsolelog("goBackpageClick start");
617    // Allim4.0 메뉴 처리 추가 ----------------------------
618    var agent = navigator.userAgent.toLowerCase();
619    var current_path = window.location.pathname.toLowerCase();
620    var redirectUrl_low = redirectUrl.toLowerCase();
621    //setConsolelog("goBackpageClick current_path=" + current_path );
622    var is_go_home = false;
623    var is_go_login = false;
624    var is_go_join = false;
625    var is_go_redirect = false;
626    var home_url = "/my";//"/my/info";
627    var join_url = "/join";
628    var login_url = "/login";
629
630    var mglogin_url = "/mglogin";
631    var method = getCookieParam("authcommon", "method");
632    //console.log("method=" + method);
633
634    //setConsolelog("learningportal app goBackpageClick test 1" );
635    if (current_path.indexOf(home_url) > -1 && current_path != home_url) {
636        // /my 하위 페이지 : 내정보로 이동
637        is_go_home = true;
638        if (isAllimJoin != '') {
639            is_go_login = true;
640        }
641    } else if (current_path == '/login' || current_path == '/staff/login' || current_path == home_url) {
642        // redirect 로 이동 또는 닫기 : 로그인, 직원로그인 , 가입 첫화면, id/pw찾기
643        is_go_redirect = true;
644
645        if (current_path.indexOf('/login') > -1 && redirectUrl_low.indexOf(portalUrl.toLowerCase()) > -1 && redirectUrl_low.indexOf("/enter") > -1) {
646            // 로그인이 필요한 페이지로부터 진입한 경우 서브 페이지 제외된 포털로 이동
647            redirectUrl = portalUrl;
648        }
649
650    } else if (current_path.indexOf('/find/') > -1 || current_path == "/join" || current_path == "/join/index") {
651        // 로그인으로 이동 : 계정찾기, 회원가입 첫화면
652        is_go_login = true;
653    } else if (current_path.indexOf("/join/") > -1) {
654        is_go_join = true; //회원가입 첫페이지로 이동
655        if (isAllimJoin != '') {
656            is_go_login = true;
657        }
658    } 
659
660
661    //setConsolelog("learningportal app goBackpageClick test 2");
662    //setConsolelog("learningportal app goBackpageClick test is_go_home=" + is_go_home + " is_go_join=" 
662+ is_go_join);
663
664    if (agent.indexOf("inappbrowser") > -1) {
665        if (agent.indexOf("com.chungdahm.allim") > -1) {
666            try {
667                if (is_go_redirect) {
668                    goHomeClick(portalUrl, redirectUrl);
669                } else if (is_go_login) {
670                    document.location.href = login_url;
671                } else if (is_go_join) {
672                    document.location.href = join_url;
673                } else {
674                    document.location.href = home_url;
675                }
676                //if (isAllimJoin == "NY" || isAllimJoin == "Y") {
677                //    // 바로 닫기 처리
678                //    goHomeClick(portalUrl, redirectUrl);
679                //} if (isFrame == "Y") {
680                //    // 프레임 화면 내에서 이동 (헤더 없음)
681                //    history.back(-1);
682                //} else {
683                //    history.back(-1);
684                //}
685
686
687            } catch (e) {
688                setConsolelog(e.message);
689                if (console)
690                    console.log(e.message);
691            }
692            return;// 다음 실행 불가
693
694        } else if (agent.indexOf("com.chungdahm.nscreen") > -1 || agent.indexOf("com.chungdahm.april") > -1) {
695
696            setConsolelog("learningportal app goBackpageClick is_go_home=" + is_go_home + " is_go_join=" + is_go_join);
697
698            if (is_go_redirect) {
699                goHomeClick(portalUrl, redirectUrl);
700            } else if (is_go_login) {
701                document.location.href = login_url;
702            } else if (is_go_join) {
703                document.location.href = join_url;
704            } else {
705                document.location.href = home_url;
706            }
707
708            return;// 다음 실행 불
709        }
710    }
711    // Allim4.0 메뉴 처리 끝 ------------------------------
712
713    ////// web 각 메뉴 별로 별도 링크 이동으로 처리할 경우 여기에 내용 추가
714    //////history.back(-1);
715    //console.log("is_go_redirect=" + is_go_redirect);
716    //console.log("is_go_join=" + is_go_join);
717    //console.log("is_go_login=" + is_go_login);
718    //console.log("home_url=" + home_url);
719    //return;
720
721
722    if (is_go_redirect) {
723        goHomeClick(portalUrl, redirectUrl);
724    } else if (is_go_join) {
725        document.location.href = join_url;
726    } else if (is_go_login && method=='WEBMG') {
727        document.location.href = mglogin_url;
728    } else if (is_go_login ) {
729        document.location.href = login_url;
730    } else {
731        document.location.href = home_url;
732    }
733
734}
735
736// 헤더 홈 이동 버튼 클릭 이벤트
737function goHomeClick(portalUrl, redirectUrl) {
738
739    setConsolelog("goHomeClick start");
740    if (!redirectUrl || redirectUrl == "") {
741        redirectUrl = portalUrl;
742    }
743
744    var current_path = window.location.pathname.toLowerCase();
745    setConsolelog("goBackpageClick current_path=" + current_path);
746    // Allim4.0 메뉴 처리 추가 ----------------------------
747    var agent = navigator.userAgent.toLowerCase();
748    var actionLow = redirectUrl.toLowerCase();
749    var isNewAllim_2024 = false;
750    if (agent.indexOf("inappbrowser") > -1) {
751        if (agent.indexOf("com.chungdahm.allim") > -1) {
752            try {
753                var allimAppInfo = agent.substring(agent.indexOf("inappbrowser"), agent.length);
754                allimAppInfo = allimAppInfo.trim();
755                
756                if (allimAppInfo.indexOf("][") > -1) {
757                    var allimarr = allimAppInfo.split("][");
758                    if (allimarr.length > 1) {
759                        if (allimarr[1].localeCompare("5.2.0", undefined, { numeric: true, sensitivity: 'base' }) > -1) {
760                            // 같거나 큰 경우
761                            isNewAllim_2024 = true;
762                        }
763                    }
764                }
765
766                //console.log('site > goHomeClick > 올림 인터페이스 close 실행');
767                const message = {
768                    action: 'close'
769                }
770                var target = '';
771                if (isNewAllim_2024) {
772
773                    // 신규 웹앱 버전
774                    target = undefined;
775                    if (typeof webkit === 'undefined') {
776                        target = typeof allim_iab !== 'undefined' ? allim_iab : '';
777                    } else if (typeof webkit.messageHandlers !== 'undefined' && typeof webkit.messageHandlers.allim_iab !== 'undefined') {
778                        target = webkit.messageHandlers.allim_iab;
779                    }
780
781                    if (target != undefined && target != null && target != '') {
782                        target.postMessage(JSON.stringify(message));
783                    }
784
785                } else {
786
787                    // 기존 버전
788                    if (navigator.userAgent.toLocaleLowerCase().includes('android')) {
789                        target = (cordova_iab != null && cordova_iab != undefined) ? cordova_iab : webkit.messageHandlers.cordova_iab;
790                    } else {
791                        target = webkit.messageHandlers.cordova_iab;
792                    }
793
794                    target.postMessage(JSON.stringify(message));
795                }
796                
797
798            } catch (e) {
799
800                // 기존 버전
801                if (navigator.userAgent.toLocaleLowerCase().includes('android')) {
802                    target = (cordova_iab != null && cordova_iab != undefined) ? cordova_iab : webkit.messageHandlers.cordova_iab;
803                } else {
804                    target = webkit.messageHandlers.cordova_iab;
805                }
806
807                target.postMessage(JSON.stringify(message));
808
809                setConsolelog(e.message);
810                if (console)
811                    console.log(e.message);
812            }
813            return;// 다음 실행 불가
814
815        } else if (agent.indexOf("com.chungdahm.nscreen") > -1 || agent.indexOf("com.chungdahm.april") > -1) {
816
817            // 앱 종료 (os 홈으로 이동)
818            //if (current_path.indexOf(home_url) > -1 || current_path == "/join" || current_path == "/join/index" || current_path == '/login' || current_path.indexOf('/find/') > -1) {
819            if (current_path.indexOf('/join') > -1 || current_path.indexOf('/login') > -1 || current_path.indexOf('/find') > -1) {
820
821                setConsolelog("learningportal app > 로그인/가입/찾기 페이지에서 redirect로 이동");
822
823                document.location.href = redirectUrl;
824
825                // 러닝포털은 로그인 페이지가 inpage 이동 이므로 redirect로 이동
826                ////ios 에서는 os 홈으로 이동 불가
827                //if (userAgent.indexOf("[ios]") == -1) {
828                //    setConsolelog("learningportal aos app gotoHome start");
829                //    window.NI.callPluginExec("DevicePlugin"
830                //        , "gotoHome"
831                //        , {}
832                //        , function (params) { console.log("success", params); }
833                //        , function (e) { console.log("fail"); setConsolelog(e.message); }
834                //        , function () {  }
835                //        );
836                //}
837            } else {
838                setConsolelog("learningportal app > 회원 페이지에서 closeThisWindow 실행");
839                window.NI.callPluginExec("UtilPlugin"
840                    , "closeThisWindow"
841                    , { autoRefreshParentWindow: 'false' } //는 상위 부모뷰를 새로고침 여부
842                    , function (params) { setConsolelog("learningportal app closeThisWindow success"); }
843                    , function (e) { setConsolelog(e.message); }
844                    , function () {  }
845                );
846            }
847            return;// 다음 실행 불가
848        }
849    }
850    // Allim4.0 메뉴 처리 끝 ------------------------------
851
852    document.location.href = redirectUrl;
853
854}
855// 로그인 수단 저장(loginend.asp 넘어가기 직전에 저장, sns로그인 콜백 돌아온 후 저장)
856function setLoginByMethod(type, isNewAllim_2024) {
857    if (isNewAllim_2024 == undefined || isNewAllim_2024 == null) {
858        isNewAllim_2024 = 'false';
859    }
860
861    var agent = navigator.userAgent.toLowerCase();
862    if (agent.indexOf("inappbrowser") > -1) {
863        try {
864            if (agent.indexOf("com.chungdahm.allim") > -1) {
865
866                //console.log('올림앱 로그인 수단 저장');
867                const message = {
868                    action: 'setAppData',
869                    param: {
870                        dataName: 'loginmethod',
871                        dataValue: type
872                    }
873                };
874                var target = '';
875
876                try {
877                    if (isNewAllim_2024.toLowerCase() == 'true') {
878                    // 신규 웹앱 버전
879                        target = undefined;
880                        if (typeof webkit === 'undefined') {
881                            target = typeof allim_iab !== 'undefined' ? allim_iab : '';
882                        } else if (typeof webkit.messageHandlers !== 'undefined' && typeof webkit.messageHandlers.allim_iab !== 'undefined') {
883                            target = webkit.messageHandlers.allim_iab;
884                        }
885
886                        if (target != undefined && target != null && target != '') {
887                            target.postMessage(JSON.stringify(message));
888                        }
889
890                    } else {
891                        //기존 앱 버전 실행
892                        if (navigator.userAgent.toLocaleLowerCase().includes('android')) {
893                            target = (cordova_iab != null && cordova_iab != undefined) ? cordova_iab : webkit.messageHandlers.cordova_iab;
894                        } else {
895                            target = webkit.messageHandlers.cordova_iab;
896                        }
897
898                        target.postMessage(JSON.stringify(message));
899                    }
900
901                } catch (e1) {
902
903                    //기존 앱 버전 실행
904                    if (navigator.userAgent.toLocaleLowerCase().includes('android')) {
905                        target = (cordova_iab != null && cordova_iab != undefined) ? cordova_iab : webkit.messageHandlers.cordova_iab;
906                    } else {
907                        target = webkit.messageHandlers.cordova_iab;
908                    }
909
910                    target.postMessage(JSON.stringify(message));
911                }
912                
913                return;
914
915            } else if (agent.indexOf("com.chungdahm.nscreen") > -1 || agent.indexOf("com.chungdahm.april") > -1) {
916
917
918                window.NI.callPluginExec("DevicePlugin"
919                    , "saveLoginType"
920                    , { loginmethod: type }
921                    , function (params) {
922                        //console.log("success", params);
923                        setConsolelog('saveLoginType success=' + JSON.stringify(params));
924                    }
925                    , function (e) { setConsolelog(e.message); }
926                    , function () {  }
927                );
928
929
930                //DevicePlugin.saveLoginType(params, onSuccess, onF
930ailed)
931
932                /*
933                 window.NI.util.openUrl(
934                    { url: action },
935                    function () {
936                        //console.log('success');
937                    },
938                    function () {
939                        console.log('failed');
940                    }
941                );
942                */
943
944                return;
945            }
946
947        } catch (e) {
948            if (console)
949                console.log(e.message);
950
951            setConsolelog('error=' + e.message);
952        }
953    } else {
954        //pc mobile web
955        localStorage.removeItem("loginmethod");
956        localStorage.setItem("loginmethod", type);
957
958    }
959
960
961}
962// 로그인 수단 가져오기
963function getLoginByMethod(isNewAllim_2024) {
964    if (isNewAllim_2024 == undefined || isNewAllim_2024 == null) {
965        isNewAllim_2024 = 'false';
966    }
967    var method = "";
968    var agent = navigator.userAgent.toLowerCase();
969    if (agent.indexOf("inappbrowser") > -1) {
970        try {
971            if (agent.indexOf("com.chungdahm.allim") > -1) {
972
973                //console.log('올림앱 로그인 수단 가져오기 > 실행 후 fromAllim 에서 받음');
974                const message = {
975                    action: 'getAppData',
976                    param: {
977                        dataName: 'loginmethod'
978                    }
979                };
980                var target = '';
981
982
983                try {
984                    if (isNewAllim_2024.toLowerCase() == 'true') {
985                        // 신규 웹앱 버전
986                        target = undefined;
987                        if (typeof webkit === 'undefined') {
988                            target = typeof allim_iab !== 'undefined' ? allim_iab : '';
989                        } else if (typeof webkit.messageHandlers !== 'undefined' && typeof webkit.messageHandlers.allim_iab !== 'undefined') {
990                            target = webkit.messageHandlers.allim_iab;
991                        }
992
993                        if (target != undefined && target != null && target != '') {
994                            target.postMessage(JSON.stringify(message));
995                        }
996                        // 실제 데이터는 fromAllim 에서 받음
997                        method = "";
998
999                    } else {
1000                        // 기존 앱 버전
1001                        if (navigator.userAgent.toLocaleLowerCase().includes('android')) {
1002                            target = (cordova_iab != null && cordova_iab != undefined) ? cordova_iab : webkit.messageHandlers.cordova_iab;
1003                        } else {
1004                            target = webkit.messageHandlers.cordova_iab;
1005                        }
1006
1007                        target.postMessage(JSON.stringify(message));
1008                        // 실제 데이터는 fromAllim 에서 받음
1009                        method = "";
1010                    }
1011                }
1012                catch (e1) {
1013                    // 기존 앱 버전
1014                    if (navigator.userAgent.toLocaleLowerCase().includes('android')) {
1015                        target = (cordova_iab != null && cordova_iab != undefined) ? cordova_iab : webkit.messageHandlers.cordova_iab;
1016                    } else {
1017                        target = webkit.messageHandlers.cordova_iab;
1018                    }
1019
1020                    target.postMessage(JSON.stringify(message));
1021                    // 실제 데이터는 fromAllim 에서 받음
1022                    method = "";
1023
1024                }
1025
1026                
1027                return method;
1028
1029            } else if (agent.indexOf("com.chungdahm.nscreen") > -1 || agent.indexOf("com.chungdahm.april") > -1) {
1030
1031
1032                window.NI.callPluginExec("DevicePlugin"
1033                    , "getLoginType"
1034                    , {}
1035                    , function (params) {
1036                        //console.log("success", params);
1037                        setConsolelog('getLoginType success=' + JSON.stringify(params));
1038                        setConsolelog('method=' + params.loginmethod);
1039                        method = params.loginmethod;
1040                    }
1041                    , function (e) {  setConsolelog(e.message); }
1042                    , function () {  }
1043                );
1044
1045                return method;
1046            }
1047
1048        } catch (e) {
1049            setConsolelog('error=' + e.message);
1050            if (console)
1051                console.log(e.message);
1052        }
1053    } else {
1054        //pc mobile web
1055        if (localStorage.getItem("loginmethod") != undefined)
1056            method = localStorage.getItem("loginmethod");
1057
1058        //console.log('web 로그인 수단 가져오기');
1059
1060    }
1061    return method;
1062}
1063
1064
1065
1066// 로그인 수단별 layer 노출/비노출
1067function getLoginByMethodLayer(loginmethod) {
1068
1069    if ($('#spLastLoginKakao') == undefined || $('#spLastLoginApple') == undefined)
1070        return;
1071
1072    if (loginmethod == "kakao") {
1073        $('#spLastLoginKakao').show();
1074        $('#spLastLoginApple').hide();
1075    } else if (loginmethod == "apple") {
1076        $('#spLastLoginKakao').hide();
1077        $('#spLastLoginApple').show();
1078    }
1079    else {
1080        $('#spLastLoginKakao').hide();
1081        $('#spLastLoginApple').hide();
1082    }
1083}
1084
1085
1086// 로그인 브랜드 저장(loginend.asp 넘어가기 직전에 저장)
1087function setLoginBrand(type) {
1088
1089    var agent = navigator.userAgent.toLowerCase();
1090    if (agent.indexOf("inappbrowser") > -1) {
1091        try {
1092
1093
1094            if (agent.indexOf("com.chungdahm.allim") > -1) {
1095
1096                return;
1097
1098            } else if (agent.indexOf("com.chungdahm.nscreen") > -1 || agent.indexOf("com.chungdahm.april") > -1) {
1099
1100                //app 오픈 전 web 로컬 스토리지 저장
1101                localStorage.removeItem("loginbrand");
1102                localStorage.setItem("loginbrand", type);
1103
1104
1105                /*
1106                window.NI.callPluginExec("DevicePlugin"
1107                    , "saveLoginType"  // 여기 수정필요
1108                    , { loginmethod: type } // 여기 수정필요
1109                    , function (params) {
1110                        //console.log("success", params);
1111                        setConsolelog('saveLoginType success=' + JSON.stringify(params));
1112                    }
1113                    , function (e) { setConsolelog(e.message); }
1114                    , function () {  }
1115                );
1116                */
1117
1118                return;
1119            }
1120
1121        } catch (e) {
1122            if (console)
1123                console.log(e.message);
1124
1125            setConsolelog('error=' + e.message);
1126        }
1127    } else {
1128        //pc mobile web
1129        localStorage.removeItem("loginbrand");
1130        localStorage.setItem("loginbrand", type);
1131
1132    }
1133
1134
1135}
1136// 로그인 브랜드 가져오기
1137function getLoginBrand() {
1138    var method = "";
1139    var agent = navigator.userAgent.toLowerCase();
1140    if (agent.indexOf("inappbrowser") > -1) {
1141        try {
1142            if (agent.indexOf("com.chungdahm.allim") > -1) {
1143
1144                return method;
1145
1146            } else if (agent.indexOf("com.chungdahm.nscreen") > -1 || agent.indexOf("com.chungdahm.april") > -1) {
1147
1148                //app 오픈 전 web 로컬 스토리지 저장
1149                if (localStorage.getItem("loginbrand") != undefined)
1150                    method = localStorage.getItem("loginbrand");
1151
1152
1153                /*
1154                window.NI.callPluginExec("DevicePlugin"
1155                    , "getLoginType" // 여기 수정필요
1156                    , {}         // 여기 수정필요
1157                    , function (params) {
1158                        //console.log("success", params);
1159                        setConsolelog('getLoginType success=' + JSON.stringify(params));
1160                        setConsolelog('method=' + params.loginmethod);
1161                        method = params.loginmethod;
1162                    }
1163                    , function (e) {  setConsolelog(e.message); }
1164                    , function () {  }
1165                );
1166                */
1167                return method;
1168            }
1169
1170        } catch (e) {
1171            setConsolelog('error=' + e.message);
1172            if (console)
1173                console.log(e.message);
1174        }
1175    } else {
1176        //pc mobile web
1177        if (localStorage.getItem("loginbrand") != undefined)
1178            method = localStorage.getItem("loginbrand");
1179
1180        //console.log('web 로그인 브랜드 가져오기');
1181
1182    }
1183    return method;
1184}
1185
1186
1187// 입력창에 삭제 기능
1188function setDeleteInputClick(obj) {
1189    try {
1190        var $btnDelete = $(obj);
1191        var $input = $('#' + $btnDelete.attr('id').replace('Delete', ''));
1192        
1193        if (!$input ) {
1194            return;
1195        }
1196        //console.log($input.attr('id'));
1197        $input.val('');
1198        //$input.trigger("change");
1199        $btnDelete.hide();
1200        $input.trigger("blur");
1201        $input.focus();
1202    } catch (e) {
1203        console.log('setDeleteInputClick:' +e.message);
1204    }
1205    
1206}
1207
1208// loginid에서 사용
1209function maxLengthCheck(object) {
1210
1211    if (object.value.length > object.maxLength) {
1212
1213        object.value = object.value.slice(0, object.maxLength);
1214
1215    }
1216
1217}
1218
1219// 올림 외부 os 브라우저 로 링크 오픈
1220function allimOpenBrowserLink(link, isNewAllim_2024) {
1221    try {
1222        if (isNewAllim_2024 == undefined || isNewAllim_2024 == null) {
1223            isNewAllim_2024 = 'false';
1224        }
1225
1226        const message = {
1227            action: 'open:url',
1228            msg: {
1229                url: link,
1230                target: '_system'
1231
1232            }
1233        };
1234        var target = '';
1235        try {
1236
1237            if (isNewAllim_2024.toLowerCase() == 'true') {
1238                // 신규 웹앱 버전
1239                target = undefined;
1240                if (typeof webkit === 'undefined') {
1241                    target = typeof allim_iab !== 'undefined' ? allim_iab : '';
1242                } else if (typeof webkit.messageHandlers !== 'undefined' && typeof webkit.messageHandlers.allim_iab !== 'undefined') {
1243                    target = webkit.messageHandlers.allim_iab;
1244                }
1245
1246                if (target != undefined && target != null && target != '') {
1247                    target.postMessage(JSON.stringify(message));
1248                }
1249
1250            } else {
1251                // 기존 버전
1252                if (navigator.userAgent.toLocaleLowerCase().includes('android')) {
1253                    target = (cordova_iab != null && cordova_iab != undefined) ? cordova_iab : webkit.messageHandlers.cordova_iab;
1254                } else {
1255                    target = webkit.messageHandlers.cordova_iab;
1256                }
1257
1258                target.postMessage(JSON.stringify(message));
1259
1260            }
1261
1262        } catch (e1) {
1263            // 기존 버전
1264            if (navigator.userAgent.toLocaleLowerCase().includes('android')) {
1265                target = (cordova_iab != null && cordova_iab != undefined) ? cordova_iab : webkit.messageHandlers.cordova_iab;
1266            } else {
1267                target = webkit.messageHandlers.cordova_iab;
1268            }
1269
1270            target.postMessage(JSON.stringify(message));
1271
1272        }
1273
1274        
1275
1276        ////window.parent.postMessage('open:' + encodeURIComponent(JSON.stringify({ url: MPortalAdmission })), '*');//동작 안함
1277    } catch (e) {
1278        //window.open(link); // 올림 인터페이스로 수정 예정 > ios 에서 동작 안함
1279    }
1280
1281}
1282
1283// 올림 외부 os 브라우저 로 링크 오픈(토큰 로그인된 상태로 이동)
1284function allimOpenAuthBrowserLink(link, loginType, isNewAllim_2024) {
1285    try {
1286        console.log('allimOpenAuthBrowserLink start isNewAllim_2024=' + isNewAllim_2024);
1287        if (isNewAllim_2024 == undefined || isNewAllim_2024 == null) {
1288            isNewAllim_2024 = 'false';
1289        }
1290
1291        const message = {
1292            action: 'openUrlToken',
1293            msg: {
1294                url: link,
1295                tokenType: loginType, // S : Staff, P : Parent
1296                target: '_system'
1297                //,stdId: _ //사용하지 않는 것으로 보임
1298            }
1299
1300        };
1301        var target = '';
1302        try {
1303
1304            if (isNewAllim_2024.toLowerCase() == 'true') {
1305                // 신규 웹앱 버전
1306                target = undefined;
1307                if (typeof webkit === 'undefined') {
1308                    target = typeof allim_iab !== 'undefined' ? allim_iab : '';
1309                } else if (typeof webkit.messageHandlers !== 'undefined' && typeof webkit.messageHandlers.allim_iab !== 'undefined') {
1310                    target = webkit.messageHandlers.allim_iab;
1311                }
1312
1313                if (target != undefined && target != null && target != '') {
1314                    target.postMessage(JSON.stringify(message));
1315                }
1316
1317            } else {
1318                // 기존 버전
1319                if (navigator.userAgent.toLocaleLowerCase().includes('android')) {
1320                    target = (cordova_iab != null && cordova_iab != undefined) ? cordova_iab : webkit.messageHandlers.cordova_iab;
1321                } else {
1322                    target = webkit.messageHandlers.cordova_iab;
1323                }
1324
1325                target.postMessage(JSON.stringify(message));
1326
1327            }
1328
1329        } catch (e1) {
1330            console.log(e1.message)
1331
1332            // 기존 버전
1333            if (navigator.userAgent.toLocaleLowerCase().includes('android')) {
1334                target = (cordova_iab != null && cordova_iab != undefined) ? cordova_iab : webkit.messageHandlers.cordova_iab;
1335            } else {
1336                target = webkit.messageHandlers.cordova_iab;
1337            }
1338
1339            target.postMessage(JSON.stringify(message));
1340
1341        }
1342
1343
1344
1345
1346        ////window.parent.postMessage('open:' + encodeURIComponent(JSON.stringify({ url: MPortalAdmission })), '*');//동작 안함
1347    } catch (e) {
1348        //window.open(link); // 올림 인터페이스로 수정 예정 > ios 에서 동작 안함
1349        console.log(e.message);
1350        
1351    }
1352
1353}
1354
1355function allimOpenAuthBrowserLinkWithStdId(link, loginType, isNewAllim_2024, std_id) {
1356    try {
1357        console.log('allimOpenAuthBrowserLinkWithStdId start isNewAllim_2024=' + isNewAllim_2024);
1358        if (isNewAllim_2024 == undefined || isNewAllim_2024 == null) {
1359            isNewAllim_2024 = 'false';
1360        }
1361
1362        const message = {
1363            action: 'openUrlToken',
1364            msg: {
1365                url: link,
1366                tokenType: loginType, // S : Staff, P : Parent
1367                target: '_system'
1368                , stdId: std_id   //학생 회원가입 후 입학시험 예약 새창 뜨기 시 사용
1369            }
1370
1371        };
1372        var target = '';
1373        try {
1374
1375            if (isNewAllim_2024.toLowerCase() == 'true') {
1376                // 신규 웹앱 버전
1377                target = undefined;
1378                if (typeof webkit === 'undefined') {
1379                    target = typeof allim_iab !== 'undefined' ? allim_iab : '';
1380                } else if (typeof webkit.messageHandlers !== 'undefined' && typeof webkit.messageHandlers.allim_iab !== 'undefined') {
1381                    target = webkit.messageHandlers.allim_iab;
1382                }
1383
1384                if (target != undefined && target != null && target != '') {
1385                    target.postMessage(JSON.stringify(message));
1386                }
1387
1388            } else {
1389                // 기존 버전
1390                if (navigator.userAgent.toLocaleLowerCase().includes('android')) {
1391                    target = (cordova_iab != null && cordova_iab != undefined) ? cordova_iab : webkit.messageHandlers.cordova_iab;
1392                } else {
1393                    target = webkit.messageHandlers.cordova_iab;
1394                }
1395
1396                target.postMessage(JSON.stringify(message));
1397
1398            }
1399
1400        } catch (e1) {
1401            console.log(e1.message)
1402
1403            // 기존 버전
1404            if (navigator.userAgent.toLocaleLowerCase().includes('android')) {
1405                target = (cordova_iab != null && cordova_iab != undefined) ? cordova_iab : webkit.messageHandlers.cordova_iab;
1406            } else {
1407                target = webkit.messageHandlers.cordova_iab;
1408            }
1409
1410            target.postMessage(JSON.stringify(message));
1411
1412        }
1413
1414
1415
1416
1417        ////window.parent.postMessage('open:' + encodeURIComponent(JSON.stringify({ url: MPortalAdmission })), '*');//동작 안함
1418    } catch (e) {
1419        //window.open(link); // 올림 인터페이스로 수정 예정 > ios 에서 동작 안함
1420        console.log(e.message);
1421
1422    }
1423
1424}
1425
1426
1427$.fn.valid = function () {
1428    return this.each(function () {
1429        var $this = $(this);
1430        $this.find('input').removeClass('error');
1431        $this.find('select').parent().removeClass('error'); // 레이어팝업용select 는 상위 div 에 넣어줌
1432        $this.find('input,select').attr('data-valid', '1');
1433        ////$this.find('input,select').each(function () {
1434        ////    console.log($(this).attr('id') +'  data-valid=1 completed');
1435        ////});
1436        $this.parent().find('div.error-message').text('');
1437    });
1438}
1439
1440$.fn.invalid = function () {
1441    return this.each(function () {
1442        var $this = $(this);
1443        $this.find('input').addClass('error');
1444        $this.find('select').parent().addClass('error'); // 레이어팝업용select 는 상위 div 에 넣어줌
1445        $this.find('input,select').attr('data-valid', '0');
1446    });
1447}
1448
1449$.fn.invalidNoCss = function () {
1450    return this.each(function () {
1451        var $this = $(this);
1452        $this.find('input,select').attr('data-valid', '0');
1453        //console.log('invalidNoCss ----' + $this.find('input').attr('name'));
1454    });
1455}
1456
1457$.fn.getByte = function () {
1458    var codeByte = 0;
1459    var text = $(this).val();
1460    for (var idx = 0; idx < text.length; idx++) {
1461        var oneChar = escape(text.charAt(idx));
1462        if (oneChar.length == 1) {
1463            codeByte++;
1464        } else if (oneChar.indexOf("%u") != -1) {
1465            codeByte += 2;
1466        } else if (oneChar.indexOf("%") != -1) {
1467            codeByte++;
1468        }
1469    }
1470    return codeByte;
1471}
1472
1473//브랜드 선택 Select Box 스타일
1474function formatState(state) {
1475    if (!state.id) { return state.text; }
1476    var baseUrl = "/assets/images/common/brand";
1477    var $state = $(
1478        '<span><img src="' + baseUrl + '/' + state.element.value.toLowerCase() + '.svg" class="img-flag" /> ' + state.text + '</span>'
1479    );
1480    return $state;
1481}
1482
1483function setCookie(cName, cValue, cDay, domain) {
1484    var expire = new Date();
1485    expire.setDate(expire.getDate() + cDay);
1486    cookies = cName + '=' + escape(cValue) + '; path=/ ';
1487    if (typeof cDay != 'undefined') cookies += ';expires=' + expire.toGMTString() + ';';
1488    if (typeof domain != 'undefined') cookies += 'domain=' + domain+ ';';
1489    document.cookie = cookies;
1490}
1491
1492function setCookieAuthCommon(cName, cValue, cDay, domain) {
1493    var expire = new Date();
1494    expire.setDate(expire.getDate() + cDay);
1495    //cookies = cName + '=' + escape(cValue) + '; path=/ ';
1496    cookies = cName + '=' + cValue + '; path=/ ';// 2depth 이므로 실제 value 인코딩 해서 넘어오므로 그대로 저장
1497    if (typeof cDay != 'undefined') cookies += ';expires=' + expire.toGMTString() + ';';
1498    if (typeof domain != 'undefined') cookies += 'domain=' + domain + ';';
1499    document.cookie = cookies;
1500}
1501function getCookie(cName) {
1502    cName = cName + '=';
1503    var cookieData = document.cookie;
1504    var start = cookieData.indexOf(cName);
1505    var cValue = '';
1506    if (start != -1) {
1507        start += cName.length;
1508        var end = cookieData.indexOf(';', start);
1509        if (end == -1) end = cookieData.length;
1510        cValue = cookieData.substring(start, end);
1511    }
1512    return unescape(cValue);
1513}
1514
1515function getCookieParam(cookieName, key) {
1516    var cookieValue = getCookie(cookieName);
1517
1518    if (!cookieValue)
1519        return "";
1520
1521    var arr = cookieValue.split("&");
1522
1523    for (var i = 0; i < arr.length; i++) {
1524        var item = arr[i].split("=");
1525
1526        if (item[0] === key)
1527            return decodeURIComponent(item[1] || "");
1528    }
1529
1530    return "";
1531}

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.