PageSourceSearch

https://its.ulsan.kr/resource/cmmn/js/ns-1.0.0.js

js its.ulsan.kr collected 2026-10-07 23:50:32 UTC 41,777 bytes, 1,385 lines download raw bytes

1var $Class = function(oClassMember){
2	function ClassOrigin(){
3		this.$init.apply(this, arguments);
4	}
5	ClassOrigin.prototype = oClassMember;
6	ClassOrigin.prototype.constructor = ClassOrigin;
7	return ClassOrigin;
8};
9
10var NS = new ($Class({
11	$init : function(){
12		var that = this;
13		
14		that.ctx = '';
15		that.baseMap = '';
16		that.VMS = null;
17		that.LCS = null;
18		that.TAB = null;
19		that.OL = null;
20		that.LO = null;
21		
22		that.menuObj = {};
23		that.menuLog = {};
24		that.btnInit = [];
25		that.form = {};
26		that.imgPath = '';
27		that.btnMode = '';
28		that.browser = '';
29		
30		var agent = navigator.userAgent.toLowerCase();
31		if ((navigator.appName == "Netscape" && navigator.userAgent.search("Trident") != -1) || (agent.indexOf("msie") != -1) ) {
32			that.browser = 'ie';
33		}
34		
35		that.$iterator = $Class({
36			array : null,
37			index : 0,
38			$init : function(arr){
39				this.array = arr;
40			},
41			hasNext : function(){
42				if(this.array.length > this.index){
43					return true;
44				}else{
45					return false;
46				}
47			},
48			next : function(){
49				return this.array[this.index++];
50			}
51		});
52
53		that.$nsFormConf = $Class({
54			$init : function(){
55				/*변수 선언 및 초기화*/
56				this['originRecord'] = {};
57				this['record'] = {};
58				this['formDiv'] = null;
59				this['title'] = null;
60				this['table'] = null;
61				this['colgroup'] = null;
62				this['tbody'] = null;
63				this['disabledDiv'] = null;
64				this['postData'] = {};
65				this['mode'] = null;
66				
67				for(var i = 0; i < arguments.length; i++){
68					for(var k in arguments[i]){
69						this[k] = arguments[i][k];
70					}
71				}
72				
73				/*초기화*/
74				var myform = document.getElementById(this.id);
75				myform.innerHTML = '';
76				if(this.height){
77					myform.style.height = this.height;
78					myform.style.overflowY = 'scroll';
79				}
80				
81				/*타이틀 생성*/
82				var h1Title = '';
83				if(this.title){
84					var h1 = document.createElement('h1');
85					h1.setAttribute('class','basics');
86					h1.innerHTML = this.title;
87//					myform.appendChild(h1); 원래 이거
88					myform.parentNode.insertBefore(h1,myform);
89					h1Title = h1;
90				}
91				
92				/*테이블 영역 생성*/
93				var table = document.createElement('table');
94				table.setAttribute('class','tableForm');
95				var colgroup = document.createElement('colgroup');
96				var col1 = document.createElement('col');
97				var col2 = document.createElement('col');
98				col1.setAttribute('width',this.labelSize);
99				colgroup.appendChild(col1);
100				colgroup.appendChild(col2);
101				
102				table.appendChild(colgroup);
103				var tbody = document.createElement('tbody');
104				table.appendChild(tbody);
105				
106				myform.appendChild(table);
107				
108				/*데이터 생성*/
109				var fields = this.fields;
110				for(var i = 0; i < fields.length; i++){
111					fields[i].tag['id'] = fields[i].id;
112					
113					var tr = document.createElement('tr');
114					if(fields[i].hidden){
115						tr.style.display = 'none';
116					}
117					var th = document.createElement('th');
118					var td = document.createElement('td');
119					if(fields[i].required === true){
120						var span = document.createElement('span');
121						th.appendChild(span);
122					}
123					var text = document.createTextNode('text');
124					text.data = fields[i].label;
125					th.appendChild(text);
126					
127					var tags = that.makeTag.apply(this,[fields[i].tag]);
128					for(var k = tags.length - 1; k >= 0; k--){
129						if(tags[k]){
130							if(fields[i].tag.type == 'checkbox'){
131								if(tags[k].tagName == 'INPUT'){
132									this.originRecord[fields[i].id] = this.originRecord[fields[i].id] ? this.originRecord[fields[i].id] : new Object();
133									this.originRecord[fields[i].id][tags[k].id] = tags[k];
134								}
135							}else if(fields[i].tag.type == 'button'){
136								if(fields[i].tag.onclick) tags[k].addEventListener('click', fields[i].tag.onclick);
137							}else if(tags[k].childNodes.length > 0 && tags[k].tagName != 'SELECT'){
138								for(var m = tags[k].childNodes.length - 1; m >= 0; m--){
139									var children = tags[k].childNodes;
140									if(children[m]){
141										if(children[m].id.replace(this.id+'_','') == fields[i].id){
142											this.originRecord[fields[i].id] = children[m];
143										}
144									}
145								}
146							}else{
147								if(tags[k].id.replace(this.id+'_','') == fields[i].id){
148									this.originRecord[fields[i].id] = tags[k];
149								}
150							}
151						}
152						td.appendChild(tags[k]);
153					}
154					tr.appendChild(th);
155					tr.appendChild(td);
156					
157					tbody.appendChild(tr);
158					
159					if(fields[i].hasOwnProperty('valid')){
160						var validType = fields[i].valid['type'];
161						switch(validType){
162							case 'number':
163								td.querySelector('input').addEventListener('keyup', function(e){
164									if(isNaN(e.char)){
165										this.value = this.value.replace(/[^.0-9]/gi,'');
166									}
167								});
168								break;
169							default:
170						}
171					}
172				}
173				var disabledDiv = document.createElement('div');
174				disabledDiv.style.position = 'absolute';
175				disabledDiv.style.width = '100%';
176				disabledDiv.style.height = '100%';
177				disabledDiv.style.top = '0px';
178				disabledDiv.style.left = '0px';
179				disabledDiv.style.zIndex = 1;
180				myform.appendChild(disabledDiv);
181				
182				this['formDiv'] = myform;
183				this['title'] = h1Title;
184				this['table'] = table;
185				this['colgroup'] = colgroup;
186				this['tbody'] = tbody;
187				this['disabledDiv'] = disabledDiv;
188				
189			},
190			labelSize : '180px',
191			mode : null,
192			clear : function(){
193				for(var i in this.originRecord){
194					for(var k in this.fields){
195						if(this.fields[k].id == i){
196							var type = this.fields[k].tag.type;
197							var value = (this.record[i]+"").replace(/undefined/gi,'');
198							switch (type){
199								case 'date':
200									this.originRecord[i].value = '';
201									break;
202								case 'span':
203									this.originRecord[i].innerHTML = '';
204									break;
205								case 'textarea':
206									this.originRecord[i].value = '';
207									break;
208								case 'text':
209									this.originRecord[i].value = '';
210//									this.record[i] = '';
211									break;
212								case 'password':
213									this.originRecord[i].value = '';
214//									this.record[i] = '';
215									break;
216								case 'checkbox':
217									for(var n in this.fields[k].tag.items){
218										var char = this.fields[k].tag.items[n].id.charAt(0).toUpperCase() + this.fields[k].tag.items[n].id.substring(1);
219										this.originRecord[i][i+'_'+this.fields[k].tag.items[n].id].checked = false;
220									}
221									break;
222								case 'phone':
223									this.originRecord[i].value = '';
224//									this.record[i] = '';
225									
226									var select = document.getElementById(this.id+'_'+i+'_1');
227									var input2 = document.getElementById(this.id+'_'+i+'_2');
228									var input3 = document.getElementById(this.id+'_'+i+'_3');
229									select.value = select.childNodes[0].value;
230									input2.value = '';
231									input3.value = '';
232									break;
233								case 'list':
234									this.originRecord[i].value = this.originRecord[i].options[0].value;
235									break;
236								case 'radio':
237									
238									break;
239								case 'file':
240									this.originRecord[i].value = '';
241									var uploadname = this.originRecord[i].parentNode.querySelector('.upload-name');
242									uploadname.value = '파일선택';
243									break;
244								default:
245									console.log(type);
246							}
247						}
248					}
249				}
250			},
251			refresh : function(){
252				for(var i in this.originRecord){
253					for(var k in this.fields){
254						if(this.fields[k].id == i){
255							var type = this.fields[k].tag.type;
256							var value = (this.record[i]+"").replace(/undefined/gi,'');
257							switch (type){
258								case 'date':
259									this.originRecord[i].value = value;
260									break;
261								case 'span':
262									this.originRecord[i].innerHTML = value;
263								case 'textarea':
264									this.originRecord[i].value = value;
265									break;
266								case 'text':
267									this.originRecord[i].value = value;
268									break;
269								case 'password':
270									this.originRecord[i].value = value;
271									break;
272								case 'checkbox':
273									for(var n in this.fields[k].tag.items){
274										var char = this.fields[k].tag.items[n].id.charAt(0).toUpperCase() + this.fields[k].tag.items[n].id.substring(1);
275										this.originRecord[i][i+'_'+this.fields[k].tag.items[n].id].checked = (this.record[i+char]+"").replace(/undefined/gi,'') == 'Y' ? true : false;
276									}
277									break;
278								case 'phone':
279									this.originRecord[i].value = value;
280									
281									var values = value.split('-');
282									for(var v in values){
283										document.getElementById(this.id+'_'+i+'_'+(Number(v)+1)).value = values[v];
284									}
285									break;
286								case 'list':
287									this.originRecord[i].value = value;
288									break;
289								case 'radio':
290									
291									break;
292								case 'file':
293									
294									break;
295								default:
296							}
297						}
298					}
299				}
300			},
301			unlock : function(mode){
302				switch(mode){
303					case 'i':
304						
305						break;
306					case 'u':
307						var key = this.key;
308						for(var i in key){
309							var data = this.getRecord(key[i]);
310							if(data == null || data == ''){
311								alert('수정할 데이터를 선택해 주세요');
312								var udtBtn = document.getElementById('udtBtn');
313								udtBtn.setAttribute("class","off");
314								return false;
315							}
316						}
317						break;
318					case 'd':
319						var key = this.key;
320						for(var i in key){
321							var data = this.getRecord(key[i]);
322							if(data == null || data == ''){
323								alert('삭제할 데이터를 선택해 주세요');
324								return false;
325							}
326						}
327						break;
328					default:
329				}
330				
331				this['disabledDiv'].style.zIndex = -1;
332				this.mode = mode;
333			},
334			lock : function(){
335				this['disabledDiv'].style.zIndex = 1;
336				this.mode = '';
337			},
338			ins : function(option){
339				this['postData'] = option.postData;
340				
341				var data = this.originRecord;
342				for(var i in data){
343					if(data[i].toString().indexOf('Element') != -1){
344						var type = data[i].getAttribute('type');
345						switch (type){
346							case 'checkbox':
347								if(data[i].checked){
348									this['postData'][i] = 'Y';
349								}else{
350									this['postData'][i] = 'N';
351								}
352								break;
353							default :
354								this['postData'][i] = data[i].value;
355						}
356					}else{
357						for(var j in data[i]){
358							var type = data[i][j].getAttribute('type');
359							switch (type){
360								case 'checkbox':
361									if(data[i][j].checked){
362										this['postData'][j] = 'Y';
363									}else{
364										this['postData'][j] = 'N';
365									}
366									break;
367								default :
368									this['postData'][j] = data[i][j].value;
369							}
370							
371						}
372					}
373				}
374				AF.ajax(option.url, this['postData'], function(returnData){
375					if(returnData.resultCode == 200){
376						if(option.callback) option.callback(returnData);
377					}else if(returnData.resultCode == 201){
378						alert(returnData.resultMsg);
379						if(option.callback) option.callback(returnData);
380					}else{
381						alert(returnData.resultMsg);
382					}
383				},'json');
384				
385				this.lock();
386			},
387			udt : function(option){
388				this['postData'] = option.postData;
389				
390				var data = this.originRecord;
391				for(var i in data){
392					if(data[i].toString().indexOf('Element') != -1){
393						var type = data[i].getAttribute('type');
394						switch (type){
395							case 'checkbox':
396								if(data[i].checked){
397									this['postData'][i] = 'Y';
398								}else{
399									this['postData'][i] = 'N';
400								}
401								break;
402							default :
403								this['postData'][i] = data[i].value;
404						}
405					}else{
406						for(var j in data[i]){
407							var type = data[i][j].getAttribute('type');
408							switch (type){
409								case 'checkbox':
410									if(data[i][j].checked){
411										this['postData'][j] = 'Y';
412									}else{
413										this['postData'][j] = 'N';
414									}
415									break;
416								default :
417									this['postData'][j] = data[i][j].value;
418							}
419							
420						}
421					}
422				}
423				AF.ajax(option.url, this['postData'], function(returnData){
424					if(returnData.resultCode == 200){
425						if(option.callback) option.callback(returnData);
426					}else if(returnData.resultCode == 201){
427						alert(returnData.resultMsg);
428						if(option.callback) option.callback(returnData);
429					}else{
430						alert(returnData.resultMsg);
431					}
432				},'json');
433				
434				this.lock();
435			},
436			del : function(option){
437				this['postData'] = option.postData;
438				var data = this.originRecord;
439				for(var i in data){
440					this['postData'][i] = data[i].value;
441				}
442				AF.ajax(option.url, this['postData'],function(returnData){
443					if(returnData.resultCode == 200){
444						if(option.callback) option.callback(returnData);
445					}else if(returnData.resultCode == 201){
446						alert(returnData.resultMsg);
447						if(option.callback) option.callback(returnData);
448					}else{
449						alert(returnData.resultMsg);
450					}
451				},'json');
452			},
453			getRecord : function(key){
454				var records = new Object();
455				for(var i in this.originRecord){
456					if(arguments.length > 0){
457						if(i == key){
458							return this.originRecord[i].value;
459						}
460					}else{
461						records[i] = this.originRecord[i].value;
462					}
463				}
464				return records;
465			},
466			getByteLength : function(s) {
467				if (s == null || s.length == 0) {
468					return 0;
469				}
470				var size = 0;
471				for ( var i = 0; i < s.length; i++) {
472					size += this.charByteSize(s.charAt(i));
473				}
474				return size;
475			},
476			charByteSize : function(ch) {
477				if (ch == null || ch.length == 0) {
478					return 0;
479				}
480				var charCode = ch.charCodeAt(0);
481				if (charCode <= 0x00007F) {
482					return 1;
483				} else if (charCode <= 0x0007FF) {
484					return 2;
485				} else if (charCode <= 0x00FFFF) {
486					return 3;
487				} else {
488					return 4;
489				}
490			},
491			validate : function(){
492				for(var i in this.originRecord){
493					for(var k in this.fields){
494						if(this.fields[k].id == i){
495							if(this.fields[k].hasOwnProperty('valid')){
496								var valType = this.fields[k].valid.type;
497								var valSize = this.fields[k].valid.size;
498								switch (valType){
499									case 'varchar':
500										var byte = this.getByteLength(this.originRecord[i].value);
501										if(this.getByteLength(this.originRecord[i].value) > valSize){
502											alert(this.fields[k].label+'의 최대 길이는 '+valSize+'byte입니다.');
503											this.mode += 'v';
504											return false;
505										}
506										break;
507									case 'number':
508										if(isNaN(Number(this.originRecord[i].value))){
509											alert(this.fields[k].label+'의 타입은 숫자입니다.');
510											this.mode += 'v';
511											return false;
512										}else{
513											if(Math.floor(Number(this.originRecord[i].value)).toString().length > valSize){
514												alert(this.fields[k].label+'의 최대 자릿수는 '+valSize+'입니다.');
515												this.mode += 'v';
516												return false;
517											}
518										}
519										break;
520									default:
521										console.log(valType);
522								}
523							}
524							
525							if(!this.fields[k].required){
526								continue;
527							}
528							var type = this.fields[k].tag.type;
529							switch (type){
530								case 'textarea':
531									
532									break;
533								case 'text':
534									if(this.originRecord[i].value == '' || this.originRecord[i].value == null){
535										alert('다음 항목은 필수입니다.\n'+this.fields[k].label);
536										this.originRecord[i].focus();
537										this.mode += 'v';
538										return false;
539									}
540									break;
541								case 'password':
542									if(this.originRecord[i].value == '' || this.originRecord[i].value == null){
543										alert('다음 항목은 필수입니다.\n'+this.fields[k].label);
544										this.originRecord[i].focus();
545										this.mode += 'v';
546										return false;
547									}
548									break;
549								case 'phone':
550									var values = this.originRecord[i].value.split('-');
551									var input1 = document.getElementById(this.id+'_'+i+'_1');
552									var input2 = document.getElementById(this.id+'_'+i+'_2');
553									var input3 = document.getElementById(this.id+'_'+i+'_3');
554									
555									if(input2.value == '' || input2.value == null){
556										alert('다음 항목은 필수입니다.\n'+this.fields[k].label);
557										input2.focus();
558										this.mode += 'v';
559										return false;
560									}
561									if(input3.value == '' || input3.value == null){
562										alert('다음 항목은 필수입니다.\n'+this.fields[k].label);
563										input3.focus();
564										this.mode += 'v';
565										return false;
566									}
567									break;
568								case 'list':
569									if(this.originRecord[i].value == '' || this.originRecord[i].value == null){
570										alert('다음 항목은 필수입니다.\n'+this.fields[k].label);
571										this.originRecord[i].focus();
572										this.mode += 'v';
573										return false;
574									}
575									break;
576								default:
577							}
578						}
579					}
580				}
581				if(this.mode != null) this.mode = this.mode.substring(0,1);
582			}
583		});
584	},
585	setMenuInfo : function(data){
586		var menuObj = {};
587		for(var i = 0; i < data.length; i++){
588			menuObj[data[i].parentMenuId] = (menuObj[data[i].parentMenuId]) == null ? new Array() : menuObj[data[i].parentMenuId];
589			menuObj[data[i].parentMenuId].push(data[i]);
590		}
591		NS.menuObj = menuObj;
592	},
593	makeMenu : function(tagId, menuId, depth){
594		var that = this;
595		that.renderMenu(tagId, menuId, depth);
596		var a = document.querySelectorAll('#'+tagId+' a');
597		for(var i = 0; i < a.length; i++){
598			a[i].addEventListener('mouseover', function(e){
599				e.preventDefault();
600				that.toggleMenu.apply(this, arguments);
601			});
602			a[i].addEventListener('click', function(e){
603				e.preventDefault();
604				that.clickMenu.apply(this, arguments);
605			});
606		}
607		var tag = document.getElementById(tagId);
608		tag.addEventListener('mouseleave', function(e){
609			e.preventDefault();
610			that.hideMenu.apply(this, arguments);
611		});
612	},
613	renderMenu : function(tagId, menuId, depth){
614		var menuArr = this.menuObj[menuId]; 
615		if(menuArr != null){
616			var tag = document.getElementById(tagId);
617			
618			var ul = document.createElement('ul');
619			ul.setAttribute('class', 'depth'+depth);
620			if(depth == 1){
621				tag.innerHTML = '';
622			}
623			tag.appendChild(ul);
624			for(var i = 0; i < menuArr.length; i++){
625				var url = (menuArr[i].menuUrl == null) ? '#' : this.ctx + menuArr[i].menuUrl; 
626				
627				var li = document.createElement('li');
628				li.id = menuArr[i].menuId;
629				ul.appendChild(li);
630				
631				var a = document.createElement('a');
632				a.id = 'upper_'+menuArr[i].menuId;
633				a.setAttribute('href', url);
634				a.innerText = menuArr[i].menuNm;
635				li.appendChild(a);
636				
637				this.renderMenu(li.id, menuArr[i].menuId, depth+1);
638			}
639		}
640	},
641	clickMenu : function(event){
642		var that = this;
643		event.preventDefault();
644		if(this.href.indexOf('#') == -1){
645			var obj = {};
646			var str = NS.cookie('BSFTMS');
647			if(str != '' && str != 'undefined' && str != '[]'){
648				var menuLogArr = JSON.parse(str);
649				for(var i = 0; i < menuLogArr.length; i++){
650					for(var j in menuLogArr[i]){
651						if(j == this.innerText){
652							setTimeout(function(){
653								location.href = that.href;
654							}, 150);
655							return;
656						}
657					}
658				}
659			}
660			
661			obj[this.innerText] = this.href+'::'+this.id.replace(/upper_/gi,'');
662			
663			NS.cookie('BSFTMS',obj);
664			var that = this;
665			var menuId = that.id.replace(/upper_/gi,'');
666			setTimeout(function(){
667				location.href = that.href;
668			}, 150);
669		}
670	},
671	toggleMenu : function(){
672		
673	},
674	hideMenu : function(){
675		
676	},
677	cookie : function(key,value,option){
678		var domain = location.href.substring(0,location.href.indexOf(NS.ctx));
679		var date = new Date();
680		date.setDate(date.getDate() + 30);
681		
682		if(arguments.length == 1){
683			key = key + '=';
684		    var cookieData = document.cookie;
685		    var start = cookieData.indexOf(key);
686		    if(start != -1){
687		        start += key.length;
688		        var end = cookieData.indexOf(';', start);
689		        if(end == -1){
690		        	end = cookieData.length;
691		        }
692		        value = cookieData.substring(start, end);
693		    }
694		    return unescape(value);
695		}
696		if(typeof(value) == 'object'){
697			var pre = NS.cookie(key);
698			var preArr = [];
699			if(pre != '' && pre != 'undefined'){
700				preArr = JSON.parse(pre);
701				var delIdx = [];
702				for(var a = 0; a < preArr.length; a++){
703					for(b in preArr[a]){
704						if(value[b] == preArr[a][b]){
705							delIdx.push(a);
706						}
707					}
708				}
709				for(var b = delIdx.length - 1; b >= 0; b--){
710					preArr.splice(delIdx[b],1);
711				}
712			}
713			preArr.unshift(value);
714			document.cookie = (key+'='+escape(JSON.stringify(preArr))+'; expires='+date+'; path=/;');
715		}else{
716			document.cookie = (key+'='+escape(value)+'; expires='+date+'; path=/;');
717		}
718	},
719	removeCookie : function(key,value){
720		var domain = location.href.substring(0,location.href.indexOf(NS.ctx));
721		var date = new Date();
722		
723		if(arguments.length == 1){
724			date.setDate(date.getDate() - 1);
725			document.cookie = key+'=; expires='+date+'; path=/;';
726			return;
727		}
728		if(typeof(value) == 'object'){
729			date.setDate(date.getDate() + 30);
730			var pre = NS.cookie(key);
731			var preArr = [];
732			if(pre != '' && pre != 'undefined'){
733				preArr = JSON.parse(pre);
734				var delIdx = [];
735				for(var a = 0; a < preArr.length; a++){
736					for(b in preArr[a]){
737						if(value[b] == preArr[a][b]){
738							delIdx.push(a);
739						}
740					}
741				}
742				for(var b = delIdx.length - 1; b >= 0; b--){
743					preArr.splice(delIdx[b],1);
744				}
745			}
746			document.cookie = (key+'='+escape(JSON.stringify(preArr))+'; expires='+date+'; path=/;');
747		}
748	},
749	makeTab : function(tabId){
750		var tab = document.getElementById(tabId);
751		tab.innerHTML = '';
752		var cookie = NS.cookie('BSFTMS');
753		if(cookie != '' && cookie != 'undefined'){
754			var arr = JSON.parse(cookie);
755			for(var i = 0; i < arr.length; i++){
756				if(i >= 7){
757					for(var k in arr[i]){
758						var obj = {}
759						obj[k] = arr[i][k];
760						NS.removeCookie('BSFTMS', obj);
761					}
762					continue;
763				}
764				for(var k in arr[i]){
765					var li = document.createElement('li');
766					li.innerHTML = k;
767					li.id = 'tab_'+arr[i][k].split('::')[1];
768					li.style.cursor = 'pointer';
769					
770					var menuUrl = null;
771					if(location.href.indexOf('#') != -1){
772						menuUrl = location.href.substring(location.href.indexOf(this.ctx)+this.ctx.length, location.href.indexOf('#'));
773					}else{
774						menuUrl = location.href.substring(location.href.indexOf(this.ctx)+this.ctx.length);
775					}
776					if(arr[i][k].indexOf(menuUrl) != -1){
777						li.setAttribute('class','on');
778					}
779					var btn = document.createElement('button');
780					btn.id = 'btn_'+arr[i][k].split('::')[1];
781					
782					NS.menuLog[li.id] = arr[i][k].split('::')[0];
783					btn.addEventListener('click', function(e){
784						e.stopPropagation();
785						NS.closeTab.apply(this, arguments);
786					});
787					li.addEventListener('click', function(){
788						var li = document.getElementById(this.id.replace('tab_',''));
789						var a = li.children[0];
790						NS.clickMenu.apply(a, arguments);
791					});
792					li.appendChild(btn);
793					tab.appendChild(li);
794				}
795			}
796		}
797	},
798	closeTab : function(){
799		var li = document.getElementById(this.id.replace('btn_','tab_'));
800		var obj = {}
801		obj[li.innerText] = NS.menuLog[li.id]+'::'+li.id.replace(/tab_/gi,'');
802		NS.removeCookie('BSFTMS', obj);
803		
804		if(li.getAttribute('class') != null){
805			if(li.getAttribute('class').indexOf('on') != -1){
806				var str = NS.cookie('BSFTMS');
807				if(str != '' && str != 'undefined' && str != '[]'){
808					var menuLogArr = JSON.parse(str);
809					for(var z in menuLogArr[0]){
810						var li = document.getElementById(menuLogArr[0][z].split('::')[1].replace('tab_',''));
811						var a = li.children[0];
812						NS.clickMenu.apply(a, [event]);
813					}
814				}else{
815					location.href = NS.ctx + '/main';
816				}
817			}
818		}
819		li.innerHTML = '';
820		li.parentNode.removeChild(li);
821		
822	},
823	makeBtn : function(id,permission){
824		var tag = document.getElementById(id);
825		tag.innerHTML = '';
826		for(var i = 0; i < permission.length; i++){
827			if(permission[i] == 1){
828				for(var q in NS.btnInit[i]){
829					if(q == '') continue;
830					var btn = document.createElement('button');
831					btn.id = q;
832					btn.style.display = 'none';
833					btn.innerHTML = NS.btnInit[i][q];
834					tag.appendChild(btn);
835					if(!window.hasOwnProperty(q)){
836						window[q] = function(){}
837					}
838					btn.addEventListener('click', NS.btnOnOff);
839					btn.addEventListener('click', window[q]);
840				}
841			}
842		}
843	},
844	btnOnOff : function(){
845		var btns = document.getElementById('btnArea').querySelectorAll('button');
846		for(var i = 0; i < btns.length; i++){
847			if(btns[i] != this){
848				btns[i].className = btns[i].className.replace('on','');
849			}
850		}
851		if(this.className.indexOf('on') != -1){
852			this.className = this.className.replace('on','');
853			NS.btnMode = '';
854		}else{
855			if(this.id.charAt(0) == 'i' || this.id.charAt(0) == 'u' || this.id.charAt(0) == 'd'){
856				this.classList.add('on');
857				NS.btnMode = this.id.charAt(0);
858			}else if(this.id.charAt(0) == 'c'){
859				NS.btnMode = '';
860			}
861		}
862	},
863	clearBtn : function(){
864		var btns = document.getElementById('btnArea').querySelectorAll('button');
865		for(var i = 0; i < btns.length; i++){
866			if(btns[i] != this){
867				btns[i].className = btns[i].className.replace('on','');
868			}
869		}
870		NS.btnMode = '';
871	},
872	pageBtn : function(){
873		var arr = arguments[0];
874		for(var i = 0; i < arr.length; i++){
875			var id = '';
876			if(arr[i].indexOf(':') != -1){
877				id = arr[i].split(':')[0];
878				var tag = document.getElementById(id);
879				tag.innerHTML = arr[i].split(':')[1];
880			}else{
881				id = arr[i];
882			}
883			var tag2 = document.getElementById(id);
884			tag2.parentNode.appendChild(tag2);
885			tag2.style.display = 'inline';
886		}
887	},
888	makeTag : function(tagInfo){
889		var that = this;
890		var div = document.createElement('div');
891		switch(tagInfo.type){
892			case 'date':
893				var tag = document.createElement('input');
894				tag.setAttribute('type', 'text');
895				tag.setAttribute('id', this.id+'_'+tagInfo.id);
896				
897				document.body.appendChild(tag);
898				var optionTime = {
899					id : tag.id,
900					allowPast: true,
901					months: 1,
902					rangePicker : false,
903					type : tagInfo.formatType ? tagInfo.formatType : 'date'
904				}
905				var datePicker2 = new ADP(optionTime);
906				
907				div.appendChild(tag);
908				
909				break;
910			case 'span':
911				var tag = document.createElement('span');
912				tag.setAttribute('id', this.id+'_'+tagInfo.id);
913				div.appendChild(tag);
914				break;
915			case 'textarea':
916				var tag = document.createElement('textarea');
917				tag.setAttribute('id', this.id+'_'+tagInfo.id);
918				
919				div.appendChild(tag);
920				break;
921			case 'div':
922				var tag = document.createElement('div');
923				tag.setAttribute('id', this.id+'_'+tagInfo.id);
924				tag.innerHTML = tagInfo.content;
925				div.appendChild(tag);
926				break;
927			case 'text':
928				var tag = document.createElement('input');
929				tag.setAttribute('type', tagInfo.type);
930				tag.setAttribute('id', this.id+'_'+tagInfo.id);
931				
932				div.appendChild(tag);
933				break;
934			case 'button':
935				var tag = document.createElement('button');
936				tag.innerHTML = tagInfo.text;
937				
938				div.appendChild(tag);
939			case 'password':
940				var tag = document.createElement('input');
941				tag.setAttribute('type', tagInfo.type);
942				tag.setAttribute('id', this.id+'_'+tagInfo.id);
943				
944				div.appendChild(tag);
945				break;
946			case 'checkbox':
947				var items = tagInfo.items;
948				for(var i = 0; i < items.length; i++){
949					var label =  document.createElement('label');
950					var checkbox = document.createElement('input');
951					checkbox.type = 'checkbox';
952					checkbox.id = tagInfo.id+'_'+items[i].id;
953					checkbox.style.marginRight = '10px';
954					checkbox.style.cursor = "pointer";
955					label.innerHTML = items[i].text;
956					label.setAttribute('for', items[i].id);
957					div.appendChild(checkbox);
958					div.appendChild(label);
959				}
960				break;
961			case 'phone':
962				var tag1 = document.createElement('select');
963				tag1.setAttribute('id', this.id+'_'+tagInfo.id+'_1');
964				tag1.style.cursor = "pointer";
965				var options = NS.localNumber();
966				for(var i = 0; i < options.length; i++){
967					var option = document.createElement('option');
968					option.innerHTML = options[i].text;
969					option.value = options[i].id;
970					tag1.appendChild(option);
971				}
972				
973				var tag2 = document.createElement('input');
974				tag2.setAttribute('type', 'number');
975				tag2.setAttribute('id', this.id+'_'+tagInfo.id+'_2');
976				
977				var tag3 = document.createElement('input');
978				tag3.setAttribute('type', 'number');
979				tag3.setAttribute('id', this.id+'_'+tagInfo.id+'_3');
980				
981				var text = document.createElement('input');
982				text.setAttribute('type','text');
983				text.setAttribute('id',this.id+'_'+tagInfo.id);
984				text.style.display = 'none';
985				
986				div.appendChild(tag3);
987				div.appendChild(tag2);
988				div.appendChild(tag1);
989				div.appendChild(text);
990				
991				var inputnum = div.querySelectorAll('input[type=number]');
992				for(var k = 0; k < inputnum.length; k++){
993					inputnum[k].addEventListener('keyup', function(e){
994						e.target.value = e.target.value.replace(/[^0-9]/g, '').substring(0,4);
995						text.value = tag1.value + '-' + tag2.value + '-' + tag3.value;
996					});
997				}
998				tag1.addEventListener('change',function(e){
999					text.value = tag1.value + '-' + tag2.value + '-' + tag3.value;
1000				});
1001				
1002				break;
1003			case 'list':
1004				var tag = document.createElement('select');
1005				tag.style.minWidth = '80px';
1006				tag.style.cursor = "pointer";
1007				tag.setAttribute('id', this.id+'_'+tagInfo.id);
1008				var items = tagInfo.items;
1009				for(var i = 0; i < items.length; i++){
1010					var option = document.createElement('option');
1011					option.value = items[i].id
1012					option.innerHTML = items[i].text;
1013					tag.appendChild(option);
1014				}
1015				
1016				div.appendChild(tag);
1017				break;
1018			case 'radio':
1019				var items = tagInfo.items;
1020				for(var i = items.length - 1; i >= 0; i--){
1021					var input = document.createElement('input');
1022					input.setAttribute('type','radio');
1023					input.name = this.id+'_'+tagInfo.id;
1024					input.id = this.id+'_'+items[i].id;
1025					var label = document.createElement('label');
1026					label.setAttribute('for',this.id+'_'+items[i].id);
1027					label.innerHTML = items[i].text;
1028					div.appendChild(label);
1029					div.appendChild(input);
1030				}
1031				break;
1032			case 'file':
1033				var filebox = document.createElement('div');
1034				filebox.setAttribute('class','filebox');
1035				
1036				var label = document.createElement('label');
1037				label.setAttribute('for', this.id+'_'+tagInfo.id+'_1');
1038				label.innerHTML = '업로드';
1039				
1040				var file = document.createElement('input');
1041				file.setAttribute('type', tagInfo.type);
1042				file.setAttribute('id', this.id+'_'+tagInfo.id+'_1');
1043				
1044				var hiddenFile = document.createElement('input');
1045				hiddenFile.setAttribute('type', 'hidden');
1046				hiddenFile.setAttribute('id', this.id+'_'+tagInfo.id);
1047				
1048				var uploadname = document.createElement('input');
1049				uploadname.setAttribute('class', 'upload-name');
1050				uploadname.value = '파일선택';
1051				
1052				filebox.appendChild(hiddenFile);
1053				filebox.appendChild(file);
1054				filebox.appendChild(uploadname);
1055				filebox.appendChild(label);
1056				
1057				div.appendChild(filebox);
1058				
1059				/*파일 변경 시 이름 넣기*/
1060				file.addEventListener('change', function(event){
1061					var that = this;
1062					var files = this.files;
1063					var names = '';
1064					for(var i = 0; i < files.length; i++){
1065						if(names != '') names += ','
1066						names += files[i].name;
1067					}
1068					uploadname.value = names;
1069					
1070					var reader = new FileReader();
1071					reader.readAsDataURL(event.target.files[0]); 
1072					reader.onload = function() {
1073						var base64data = reader.result;
1074						var id = that.id.replace(/_1/gi,'');
1075						var hiddenFile = document.getElementById(id);
1076						hiddenFile.value = base64data;
1077					}
1078				});
1079				
1080				/*파일명 입력 칸에 값 입력시 파일 초기화*/
1081				uploadname.addEventListener('keyup', function(){
1082					this.value = '';
1083					file.value = '';
1084				});
1085				
1086				break;
1087			default:
1088				console.log(type);
1089		}
1090		if(tagInfo.attr){
1091			var attrs = tagInfo.attr;
1092			var attr = attrs.split(';');
1093			for(var i in attr){
1094				var keyValue = attr[i].split('=');
1095				var tags = div.childNodes;
1096				for(var j = 0; j < tags.length; j++){
1097					tags[j].setAttribute(keyValue[0].trim(), keyValue[1].trim());
1098				}
1099			}
1100		}
1101		if(tagInfo.style){
1102			var tags = div.childNodes;
1103			for(var j = 0; j < tags.length; j++){
1104				tags[j].setAttribute('style', tagInfo.style);
1105			}
1106		}
1107		
1108		var tags = div.childNodes;
1109		for(var j = 0; j < tags.length; j++){
1110			tags[j].addEventListener('change', function(e){
1111				if(that.onChange){
1112					that.onChange.apply(this,[e, tagInfo]);
1113				}
1114			});
1115		}
1116		
1117		return div.children;
1118	},
1119	nsForm : function(option){
1120		if(this.form.hasOwnProperty(option.id)){
1121			console.log('already exist / id : '+option.id);
1122			return false;
1123		}
1124		this.form[option.id] = new this.$nsFormConf(option);
1125		return this.form[option.id];
1126	},
1127	localNumber : function(){
1128		return [
1129			{id:'010',text:'010'},
1130			{id:'011',text:'011'},
1131			{id:'016',text:'016'},
1132			{id:'017',text:'017'},
1133			{id:'019',text:'019'},
1134			{id:'02',text:'02'},
1135			{id:'031',text:'031'},
1136			{id:'032',text:'032'},
1137			{id:'033',text:'033'},
1138			{id:'041',text:'041'},
1139			{id:'042',text:'042'},
1140			{id:'043',text:'043'},
1141			{id:'044',text:'044'},
1142			{id:'051',text:'051'},
1143			{id:'052',text:'052'},
1144			{id:'053',text:'053'},
1145			{id:'054',text:'054'},
1146			{id:'055',text:'055'},
1147			{id:'061',text:'061'},
1148			{id:'062',text:'062'},
1149			{id:'063',text:'063'},
1150			{id:'064',text:'064'}
1151		]
1152	},
1153	comboList : function(data, text){
1154		var combo = [];
1155		for(var i = 0; i < data.length; i++){
1156			if(i == 0){
1157				if(text){
1158					combo.push({id:'', text:text});
1159				}
1160			}
1161			combo.push({id:data[i].cbKey, text:data[i].cbValue});
1162		}
1163		return combo;
1164	},
1165	comboObj : function(data, text){
1166		var combo = {};
1167		for(var i = 0; i < data.length; i++){
1168			combo[data[i].cbKey] = data[i].cbValue;
1169		}
1170		return combo;
1171	},
1172	draggable : function(element){
1173		var isMouseDown = false;
1174	    var mouseX;
1175	    var mouseY;
1176	    var elementX = 0;
1177	    var elementY = 0;
1178
1179	    element.addEventListener('mousedown', onMouseDown);
1180	    function onMouseDown(event) {
1181	        isMouseDown = true;
1182	        elementX = event.clientX;
1183	        elementY = event.clientY;
1184	    }
1185
1186	    element.addEventListener('mouseup', onMouseUp);
1187		function onMouseUp(event) {
1188	        isMouseDown = false;
1189	    }
1190		
1191		element.addEventListener('mousemove', onMouseMove);
1192		function onMouseMove(event) {
1193	    	if (!isMouseDown) return;
1194
1195	    	var deltaX = event.clientX - elementX > 3 ? 3 : event.clientX - elementX;
1196	        var deltaY = event.clientY - elementY > 3 ? 3 : event.clientY - elementY;
1197	        
1198	        elementX = event.clientX;
1199	        elementY = event.clientY;
1200	        
1201	        element.parentNode.style.left = Number(element.parentNode.offsetLeft + deltaX) + 'px';
1202	        element.parentNode.style.top = Number(element.parentNode.offsetTop + deltaY) + 'px';
1203	    }
1204	},
1205	iterator : function(arr){
1206		if(Array.isArray(arr) || arr.length){
1207			return new this.$iterator(arr);
1208		}else{
1209			if(arr.length == 0){
1210				return new this.$iterator(arr);
1211			}
1212			console.log('iterator - 배열이 아닙니다.');
1213			return null;
1214		}
1215	},
1216	destroy : function(type, id){
1217		document.getElementById(id).innerHTML = '';
1218		if(document.getElementById(id).previousSibling.tagName == 'H1'){
1219			document.getElementById(id).previousSibling.parentNode.removeChild(document.getElementById(id).previousSibling);
1220		}
1221		delete this[type][id];
1222	},
1223	/*전처리 후처리를 위해 추가*/
1224	func : function(func){
1225		for(var i = 0; i < arguments.length; i++){
1226			arguments[i].apply(null, arguments[i].arguments);
1227		}
1228	},
1229	dataToHtml : function(rows, selector, func, noDataFunc){
1230		if(!Array.isArray(rows)) rows = [rows];
1231		var searchList = document.querySelector(selector);
1232		var html = '';
1233		searchList.innerHTML = html;
1234		if(rows.length > 0){
1235			var resultIt = NS.iterator(rows);
1236			while(resultIt.hasNext()){
1237				var idx = resultIt.index;
1238				var data = resultIt.next();
1239				data.idx = idx;
1240				html += func(data);
1241			}
1242		}else{
1243			if(noDataFunc) html += noDataFunc();
1244		}
1245		searchList.innerHTML = html.replace(/undefined/gi,'');
1246	},
1247	loading : function(selector, flag){
1248		var parent = document.querySelector(selector);
1249		parent.style.position = 'relative';
1250		if(flag){
1251			var bg = document.createElement('div');
1252			var img = document.createElement('img');
1253			img.src = this.ctx + '/resource/cmmn/images/loading.gif';
1254			img.style.display = 'block';
1255			img.width = '100';
1256			img.height = '100';
1257			img.style.margin = '0 auto';
1258			
1259			bg.classList.add('aljjaBgLayer');
1260			bg.style.display = 'none';
1261			bg.style.position = 'absolute';
1262			bg.style.top = 0;
1263			bg.style.left = 0;
1264			bg.style.width = '100%';
1265			bg.style.height = '100%';
1266			bg.style.backgroundColor = '#000';
1267			bg.style.opacity = 0.5;
1268			bg.style.filter = 'alpha(opacity=50)';
1269			bg.style.zIndex = 9000;
1270			bg.style.display = 'block';
1271			bg.style.textAlign = 'center';
1272			
1273			bg.appendChild(img);
1274			
1275			parent.style.overflow = 'hidden';
1276			parent.appendChild(bg);
1277		}else{
1278			if(document.querySelector('.aljjaBgLayer')){
1279				document.querySelector('.aljjaBgLayer').parentNode.removeChild(document.querySelector('.aljjaBgLayer'));
1280			}
1281		}
1282	},
1283	opaqueMobile : function(selector, flag){
1284		var parent = document.querySelector(selector);
1285		parent.style.position = 'relative';
1286		if(flag){
1287			var bg = document.createElement('div');
1288			bg.classList.add('aljjaBgLayer');
1289			bg.style.display = 'none';
1290			bg.style.position = 'absolute';
1291			bg.style.top = 0;
1292			bg.style.left = 0;
1293			bg.style.width = '100%';
1294			bg.style.height = '100%';
1295			bg.style.backgroundColor = '#000';
1296			bg.style.opacity = 0.5;
1297			bg.style.filter = 'alpha(opacity=50)';
1298			bg.style.zIndex = 5;
1299			bg.style.display = 'block';
1300			bg.style.textAlign = 'center';
1301			
1302			parent.style.overflow = 'hidden';
1303			parent.appendChild(bg);
1304		}else{
1305			if(document.querySelector('.aljjaBgLayer')){
1306				document.querySelector('.aljjaBgLayer').parentNode.removeChild(document.querySelector('.aljjaBgLayer'));
1307			}
1308		}
1309	},
1310	tabOnEvt : function(tab, div){
1311		var tabLis = document.querySelectorAll(tab);
1312		var LisIt = NS.iterator(tabLis);
1313		while(LisIt.hasNext()){
1314			var liIdx = LisIt.index;
1315			var li = LisIt.next();
1316			li.idx = liIdx;
1317			li.addEventListener('click', function(evt){
1318				/* 탭 영역 ON */
1319				var children = NS.iterator(this.parentNode.children);
1320				while(children.hasNext()){
1321					var subLi = children.next();
1322					subLi.classList.remove('on');
1323				}
1324				this.classList.add('on');
1325
1326				/* DIV 영역 ON */
1327				var tabWraps = document.querySelectorAll(div);
1328				var tabWrapsIt = NS.iterator(tabWraps);
1329				while(tabWrapsIt.hasNext()){
1330					var tabWrap = tabWrapsIt.next();
1331					tabWrap.classList.remove('on');
1332				}
1333				tabWraps[this.idx].classList.add('on');
1334			});
1335		}
1336	},
1337	/* jpa_getGridList할 때, rownum으로 정렬이 안됨 -> 임시로 번호 1번부터 정렬(sorting X)*/
1338	sortGridSeq : function(grid, clsNm, totCntId){
1339		let cntPerPage = (typeof totCntId === "undefined") ? 10
1340														   : document.getElementById(totCntId).value;
1341		let curIndex = grid.paging.pageIndex;
1342    	let totIndex = grid.paging.totalPage;
1343    	let totalCnt = document.getElementById(grid.prefix()+"_total_cnt").innerText;
1344    	let modVal = totalCnt % cntPerPage;
1345    	let agRows = document.querySelectorAll("."+clsNm);
1346    	
1347    	let k = 0;
1348    	if(grid.selection.type !== "none") k++;
1349    	for(let i=0, n=agRows.length; i<n; i++){
1350			agRows[i].childNodes[k].innerText = (totIndex==curIndex) ? modVal - i 
1351																	 : (totIndex-curIndex)*cntPerPage-i+modVal ;
1352    	}
1353	},
1354	onClickIncList : function(gg4Id, y, x, info, inciType){
1355		// 팝업생성
1356		var msgTp = {
1357			WOK : "공사",
1358			MSG : "행사"
1359		}
1360
1361		var html = '';
1362//		var kname1 = "["+msgTp[inciType]+"]<br>";
1363		var kname4 = typeof info !== "undefined" ? info.replace("\n","</br>") : "-";
1364		var kname = kname4;
1365			html += '<ul>';
1366				html += '<li>['+msgTp[inciType]+']<br> '+kname+'</li>';
1367			html += '</ul>';
1368			
1369		document.getElementById('gridPop').innerHTML = html;
1370	
1371		var tt = mainPg.setTooltip('gridPop');
1372		tt.setPosition(new ol.geom.Point(mainApp.map.transform([x, y])).getCoordinates());
1373		tt.setVisible(true);
1374
1375		// 센터 이동 && 지도보기
1376		mainApp.map.setCenter([x, y]);
1377		mainApp.map.setZoom(13);
1378		
1379		// 모바일-> 리스트 클릭 시 지도보기 바로
1380		if(AF.mobileChk()){
1381			let toggleMapThis = document.querySelectorAll('.vsbhd')[0].firstChild;
1382			mainPg.toggleMap(toggleMapThis);
1383		}
1384	}
1385}))();

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.