forked from Coded/SIPRP
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							181 lines
						
					
					
						
							6.3 KiB
						
					
					
				
			
		
		
	
	
							181 lines
						
					
					
						
							6.3 KiB
						
					
					
				|  evoapp.factory('plugins', function($rootScope) {
 | |
| 
 | |
|     var me = this;
 | |
| 
 | |
| 	$.extend({
 | |
| 
 | |
| 		scrollToTop: function() {
 | |
| 
 | |
| 			var _isScrolling = false;
 | |
| 
 | |
| 			// Append Button
 | |
| 			$("body").append($("<a />")
 | |
| 							.addClass("scroll-to-top")
 | |
| 							.attr({
 | |
| 								"href": "#",
 | |
| 								"id": "scrollToTop"
 | |
| 							})
 | |
| 							.append(
 | |
| 								$("<i />")
 | |
| 									.addClass("glyphicon glyphicon-chevron-up icon-white")
 | |
| 							));
 | |
| 
 | |
| 			$("#scrollToTop").click(function(e) {
 | |
| 
 | |
| 				e.preventDefault();
 | |
| 				$("body, html").animate({scrollTop : 0}, 500);
 | |
| 				return false;
 | |
| 
 | |
| 			});
 | |
| 
 | |
| 			// Show/Hide Button on Window Scroll event.
 | |
| 			$(window).scroll(function() {
 | |
| 
 | |
| 				if(!_isScrolling) {
 | |
| 
 | |
| 					_isScrolling = true;
 | |
| 
 | |
| 					if($(window).scrollTop() > 150) {
 | |
| 
 | |
| 						$("#scrollToTop").stop(true, true).addClass("visible");
 | |
| 						_isScrolling = false;
 | |
| 
 | |
| 					} else {
 | |
| 
 | |
| 						$("#scrollToTop").stop(true, true).removeClass("visible");
 | |
| 						_isScrolling = false;
 | |
| 
 | |
| 					}
 | |
| 
 | |
| 				}
 | |
| 
 | |
| 			});
 | |
|         }
 | |
|     });
 | |
| 
 | |
|     var setDefaults = function(){
 | |
| 
 | |
| 
 | |
|     };
 | |
| 
 | |
|     // Inject in the html of the loaded module, all the bootstrap plugin Behaviour
 | |
|     var setBootstrap = function(){
 | |
| 
 | |
|         window.ParsleyConfig = $.extend( true, {}, window.ParsleyConfig, {
 | |
|             messages: {
 | |
|                 // parsley //////////////////////////////////////
 | |
|                 defaultMessage: "Este valor parece estar inválido."
 | |
|                 , type: {
 | |
|                     email:      "Este valor deve ser um e-mail válido."
 | |
|                 , url:        "Este valor deve ser uma URL válida."
 | |
|                 , urlstrict:  "Este valor deve ser uma URL válida."
 | |
|                 , number:     "Este valor deve ser um número válido."
 | |
|                 , digits:     "Este valor deve ser um dígito válido."
 | |
|                 , dateIso:    "Este valor deve ser uma data válida (YYYY-MM-DD)."
 | |
|                 , alphanum:   "Este valor deve ser alfanumérico."
 | |
|                 , phone:      "Este valor deve ser um número telefone válido."
 | |
|                 }
 | |
|                 , notnull:        "Este valor não deve ser nulo."
 | |
|                 , notblank:       "Este valor não deve ser branco."
 | |
|                 , required:       "Este valor é obrigatório."
 | |
|                 , regexp:         "Este valor parece estar inválido."
 | |
|                 , min:            "Este valor deve ser maior ou igual a %s."
 | |
|                 , max:            "Este valor deve ser menor ou igual a %s."
 | |
|                 , range:          "Este valor deve estar entre %s e %s."
 | |
|                 , minlength:      "Este valor é muito pequeno. Ele deve ter %s caracteres ou mais."
 | |
|                 , maxlength:      "Este valor é muito grande. Ele deve ter %s caracteres ou menos."
 | |
|                 , rangelength:    "O tamanho deste valor é inválido. Ele deve possuir entre %s e %s caracteres."
 | |
|                 , mincheck:       "Você deve selecionar pelo menos %s opções."
 | |
|                 , maxcheck:       "Você deve selecionar %s opções ou menos."
 | |
|                 , rangecheck:     "Você deve selecionar entre %s e %s opções."
 | |
|                 , equalto:        "Este valor deve ser o mesmo."
 | |
|                 // parsley.extend ///////////////////////////////
 | |
|                 , minwords:       "Este valor deve possuir no mínimo %s palavras."
 | |
|                 , maxwords:       "Este valor deve possuir no máximo %s palavras."
 | |
|                 , rangewords:     "Este valor deve possuir entre %s e %s palavras."
 | |
|                 , greaterthan:    "Este valor deve ser maior que %s."
 | |
|                 , lessthan:       "Este valor deve ser menor que %s."
 | |
|                 , beforedate:     "Esta data deve ser anterior a %s."
 | |
|                 , afterdate:      "Esta data deve ser posterior a %s."
 | |
|             }
 | |
|         });
 | |
| 
 | |
|         $.datepicker.regional['pt'] = {
 | |
| 		    closeText: 'Fechar',
 | |
| 		    prevText: '<Anterior',
 | |
| 		    nextText: 'Seguinte',
 | |
| 		    currentText: 'Hoje',
 | |
| 		    monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho',
 | |
| 		    'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
 | |
| 		    monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun',
 | |
| 		    'Jul','Ago','Set','Out','Nov','Dez'],
 | |
| 		    dayNames: ['Domingo','Segunda-feira','Terça-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sábado'],
 | |
| 		    dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'],
 | |
| 		    dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'],
 | |
| 		    weekHeader: 'Sem',
 | |
| 		    dateFormat: 'dd/mm/yy',
 | |
| 		    firstDay: 0,
 | |
| 		    isRTL: false,
 | |
| 		    showMonthAfterYear: false,
 | |
| 		    yearSuffix: ''
 | |
|         };
 | |
| 	    $.datepicker.setDefaults($.datepicker.regional['pt']);
 | |
| 
 | |
| 
 | |
|         ////Add hover support for touch devices
 | |
|         //$('.btn').bind('touchstart', function() {
 | |
|         //    $(this).addClass('hover');
 | |
|         //}).bind('touchend', function() {
 | |
|         //    $(this).removeClass('hover');
 | |
|         //});
 | |
| 
 | |
|         //Activate tooltips
 | |
|         $("[data-toggle='tooltip']").tooltip();
 | |
| 
 | |
|         ///*     
 | |
|         // * Add collapse and remove events to boxes
 | |
|         // */
 | |
|         //$("[data-widget='collapse']").click(function() {
 | |
|         //    //Find the box parent        
 | |
|         //    var box = $(this).parents(".box").first();
 | |
|         //    //Find the body and the footer
 | |
|         //    var bf = box.find(".box-body, .box-footer");
 | |
|         //    if (!box.hasClass("collapsed-box")) {
 | |
|         //        box.addClass("collapsed-box");
 | |
|         //        bf.slideUp();
 | |
|         //    } else {
 | |
|         //        box.removeClass("collapsed-box");
 | |
|         //        bf.slideDown();
 | |
|         //    }
 | |
|         //});
 | |
| 
 | |
|         ///*
 | |
|         // * INITIALIZE BUTTON TOGGLE
 | |
|         // * ------------------------
 | |
|         // */
 | |
|         //$('.btn-group[data-toggle="btn-toggle"]').each(function() {
 | |
| 
 | |
|         //    var group = $(this);
 | |
| 
 | |
|         //    $(this).find(".btn").click(function(e) {
 | |
|         //        group.find(".btn.active").removeClass("active");
 | |
|         //        $(this).addClass("active");
 | |
|         //        e.preventDefault();
 | |
|         //    });
 | |
|         //});
 | |
| 
 | |
|         //$("[data-widget='remove']").click(function() {
 | |
|         //    //Find the box parent        
 | |
|         //    var box = $(this).parents(".box").first();
 | |
|         //    box.slideUp();
 | |
|         //});
 | |
| 
 | |
| 		// Scroll to Top Button.
 | |
| 		$.scrollToTop();
 | |
|     };
 | |
| 
 | |
|     return {
 | |
|         setDefaults: setDefaults,
 | |
|         setBootstrap: setBootstrap
 | |
|     };
 | |
| }); |