diff --git a/sapl-frontend/package.json b/sapl-frontend/package.json index 14afa817a..528661578 100644 --- a/sapl-frontend/package.json +++ b/sapl-frontend/package.json @@ -12,6 +12,7 @@ "bootstrap-material-design": "^4.1.1", "dotenv": "^6.2.0", "jquery": "^3.3.1", + "jquery-mask-plugin": "^1.14.15", "jquery-ui": "^1.12.1", "popper.js": "^1.14.6", "sapl-oficial-theme": "../../sapl-oficial-theme", diff --git a/sapl-frontend/src/global/functions.js b/sapl-frontend/src/global/functions.js index 2116a50b2..63f5d6c4d 100644 --- a/sapl-frontend/src/global/functions.js +++ b/sapl-frontend/src/global/functions.js @@ -1,9 +1,11 @@ import jQuery from "jquery"; - +import mask from "jquery-mask-plugin"; import dialog from "jquery-ui/ui/widgets/dialog"; import "jquery-ui/themes/base/all.css" jQuery.dialog = dialog; +jQuery.mask = mask; +let $ = jQuery; window.getCookie = function(name) { var cookieValue = null; @@ -123,4 +125,16 @@ window.autorModal = function() { get_nome_autor("#id_autoria__autor");*/ }; -window.autorModal(); + +window.refreshMask = function () { + $('.telefone').mask("(99) 9999-9999", {placeholder:"(__) ____ -____"}); + $('.cpf').mask("000.000.000-00", {placeholder:"___.___.___-__"}); + $('.cep').mask("00000-000", {placeholder:"_____-___"}); + $('.rg').mask("0.000.000", {placeholder:"_.___.___"}); + $('.titulo_eleitor').mask("0000.0000.0000.0000", {placeholder:"____.____.____.____"}); + $('.dateinput').mask('00/00/0000', {placeholder:"__/__/____"}); + $('.hora, input[name=hora_inicio], input[name=hora_fim]').mask("00:00", {placeholder:"hh:mm"}); + $('.hora_hms').mask("00:00:00", {placeholder:"hh:mm:ss"}); + $('.timeinput').mask("00:00:00", {placeholder:"hh:mm:ss"}); + $('.cronometro').mask("00:00:00", {placeholder:"hh:mm:ss"}); +} diff --git a/sapl-frontend/src/global/main.js b/sapl-frontend/src/global/main.js index efa968597..8ad727838 100644 --- a/sapl-frontend/src/global/main.js +++ b/sapl-frontend/src/global/main.js @@ -2,3 +2,7 @@ import jQuery from "jquery"; import "./functions"; window.$ = window.jQuery = jQuery; + + +window.autorModal(); +window.refreshMask();