$(document).ready(function(){ // Style PHP ucWords in JavaScript $(".ucWordsJs").keyup(function(){ var txt = $(this).val(); $(this).val(txt.replace(/^(.)|\s(.)/g, function($1){ return $1.toUpperCase( ); })); }); // Tooltip bootstrap $('[data-toggle="tooltip"]').tooltip({ html : true }); $('[data-toggle="popover"]').popover({ html : true }); // Masks Default $(".maskTelefone").mask("(00)0000-00000"); $(".maskCeps").mask("00000-000", {placeholder: "_____-___"}); $(".maskCepCart").mask("00000-000"); $(".maskData").mask("00/00/0000"); $(".maskHora").mask("00:00", {placeholder: "__:__"}); $(".maskMoney").mask('000.000.000.000.000,00', {reverse: true, placeholder: "0,00"}); }); function sweetRedir(titulo, msg, tipo, url, btnText) { if(tipo == "error") { var btnColor = "#F27474"; } else if(tipo == "success") { var btnColor = "#A5DC86"; } else if(tipo == "warning") { var btnColor = "#F8C086"; } else if(tipo == "info") { var btnColor = "#C9DAE1"; } swal({ title : titulo, text : msg, type : tipo, confirmButtonColor : btnColor, confirmButtonText : btnText, }, function() { location.href= url; }); } function sweetAlert(titulo, msg, tipo, btnText) { if(tipo == "error") { var btnColor = "#F27474"; } else if(tipo == "success") { var btnColor = "#A5DC86"; } else if(tipo == "warning") { var btnColor = "#F8C086"; } else if(tipo == "info") { var btnColor = "#C9DAE1"; } if(btnText != "") { var textBtn = btnText; } else { var textBtn = "Voltar"; } swal({ title : titulo, html : msg, type : tipo, confirmButtonColor : btnColor, confirmButtonText : textBtn, }, function(){ swal.close; }); } // All letters to uppercase function upCase(lstr) { var str = lstr.value; lstr.value = str.toUpperCase(); } // All letters to lowcase function lowCase(lstr) { var str = lstr.value; lstr.value = str.toLowerCase(); } function upCase(lstr) { var str = lstr.value; lstr.value = str.toUpperCase(); } // Dependency bootbox.js function confirmBox(msg, destino) { bootbox.confirm(msg, function(result) { if(result == true) { location.href = destino; return true; } }); } // Dependency bootbox.js function alertBox(msg) { bootbox.alert(msg); }