PageSourceSearch

https://ecoprobm.com/_res/plani/custom.prototype.js?q=b7d9b7781952f169

js ecoprobm.com collected 2026-10-08 01:54:54 UTC 17,396 bytes, 734 lines download raw bytes

1/**
2 * Plani javascript Helper
3 *
4 * jquery 3.1.0
5 *
6 * @package	Plani javascript Helper
7 * @author	kim seung beom
8 * @copyright	Copyright (c) 2016, Plani, Inc.
9 * @link	http://plani.co.kr
10 * @since	 Version 2.0
11 * @filesource
12 */
13 $.fn.hook = function(){
14	$('[helper]', $(this)).each
15	(
16		function(){
17			var target =$(this),
18				call = $(this).attr('helper'),
19				extend_func_name = 'helper_%s'.sprintf(call);						
20				
21			try {
22				target.func=$.fn[extend_func_name];
23				target.func();
24			}
25			catch (e){
26				console.log('error function : ' + extend_func_name);
27				console.log(e);
28			}
29		}
30	);
31
32	$('[class^=pi-form-]', $(this)).each
33	(
34		function(){
35			var target =$(this),
36				class_split = $(this).attr('class').split(' ');
37
38			for( var i=0; i<class_split.length; i++ ){
39				if( class_split[i].indexOf('pi-form-') == 0 ){
40					var call=class_split[i].replace('pi-form-', 'ui_').replace('-', '_'),
41						extend_func_name = call;
42
43					try {
44						target.func=$.fn[extend_func_name];
45						target.func();
46					}
47					catch (e){
48						console.log('undefined function : ' + extend_func_name);
49					}
50				}
51			}
52		}
53	)
54}
55
56$.fn.keyenter = function( event ){
57	$(this).on('keydown', function( e ){
58		if(e.which == 13 ) { 
59			if( typeof event == 'function' ) {
60				event();
61			} else if( typeof event == 'string' ) {
62				$(this).trigger(event);
63			}else {
64				e.preventDefault();			
65			}
66
67			return false;
68		}
69	});
70
71	return $(this);
72}
73
74$.fn.ui_select = function(){
75	$(this).each
76	(
77		function(){	
78			var obj = $(this),
79				multiple = $(this).prop('multiple'),
80				width = obj.width(),
81				select = $('<article class=\'pi-form-select-wrap\'><div class=\'opt-btn\' tabindex=\'0\'><span></span><i class=\'fa fa-chevron-down opt-arrow\' aria-hidden=\'true\'></i></div></article>'),
82				input = $('<input />', { 'type' : 'text', 'placeholder' : __('검색') }),
83				opt = $('<ul class=\'pi-form-select-options\'></ul>'),
84				update = function(){
85					if( multiple == true ){
86						var length = $(':checked', opt).length,
87							first = $(':checked:eq(0)', opt).closest('label').text();						
88
89						$('span', select).html( length == 1 ? '<span class="block">%s</span> %s '.sprintf(first, __('선택됨')) : ( length > 1 ? '<span class="block">%s</span> %s %s %s'.sprintf(first, __('외'), length-1, __('선택됨6')) : length + __('선택됨') ) );
90					}else {
91						$('span', select).html( $("option:selected", obj).length > 0? $("option:selected", obj).text() : $("option:eq(0)", obj).text() );
92					}
93				}
94
95			obj.find('option').each
96			(
97				function(){
98					var html=multiple==true && this.value !=''? '<label><input type=checkbox ' +(this.selected == true ? 'checked' : '')+ ' value="' +this.value+ '" />' +this.text+ '</label>' : (multiple==true && this.value == '' ? '<a class="opt-all choice">[' + __('전체선택') + ']</a> <a class="opt-all cancel">[' + __('전체선택취소') + ']</a>' : this.text);
99					if( this.value != '' || multiple==true ) {
100						opt.append($('<li />', { 'tabindex' : 0, 'aix_value' : this.value, 'class' : multiple==true && this.value == ''  ? 'all' : '' }).html(html))
101					}
102				}
103			);
104
105			select.css('min-width', width+13)
106			if( obj.find('option').length > 6 ) {
107				select.append(input);
108				opt.css('top', 60)
109			}
110			select.append(opt);
111
112			obj.hide().after(select);
113
114			update();
115
116			$('.opt-btn', select).on
117			(
118				'click', function(){
119					$('.pi-form-select-wrap').css('z-index',  10);
120					select.css('z-index',  50);
121					$('input[type=text], ul', select).toggle();
122				}
123			)
124			.keyenter('click');
125
126			$('li', opt).on
127			(
128				'click', function( e ){
129					var val = $(this).attr('aix_value');
130
131					console.log(val);
132
133					if( multiple == true ){
134						if( val == '' ) {
135							return false;
136						}
137						$('option[value=' +val+ ']', obj).prop('selected', $(':checkbox', this).prop('checked'));
138					}else{
139						$('option[value=' +val+ ']', obj).prop('selected', true);
140						$('input[type=text], ul', select).toggle();
141					}
142					update();
143					obj.trigger('change');
144				}
145			)
146			.keyenter('click');
147
148			$('.choice', opt).on
149			(
150				'click', function(){
151					$('input[type=checkbox]', opt).prop('checked', true).closest('li').trigger('click')
152					update();
153				}
154			);
155			$('.cancel', opt).on
156			(
157				'click', function(){
158					$('input[type=checkbox]', opt).prop('checked', false).closest('li').trigger('click')
159					update();
160				}
161			);
162
163			input.
164			keyenter()
165			.on
166			(
167				'keyup', function(){	
168					var lis = $('li', opt),
169						match = 0,
170						val = this.value;
171
172					$('.opt-empty', opt).remove();
173
174					if(val == ''){
175						lis.show();
176					}else{
177						lis.each
178						(
179							function(){
180								if( $(this).text().indexOf(val) > -1 ){
181									$(this).show();
182									match++;
183								}else{
184									$(this).hide();
185								}
186							}
187						);
188
189						if( match == 0 ){
190							opt.append('<li class=\'opt-empty\'>
190' +__('검색 결과가 없습니다')+ '</li>');
191						}
192					}
193				}
194			);
195
196			$.window.on
197			(
198				'click', function(e){
199					if( $(e.target).closest(select).length == 0 ){
200						$('input[type=text], ul', select).hide();
201					}
202				}
203			);
204		}
205	)
206}
207
208$.fn.ui_checkbox = function(){
209	$(this).each
210	(
211		function(){	
212			var obj=$(this);
213			obj.after('<i></i>').parent().addClass('pi-form-label-box checkbox')
214		}
215	);
216}
217
218$.fn.ui_radio = function(){
219	var obj = $(this);
220
221	obj.ui_checkbox();
222}
223
224$.fn.ui_switch = function(){
225	$(this).each
226	(
227		function(){	
228			var obj=$(this);
229
230			obj.after('<i class=\'xi-switch-off pi-form-switch-btn\' aria-hidden=\'true\'></i>');
231			obj.on
232			(
233				'change', function(){
234					if( this.checked == true )
235						obj.next().removeClass('xi-switch-off').addClass('xi-switch-on');
236					else
237						obj.next().removeClass('xi-switch-on').addClass('xi-switch-off');
238				}
239			)
240			.trigger('change')
241		}
242	);
243}
244
245$.fn.ui_switch_classic = function(){
246	$(this).each
247	(
248		function(){	
249			var obj=$(this),
250				span=obj.closest('label').find('span'),
251				controll=$('<ul />', {'class' : 'pi-form-switch-wrap'}).html("<span class='block' tabindex='0'></span><li class='sw on'>YES</li><li class='sw off'>NO</li><li class='txt'>" +span.text()+ "</li>"),
252				block = $('.block', controll);
253			
254			span.remove();
255			obj.after(controll);
256			obj.on
257			(
258				'change', function(){
259					block.stop().animate({'left' : this.checked == true? 40 : 0}, 'fast');
260				}
261			)
262			.trigger('change');
263
264			block.keyenter(function(){
265				obj.trigger('click');
266			});						
267		}
268	);
269}
270
271$.fn.ui_swap = function( params, callback ){
272	var params = $.extend
273	(
274		{ 'Yes' : ['TEXT', "RGB16"], 'No' : ['TEXT', "RGB16"] }, params
275	);
276
277	$(this).each
278	(
279		function(){
280			var obj=$(this),
281				text=obj.text().trim(),
282				icons=typeof params[text] != 'undefined' ? params[text] : ['<i class=\'fa fa-question-circle-o\'></i>', '#444'];
283
284			obj.attr('value', text).css('color', icons[1]).html(icons[0]);
285			obj.on(
286				'click', function(){
287					if( typeof this.href != 'undefined' ){
288						var form=$(this).closest('form');
289
290						obj.html('<i class=\'fa fa-spinner fa-spin font20\'></i>');
291						$.request
292						(
293							{ 'url' : this.href, param : form.serialize() + '&value=' + obj.attr('value') }, 
294							function(text) {
295								icons=typeof params[text] != 'undefined' ? params[text] : ['<i class=\'fa fa-question-circle-o\'></i>', '#444'];
296								obj.attr('value', text).css('color', icons[1]).html(icons[0]);
297
298								if( typeof callback == 'function' ){
299									callback(obj, text);
300								}
301							}
302						);						
303					}
304
305					return false;
306				}
307			);
308		}
309	);
310}
311
312$.fn.helper_datepicker = function( params ){
313	var params =$.extend
314	(
315		{ dateFormat : 'yy-mm-dd', changeMonth: true, changeYear: true, regional : 'ko', minDate : null, maxDate : null, yearRange : 'c-60:c+10' }, params
316	);
317
318	$(this).each
319	(
320		function(){
321			var obj = $(this), 
322				button = $('<button />', {'type' : 'button', 'class' : 'pi-btn pi-icon month right-import'} ); 
323			
324			try {
325				if( obj.hasClass('hasDatepicker') == true ) {
326					obj.removeClass('hasDatepicker').removeAttr('id');
327				}else{
328					button.insertBefore(obj).on
329					(
330						'click', function(){
331							obj.focus();
332						}
333					);				
334				}
335
336				obj.datepicker(params);
337				obj.addClass('right-import-input').on
338				(
339					'change', function(){
340						if( this.value.isdate() == false && this.value !='' ){
341							obj.attr('placeholder', 'Not the date format.').val('');
342						}else{
343							obj.attr('placeholder', '');
344						}
345					}
346				)
347			}catch(e) {
348			}		
349		}
350	)
351}
352
353// $.fn.helper_datepicker_classic = function( params ){
354// 	var params =$.extend
355// 	(
356// 		{ dateFormat : 'yy-mm-dd',  timeFormat: 'HH:mm:ss', changeMonth: true, changeYear: true, regional : 'ko', minDate : null, maxDate : null, yearRange : 'c-60:c+10' }, params
357// 	);
358// 
359// 	$(this).each
360// 	(
361// 		function(){
362// 			var obj = $(this);
363// 			if( obj.hasClass('hasDatepicker') == true ) {
364// 				obj.removeClass('hasDatepicker').removeAttr('id')
365// 			}else{
366// 				obj.after('<span class="pi-icon month pi-helper-datepicker-icon hidden2"></span>')
367// 			}
368// 
369// 			if( this.value.indexOf(':') > -1 ){
370// 				obj.datetimepicker(
371// 					params
372// 				);
373// 			}else {
374// 				obj.datepicker(
375// 					params
376// 				);			
377// 			}
378// 
379// 			obj.on
380// 			(
381// 				'blur', function(){
382// 					if( this.value.isdate() == false && this.value !='' ){
383// 						obj.attr('placeholder', 'Not the date format.').val('');
384// 					}else{
385// 						obj.attr('placeholder', '');
386// 					}
387// 				}
388// 			)
389// 
390// 		}
391// 	)
392// }
393
394$.fn.helper_datepicker_classic = function( params ){
395	var params = $.extend({
396		dateFormat : 'yy-mm-dd',
397		timeFormat: 'HH:mm:ss',
398		changeMonth: true,
399		changeYear: true,
400		regional : 'ko',
401		minDate : null,
402		maxDate : null,
403		yearRange : 'c-60:c+10'
404	}, params);
405
406	$(this).each(function(){
407		var obj = $(this);
408		if( obj.hasClass('hasDatepicker') == true ) {
409			obj.removeClass('hasDatepicker').removeAttr('id');
410		} else {
411			obj.after('<span class="pi-icon month pi-helper-datepicker-icon hidden2"></span>');
412		}
413
414		// 조건문 없이 항상 datetimepicker를 사용
415		obj.datetimepicker(params);
416
417		obj.on('blur', function(){
418			if( this.value.isdate() == false && this.value !='' ){
419				obj.attr('placeholder', 'Not the date format.').val('');
420			} else {
421				obj.attr('placeholder', '');
422			}
423		});
424	});
425}
426
427
428$.fn.helper_colorpicker = function(){
429	if( $('#colorpicker').length == 0 ){
430		color_layer = $('<span />', { 'class' : 'pi-helper-colorpicker', 'id' : 'colorpicker' }).appendTo('body');
431	}else{
432		color_layer = $('#colorpicker');
433	}
434	$(this).each
435	(
436		function(){	
437			var obj=$(this);
438
439			obj.addClass('pi-helper-colorpicker-input cursor-hand')
440			.attr('readonly', true)
441			.css({'background-color' : obj.val()})
442			.on
443			(
444				'click', function(){
445					var offset = obj.offset(), 
446						width=obj.innerWidth(), 
447						height=obj.outerHeight(),
448						colorpicker=$.farbtastic('#colorpicker');
449
450					colorpicker.linkTo(obj[0]);
451					colorpicker.linkTo(function(color){
452						var font_color=colorpicker.hsl[2]>0.5 ? '#000000' : '#ffffff';
453						obj.val(color).css({'background-color' : color, 'color' : font_color});
454					});
455
456					$('.sl-marker', color_layer).one
457					(
458						'mouseup', function(){
459							color_layer.fadeOut();
460						}
461					);
462
463					color_layer.css({'left' :(offset.left+width+20), 'top' : (offset.top-80)}).fadeIn();
464				}
465			);
466		}
467	);
468}
469
470$.fn.helper_tooltip = function( params ){
471	var params =$.extend
472	(
473		{ color : '', message : '', open : false, form_element : false }, params
474	);
475
476	$(this).each
477	(
478		function(){
479			var obj=$(this),
480				message = params.message || obj.attr('title'),
481				tip_layer = this.tip_layer || $('<span />', { 'class' : 'pi-helper-tooltip %s'.sprintf(params.color) }).html('<div class="triangle"></div><div class="message"></div>').appendTo('body')
482
483				this.tip_layer = tip_layer;
484
485				obj.addClass('cursor-hand')
486				.on
487				(
488					'mouseenter focus focus_event',  function(e) {
489						var offset = obj.offset(), 
490							width=obj.innerWidth(), 
491							height=obj.outerHeight();
492
493						if( typeof obj.data('tooltip-title') == 'undefined' ) {
494							obj.data('tooltip-title', message);
495							obj.removeAttr('title');
496						}
497
498						if( obj.data('tooltip-title') != '' ) {
499							var left=offset.left;
500							var top=offset.top;	
501
502							$('.message', tip_layer).html(obj.data('tooltip-title'));
503							tip_layer.css({'left' : left - (tip_layer.width() / 2) + (width / 2), 'top' : top+( (tip_layer.height() + 10)*-1 ) }).fadeIn();
504						}
505					}
506				)
507				.on
508				(
509					'mouseleave blur', function(e) {
510						tip_layer.stop().hide();
511					}
512				);
513
514				if( params.form_element == true ) {
515					obj.off('mouseenter mouseleave');
516				}
517
518				if( params.open == true ) {
519					obj.trigger('focus_event');
520				}
521		}
522	);
523}
524
525$.fn.helper_number = function( params ){
526	var params =$.extend
527	(
528		{ min : '0', max : 1000000, comma : false }, params
529	);
530
531	$(this).each
532	(
533		function(){
534			var obj = $(this);
535
536			obj.css('ime-mode', 'disabled')
537			.on
538			(
539				'keydown', function(e){
540					var keycode=e.keyCode;
541					// ctrl + v
542					if( e.ctrlKey == true && keycode == 86 )
543						return true;
544
545					// skip
546					if( new String('/8/9/16/35/36/37/39/46/').split('/'+keycode.toString()+'/').length == 2 )
547						return true;
548
549					// number1
550					if( keycode >= 48 && keycode <= 57 )
551						return true;
552
553					// number2
554					if( keycode >= 96 && keycode <= 105 )
555						return true;
556
557
558					return false;
559				}
560			)
561			.on
562			(
563				'keyup', function(){
564					var num_val = this.value.split(',').join('');
565						val = parseInt(num_val);
566
567					if( isNaN(num_val) == true )
568						num_val = 0;
569
570					if( val < params.min )
571						num_val = params.min;
572
573					if( val > params.max )
574						num_val = params.max;
575
576					if( params.comma == true )
577						num_val = num_val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
578
579					this.value = num_val;
580				}				
581			);
582		}
583	)
584}
585
586$.fn.helper_number_comma = function( params ){
587	var params =$.extend
588	(
589		{ max : 10000000000, comma : true }, params
590	);
591	$(this).helper_number(params);
592}
593
594$.fn.helper_clone = function( params ){
595	var params =$.extend
596	(
597		{ }, params
598	);
599
600	$(this).each
601	(
602		function(){
603			var obj=$(this),
604				lis=$('li', obj)
605
606			obj
607			.addClass('pi-helper-clone')
608			.sortable
609			(
610				{
611					forcePlaceholderSize	: true,
612					placeholder	: 'placeholder',
613					items : 'li',
614					opacity: .8,
615//					revert: 250,
616					tabSize: 25,
617					axis: 'y',
618					start	 : function (e, ui) {
619						$(ui.helper).addClass('draging');
620					},
621					stop	: function (e, ui) {	
622						$('.draging').removeClass('draging');
623					}
624				}
625			);
626
627			lis.append('<a href="#" class="plus prefix-input"><i class="fa fa-plus"></i></a><a href="#" class="minus prefix-input"><i class="fa fa-minus"></i></a>');
628			obj.delegate
629			(
630				'.plus', 'click', function(){
631					var li = $(this).closest('li'),
632						copy = li.clone();
633
634					copy.attr('class', '').find('input[type=text], input[type=hidden], textarea, select').attr('readonly', false).val('');
635					copy.hook();
636					li.after(copy.hide().fadeIn());
637
638					return false;
639				}
640			)
641			.delegate
642			(
643				'.minus', 'click', function(){
644					var li = $(this).closest('li');
645
646					if( confirm(__('삭제 하시겠습니까?')) == true ){
647						li.fadeOut(function(){
648							$(this).remove();
649						});
650					}
651
652					return false;
653				}
654			);			
655		}
656	);
657}
658
659$.fn.helper_disabled = function( params ){
660	var params =$.extend
661	(
662		{ target : null }, params
663	);	
664
665	$(this).each
666	(
667		function(){
668			var obj = $(this), 
669				prev = params.target || ( obj.parent().get(0).tagName == 'LABEL' ?  obj.parent().prev() : obj.prev() );
670
671			obj.on
672			(
673				'click', function(){
674					prev.prop('disabled', !this.checked).focus();
675				}
676			)
677		}
678	)
679}	
680	
681
682$.fn.helper_ajax = function( params ){
683	var params =$.extend
684	(
685		{ 
686			url : null, 
687			callback : function(target, data) {
688				var container=target.next().hasClass('pi-helper-ajax-result') == true ? target.next() : $('<span />', {'class' : 'pi-helper-ajax-result'}).insertAfter(target);
689
690				container.html(data);
691			} 
692		}, 
693		params
694	);
695
696	$(this).each
697	(
698		function(){
699			var obj = $(this), 
700				url = params.url || obj.attr('helper-url'),
701				form = obj.closest('form');
702
703			obj.on
704			(
705				'keyup', function(){
706					$.request
707					(
708						{ 'url' : url, param : form.serialize() }, 
709						function(data) {
710							params.callback(obj, data);
711						}
712					);
713				}
714			);
715		}
716	)
717}
718	
719$.fn.helper_submit = function(){
720	$(this).each
721	(
722		function(){
723			var obj = $(this), 
724				form = obj.closest('form');
725
726			obj.on
727			(
728				'change', function(){
729					form.submit();
730				}
731			)
732		}
733	)
734}

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.