- function aguardarElemento(seletorReferencia, callback, FrequenciaMs, timeoutMs) {
- var InicioMs = Date.now();
-
- function loopPesquisa() {
-
- if (document.querySelector(seletorReferencia) !== null) {
- console.log(document.querySelector(seletorReferencia));
- callback();
- return;
- } else {
- setTimeout(function() {
- if (timeoutMs && Date.now() - InicioMs > timeoutMs) {
- return;
- }
- loopPesquisa();
- }, FrequenciaMs);
- }
- }
-
- loopPesquisa();
- }
-
- (function() {
- 'use strict';
- function inserirElemento(divReferencia, divClassName, labelClassName, styleName, labelText) {
- var referencia = document.getElementById(divReferencia);
- let div = document.createElement('div')
- div.className = divClassName
- let label = document.createElement('label');
- label.className = labelClassName
- label.textContent = labelText;
- label.style.cssText = styleName;
- referencia.appendChild(div);
- div.appendChild(label)
- }
- const labelStyle = `
- position: static;
- font-family: inherit;
- font-size: 2em;
- letter-spacing: 0px;
- text-transform: uppercase;
- width: 100%;
- text-align: center;
- font-color: #fff;
- line-height: 2em;
- outline: none;
- animation: animate 10s linear infinite;
- border: 1px solid black;
- border-radius: 5px;
- animation: blinkingC 1s infinite;
- `;
-
- const labelStyle2 = `
- position: static;
- font-family: inherit;
- font-size: 2em;
- letter-spacing: 0px;
- text-transform: uppercase;
- width: 100%;
- text-align: center;
- font-color: #fff;
- line-height: 2em;
- outline: none;
- animation: animate 10s linear infinite;
- border: 1px solid black;
- border-radius: 5px;
- animation: blinkingC2 1s infinite;
- `;
-
- const blinkAnimation = `
- @keyframes blinkingC {
- 0% {
- color: white;
- background: #03a600;
- }
- 100% {
- color: lightcyan;
- background: #bfbf10;
- }
- }
- `;
-
- const blinkAnimation2 = `
- @keyframes blinkingC2 {
- 0% {
- color: white;
- background: #bfbf10;
- }
- 100% {
- color: lightcyan;
- background: #03a600;
- }
- }
- `;
-
- const style = document.createElement('style');
- style.appendChild(document.createTextNode(blinkAnimation));
- style.appendChild(document.createTextNode(blinkAnimation2));
- document.head.appendChild(style);
-
- aguardarElemento("#DIVPadrao2000_Observacoes", function() {
- inserirElemento("DIVPadrao2000_Observacoes", "card-Overlay", "label-Overlay", labelStyle, "Informe que a ligação está sendo gravada");
- }, 1000, 900000);
-
- aguardarElemento("#BoxDadosSegurado", function() {
- inserirElemento("BoxDadosSegurado", "card-Overlay", "label-Overlay", labelStyle2, "Verificar grupo de afinidade");
- }, 1000, 900000);
-
- aguardarElemento("#DIVPadrao2000_Cobertura190 > div", function() {
- inserirElemento("DIVPadrao2000_Cobertura190", "card-Overlay", "label-Overlay-tipo-uso", labelStyle, "Esclarecer que uso particular implica em não utilizar o veículo para atividade comercial");
- var elementoInserido = document.getElementsByClassName("label-Overlay-tipo-uso")[0]
- document.querySelector("#BoxInforLoc > div > div:nth-child(1)").appendChild(elementoInserido)
-
- }, 1000, 900000);
-
- aguardarElemento("#BoxCobsBasicas", function() {
- inserirElemento("BoxCobsBasicas", "card-Overlay", "label-Overlay", labelStyle2, "Verificar se as coberturas atendem o segurado");
- }, 1000, 900000);
-
- aguardarElemento("#BoxBoxRenovacao", function() {
- inserirElemento("BoxBoxRenovacao", "card-Overlay", "label-Overlay", labelStyle, "Verificar se o segurado acionou o seguro na última vigência");
- }, 1000, 900000);
-
- aguardarElemento("#DIVDadosCondutor", function() {
- inserirElemento("BoxInforCond", "card-Overlay", "label-Overlay-dados-condutor", labelStyle2, "Deve ser informado o condutor mais jovem de uso frequente");
- var valorSlider = document.querySelector("#Padrao2000_Cobertura199909").value
- var slider = document.getElementsByClassName("slider round")[0]
- var elementoInserido = document.getElementsByClassName("label-Overlay-dados-condutor")[0]
- if(valorSlider === "True") { elementoInserido.style.display = "none"; elementoInserido.id = "label-slider-inativo"; } else { elementoInserido.style.display = ""; elementoInserido.id = "label-slider-ativo";};
- slider.addEventListener("click", () => { switch(elementoInserido.id) {
- case 'label-slider-inativo':
- elementoInserido.style.display = "";
- elementoInserido.id = "label-slider-ativo";
- break;
- case 'label-slider-ativo':
- elementoInserido.style.display = "none";
- elementoInserido.id = "label-slider-inativo";
- break
- }})
- }, 1000, 9000000);
-
- aguardarElemento("#gview_GridAcomp > div:nth-child(2)", function() {
- var coberturasValoresDiv = document.querySelector("#gbox_GridAcomp")
- coberturasValoresDiv.id = "coberturas-valores"
- inserirElemento("coberturas-valores", "card-Overlay", "label-Overlay-cobertura-Valores", labelStyle, "Confirmar coberturas (inclusive teto solar e carro reserva)");
- var elementoInserido = document.getElementsByClassName("label-Overlay-cobertura-Valores")[0]
- coberturasValoresDiv.prepend(elementoInserido)
- }, 1000, 900000);
-
- aguardarElemento("#BoxgrpFormaPgto > div:nth-child(12)", function() {
- inserirElemento("BoxgrpFormaPgto", "card-Overlay", "label-Overlay-forma-pagamento", labelStyle, "Confirmar se o segurado é o titular da conta. Caso não seja, entrar em contato com o titular.");
- var elementoInserido = document.getElementsByClassName("label-Overlay-forma-pagamento")[0]
- document.getElementById("BoxgrpFormaPgto").prepend(elementoInserido)
- }, 1000, 900000);
-
- })();