PageSourceSearch

https://freeipost.post.gov.tw/pstacce/assets/js/filters/eDateTime.js

js post.gov.tw collected 2026-09-24 08:40:04 UTC 6,505 bytes, 298 lines download raw bytes

1///
2/// 日期格式化 filters
3///
4eSoafApp.filter('eDateTime', function() {
5    return function (input) {
6    	var cData = "/";
7    	if (input == null) return "";
8    	if (input.length >= 6 && input.length <= 8) {
9			var oRegExp = new RegExp("([0-9]{2,4})([0-9]{2})([0-9]{2})","g");
10			if (oRegExp.test(input)) {
11				var strTemp = input.replace(oRegExp, "$1" + cData + "$2" + cData + "$3");	
12				input = strTemp;
13			}
14    	}
15        return input;
16    };
17});
18
19eSoafApp.filter('eDateTime2', function() {
20    return function (input) {
21    	var cData = ":";
22    	if (input == null) return "";
23    	if (input.length >= 6 && input.length <= 8) {
24			var oRegExp = new RegExp("([0-9]{2,4})([0-9]{2})([0-9]{2})","g");
25			if (oRegExp.test(input)) {
26				var strTemp = input.replace(oRegExp, "$1" + cData + "$2" + cData + "$3");	
27				input = strTemp;
28			}
29    	}
30        return input;
31    };
32});
33
34eSoafApp.filter('eMoney', function() {
35    return function (input) {
36        return S2M(input);
37    };    
38});
39
40/* 存簿局號帳號顯示格式
41 * by johnny Sun 2017.01.11
42 */
43eSoafApp.filter('ePbActnoShow', function() {
44    return function (input) {
45    	if(input.length == 14){
46    		input = input.substring(0,6) + '-' + input.substring(6,7) + ' ' + input.substring(7,13) + '-' + input.substring(13);
47    	}
48        return input;
49    };    
50});
51
52/* 存簿局號帳號隱碼格式
53 * by johnny Sun 2017.01.11
54 */
55eSoafApp.filter('ePbActnoHide', function() {
56    return function (input) {
57    	if(input.length == 14){
58    		input = input.substring(0,4) + '**-* **' + input.substring(9,13) + '-' + input.substring(13);
59    	}
60        return input;
61    };    
62});
63
64/* 劃撥帳號顯示格式
65 * by johnny Sun 2017.01.11
66 */
67eSoafApp.filter('eGiroActnoShow', function() {
68    return function (input) {
69    	if(input.length >= 14){
70    		input = input.substring(6);
71    	}
72        return input;
73    };    
74});
75
76/* 劃撥帳號隱碼格式
77 * by johnny Sun 2017.01.11
78 */
79eSoafApp.filter('eGiroActnoHide', function() {
80    return function (input) {
81    	if(input.length >= 14){
82    		input = '***' + input.substring(9);
83    	}else if(input.length == 8){
84    		input = '***' + input.substring(3);
85    	}
86        return input;
87    };    
88});
89
90/* 跨行轉入帳號隱碼格式
91 * by johnny Sun 2017.01.11
92 */
93eSoafApp.filter('eBankActnoHide', function() {
94    return function (input) {
95    	if(input.length == 16){
96    		input = input.substring(0,6) + '*****' + input.substring(11);
97    	}
98        return input;
99    };    
100});
101
102/* 身分證字號隱碼格式
103 * by keven Wang 2017.02.07
104 */
105eSoafApp.filter('eCifIdHide', function() {
106    return function (input) {
107    	if(input.length == 10){
108    		input = input.substring(0,6) + '****';
109    	}
110        return input;
111    };    
112});
113
114/* 時分顯示格式
115 * 4碼: 1830 轉為 18:30		8碼: 18301900 轉為 18:30 ~ 19:00
116 * by johnny Sun 2017.01.11
117 */
118eSoafApp.filter('eTimeHHMMHHMM', function() {
119    return function (input) {
120    	var output = ''
121    	if(input.length >= 4){
122    		output += input.substring(0,2) + ':' + input.substring(2,4);
123    	}
124    	if(input.length >= 8){
125    		output += ' ~ ' + input.substring(4,6) + ':' + input.substring(6,8);
126    	}
127    	
128        return output;
129    };    
130});
131
132/* 戶名隱碼格式
133 * by Zack 2017.02.07
134 */
135eSoafApp.filter('eUserNameHide', function() {
136	return function (input) {
137		var output = '';
138		
139		if(!isEmpty(input)) {
140			output = input.substr(0, 1);
141			
142			for(var i=1; i<input.length; i++) {
143				output += '*';
144			}
145		}
146		
147		return output;
148	};
149});
150
151/* 姓名隱碼格式
152 * by Fish 2017.06.28
153 */
154eSoafApp.filter('eCnNameHide', function() {
155	return function (input) {
156		var output = '';
157		
158		if(!isEmpty(input)) {
159			output = input.substr(0, 1) + "*" + input.substr(2);
160		}
161		
162		return output;
163	};
164});
165
166/* 通訊地址隱碼格式
167 * by Zack 2017.02.07
168 */
169eSoafApp.filter('eAddressHide', function() {
170	return function (input) {
171		var output = '';
172		
173		if(!isEmpty(input)) {
174			//因不確定路街名是否含有關鍵字,所以判斷困難,因此僅取前6碼顯示,其他皆隱碼
175//			var keyArr = ['國', '省', '縣', '市', '鄉', '鎮', '區'];
176//			var start_index = 0;
177//			
178//			for(var i in keyArr) {
179//				var index = input.indexOf(keyArr[i], start_index);
180//				
181//				if(index > start_index) {
182//					start_index = index;
183//				}
184//			}
185//			
186//			output = input.substring(0, ++start_index);
187//
188//			for(var i=start_index;
188 i<input.length; i++) {
189//				output += '*';
190//			}
191			
192			output = input.substr(0, 6);
193
194			for(var i=7; i<input.length; i++) {
195				output += '*';
196			}
197		}
198		
199		return output;
200	};
201});
202
203/* 電話隱碼格式
204 * by Zack 2017.02.07
205 */
206eSoafApp.filter('eTelephoneHide', function() {
207	return function (input) {
208		var output = '';
209		
210		if(!isEmpty(input)) {
211			var str = new String(input);
212			var nCount = 0;
213
214			for(var i=str.length-1; i>=0; i--) {
215				var chr = str[i];
216				
217				if((/\d/g).test(str[i])) {
218					if(nCount < 4) {
219						nCount++;
220					} else {
221						chr = '*';
222					}
223				}
224
225				output = chr + output;
226			}
227		}
228		
229		return output;
230	};
231});
232
233/* 手機隱碼格式
234 * by Zack 2017.02.07
235 */
236eSoafApp.filter('eCellphoneHide', function() {
237	return function (input) {
238		var output = '';
239		
240		if(!isEmpty(input)) {
241			var str = new String(input);
242			var nCount = 0;
243
244			for(var i=str.length-1; i>=0; i--) {
245				var chr = str[i];
246				
247				if((/\d/g).test(str[i])) {
248					if(nCount < 4) {
249						nCount++;
250					} else {
251						chr = '*';
252					}
253				}
254
255				output = chr + output;
256			}
257		}
258		
259		return output;
260	};
261});
262
263/* E-mail隱碼格式
264 * by Zack 2017.02.07
265 */
266eSoafApp.filter('eEmailHide', function() {
267	return function (input) {
268		var output = '';
269		
270		if(!isEmpty(input)) {
271			var index1 = input.indexOf('@');
272			var index2 = input.indexOf('.', index1);
273			
274			if(index1 != -1 && index2 != -1) {
275				for(var i=0; i<index1-3; i++) {
276					output += '*';
277				}
278				
279				output += input.substring(index1 - 3, ++index2);
280				
281				var str = new String(input.substr(index2));
282				for(var i in str) {
283					var chr = str[i];
284					
285					if(chr != '.') {
286						chr = '*';
287					}
288					
289					output += chr;
290				}
291			} else {
292				output = input;
293			}
294		}
295		
296		return output;
297	};
298});

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.