PageSourceSearch

https://foco.go.kr/resources/cmmnn/js/frmsPortal.js?v=1790252439095

js foco.go.kr collected 2026-09-24 12:21:40 UTC 6,731 bytes, 198 lines download raw bytes

1'use strict';
2
3let preVal;
4
5/**************************************************************
6 * 포털 업무 javascript
7 *
8 * @author
9 * @since 2021. 11. 15
10 * @version 1.0
11 *
12 * == 개정이력 (Modification Information) ==
13 *
14 * 수정일       수정자            수정내용
15 * ------------ ------------------- ------------------------------
16 * 2021. 11. 15                 최초 생성
17 *************************************************************/
18const portal = (function($) {
19		if(!opener){
20		window.name="";
21	}
22	/**
23	 * ==================================================
24	 * pushState + Ajax
25	 * ==================================================
26	 */
27	if ($.support.pjax) {
28		$(document).on('pjax:complete', function(xhr, status, options) {
29			if (status.status === 200 && status.statusText === 'success') {
30				//필요 시 init 함수
31			}
32		});
33	} else {
34		toastr.error('웹브라우저가 pjax 를 지원하지 않습니다.');
35	}
36
37	return{
38				setSideMenu : function(topMenu, nowMenu) {
39				frms.ajax({
40					url: '/menu/sidemenu',
41					data: {
42						topMenu: topMenu,
43						nowMenu: nowMenu
44					},
45					success: function(result, status, xhr) {
46						$('aside.main-sidebar').html(result);
47					}
48				});
49			},
50			setLocation :  function(topMenu, nowMenu) {
51			frms.ajax({
52				url: '/menu/location',
53				data: {
54					topMenu: topMenu,
55					nowMenu: nowMenu
56				},
57				success: function(result, status, xhr) {
58					$('div.location-wrap').html(result);
59				}
60			});
61			},
62			getExistContainer : function(){
63			if($('#pjax-container').length == 0){
64				location.href='#main-container';
65			}else{
66				location.href='#pjax-container';
67			}
68		},
69		nvl : function(text, returnText) {
70            let result = returnText == null ? '' : returnText;
71            if(text){
72                result = text;
73            }
74            return result;
75        },
76        isNull : function(str){
77            if(str == null || str.length < 1){
78                return true;
79            }
80            return false;
81        },
82        juminValidate : function(jumin){
83            let ssn,
84                arr_ssn = [],
85                compare = [2,3,4,5,6,7,8,9,2,3,4,5],
86                sum = 0;
87
88            ssn = jumin.toString();
89
90            // 입력값 체크
91            if(isNaN(jumin)){
92                alert("주민등록번호는 숫자만 입력하셔야 합니다");
93                return false;
94            }
95            // 자릿수 체크
96            if(ssn.length != 13){
97                alert("올바른 주민등록 번호를 입력하여 주세요.")
98                return false;
99            }
100
101            // 공식: M = (11 - ((2*A + 3*B + 4*C + 5*D + 6*E + 7*E + 8*G + 9*H + 2*I + 3*J + 4*K + 5*L) * 11)) % 10)
102            for(var i = 0; i < 13; i++){
103                arr_ssn[i] = ssn.substring(i, i+1);
104            }
105
106            for(var i = 0; i < 12; i++){
107                sum = sum + (parseInt(arr_ssn[i], 10) * compare[i]);
108            }
109
110            sum = (11 - (sum % 11)) % 10;
111
112            if(sum != arr_ssn[12]){
113                alert("올바른 주민등록 번호를 입력하여 주세요.");
114                return false;
115            }
116
117            return true;
118        },
119        /**
120         * DOM에 금액형태로 콤마 추가 및 소수점 자리수 리미트. (Key 이벤트 용)
121         * EX) fcmsportal.setCommaWithDecimal( $("#id"), 4 );
122             * @param $obj      DOM
123         * @param point     체크할 소수점 자리수
124         * 2020.03.31 조해광
125         */
126        setCommaWithDecimal: function($obj, point) {
127
128            if (-1 != $obj.val().indexOf(".")) {
129                let splitPoint = $obj.val().toString().split(".");
130                if (point < splitPoint[1].length || 2 < splitPoint.length) {
131                    $obj.val(preVal);
132                    return;
133                } else {
134                    preVal = $obj.val();
135                }
136                $obj.val(portal.unComma(splitPoint[0]).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "." + splitPoint[1].replace(/[^\d]+/g, ""));
137                return;
138            } else {
139                $obj.val(portal.unComma($obj.val()).replace(/\B(?=(\d{3})+(?!\d))/g, ","));
140            }
141        },
142        /**
143         * 숫자에 콤마 제거
144         */
145        unComma: function(value) {
146            if (value != null) return value.toString().replace(/[^\.0-9]/g, '');
147        },
148        /**
149         * 숫자에 콤마 추가
150         */
151        comma: function(value) {
152            if (value != null) return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
153        },
154        commaWithDecimal: function(value) {
155
156            if (-1 != String(value).indexOf(".")) {
157                let splitPoint = String(value).toString().split(".");
158                return portal.unComma(splitPoint[0]).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "." + splitPoint[1].replace(/[^\d]+/g, "");
159            } else {
160                return portal.unComma(value).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
161            }
162        },
163        /**
164         * byte 용량을 환산하여 반환
165         * 용량의 크기에 따라 MB, KB, byte 단위로 환산함
166         * @param fileSize  byte 값
167         * @param fixed     환산된 용량의 소수점 자릿수
168         * @returns {String}
169         */
170        byte: function(fileSize, fixed) {
171            var str
172            if (fileSize >= 1024 * 1024) { //MB 단위 이상일때 MB 단위로 환산
173                fileSize = fileSize / (1024 * 1024);
174                fileSize = (fixed === undefined) ? fileSize : fileSize.toFixed(fixed);
175                str = portal.comma(fileSize) + ' MB';
176            }
177            else if (fileSize >= 1024) { //KB 단위 이상일때 KB 단위로 환산
178                fileSize = fileSize / 1024;
179                fileSize = (fixed === undefined) ? fileSize : fileSize.toFixed(fixed);
180                str = portal.comma(fileSize) + ' KB';
181            }
182            else { //KB 단위보다 작을때 byte 단위로 환산
183                fileSize = (fixed === undefined) ? fileSize : fileSize.toFixed(fixed);
184                str = portal.comma(fileSize) + ' byte';
185            }
186            return str;
187        },
188        checkFilter: function(str, level){
189			if (level == undefined || level == 0) {
190				str = str.replace(/\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\.|\-/g,"");
191			} else if (level != undefined && level == 1) {
192				str = str.replace(/\</g, "&lt;");
193				str = str.replace(/\>/g, "&gt;");
194			}
195			return str;
196		}
197	}
198}(jQuery));

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.