
function mascaras() {
  $(".data").mask("00/00/0000", {
    placeholder: "00/00/0000",
    selectOnFocus: true,
    clearIfNotMatch: true,
  });
  $(".time").mask("00:00:00", {
    placeholder: "00:00:00",
    selectOnFocus: true,
    clearIfNotMatch: true,
  });
  $(".data_hora").mask("00/00/0000 00:00", {
    placeholder: "00/00/0000 00:00",
    selectOnFocus: true,
    clearIfNotMatch: true,
  });
  $(".cep").mask("00000-000", {
    placeholder: "00000-000",
    selectOnFocus: true,
    clearIfNotMatch: true,
  });
  $(".serial").mask("SSSSS-0000-000000", { selectOnFocus: true });
  $(".numero").mask("##0", { reverse: true, selectOnFocus: true });
  $(".cpf").mask(
    "000.000.000-00",
    { placeholder: "000.000.000-00" },
    { reverse: true, selectOnFocus: true, clearIfNotMatch: true }
  );
  $(".inscricao_estadual").mask(
    "00.000.000-0",
    { placeholder: "00.000.000-0" },
    { reverse: true, selectOnFocus: true, clearIfNotMatch: true }
  );
  $(".cnpj").mask(
    "00.000.000/0000-00",
    { placeholder: "00.000.000/0000-00" },
    { reverse: true, selectOnFocus: true, clearIfNotMatch: true }
  );
  $(".valor").mask("000.000.000.000.000,00", {
    placeholder: "R$ 000.000,00",
    reverse: true,
    selectOnFocus: true,
  });
  $(".valor2").mask("#.##0,00", { reverse: true, selectOnFocus: true });
  $(".porcento").mask("##0.00", {
    reverse: true,
    selectOnFocus: true,
    placeholder: "100.00",
  });
  $(".ipv4").mask("099.099.099.099", {
    selectOnFocus: true,
    clearIfNotMatch: true,
  });

  var PhoneMask = function (val) {
    return val.replace(/\D/g, "").length === 11
      ? "(00) 00000-0000"
      : "(00) 0000-00009";
  };
  var PhoneMaskOptions = {
    onKeyPress: function (val, e, field, options) {
      field.mask(PhoneMask.apply({}, arguments), options);
    },
    placeholder: "(00) X0000-0000",
    clearIfNotMatch: true,
  };
  $(".telefone").mask(PhoneMask, PhoneMaskOptions);
}
