Overlay Quiver

Userscript overlay de interface de cotação

目前为 2023-06-06 提交的版本,查看 最新版本

此脚本不应直接安装,它是供其他脚本使用的外部库。如果你需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/467732/1200694/Overlay%20Quiver.js

  1. function aguardarElemento(seletorReferencia, callback, FrequenciaMs, timeoutMs) {
  2. var InicioMs = Date.now();
  3.  
  4. function loopPesquisa() {
  5.  
  6. if (document.querySelector(seletorReferencia) !== null) {
  7. callback();
  8. return;
  9. } else {
  10. setTimeout(function() {
  11. if (timeoutMs && Date.now() - InicioMs > timeoutMs) {
  12. return;
  13. }
  14. loopPesquisa();
  15. }, FrequenciaMs);
  16. }
  17. }
  18.  
  19. loopPesquisa();
  20. }
  21.  
  22. (function() {
  23. 'use strict';
  24. function inserirElemento(divReferencia, divClassName, labelClassName, styleName, labelText) {
  25. var referencia = document.getElementById(divReferencia);
  26. let div = document.createElement('div')
  27. div.className = divClassName
  28. let label = document.createElement('label');
  29. label.className = labelClassName
  30. label.textContent = labelText;
  31. label.style.cssText = styleName;
  32. referencia.appendChild(div);
  33. div.appendChild(label)
  34. }
  35. const labelStyle = `
  36. position: static;
  37. font-family: inherit;
  38. font-size: 1.5em;
  39. letter-spacing: 0px;
  40. text-transform: uppercase;
  41. width: 100%;
  42. text-align: center;
  43. font-color: #fff;
  44. line-height: 1.3em;
  45. outline: none;
  46. animation: animate 10s linear infinite;
  47. border: 1px solid black;
  48. border-radius: 5px;
  49. animation: blinkingC 1s infinite;
  50. `;
  51. const labelStyle2 = `
  52. position: static;
  53. font-family: inherit;
  54. font-size: 1.5em;
  55. letter-spacing: 0px;
  56. text-transform: uppercase;
  57. width: 100%;
  58. text-align: center;
  59. font-color: #fff;
  60. line-height: 1.3em;
  61. outline: none;
  62. animation: animate 10s linear infinite;
  63. border: 1px solid black;
  64. border-radius: 5px;
  65. animation: blinkingC2 1s infinite;
  66. `;
  67. const blinkAnimation = `
  68. @keyframes blinkingC {
  69. 0% {
  70. color: white;
  71. background: #03a600;
  72. }
  73. 100% {
  74. color: lightcyan;
  75. background: #bfbf10;
  76. }
  77. }
  78. `;
  79. const blinkAnimation2 = `
  80. @keyframes blinkingC2 {
  81. 0% {
  82. color: white;
  83. background: #bfbf10;
  84. }
  85. 100% {
  86. color: lightcyan;
  87. background: #03a600;
  88. }
  89. }
  90. `;
  91. const style = document.createElement('style');
  92. style.appendChild(document.createTextNode(blinkAnimation));
  93. style.appendChild(document.createTextNode(blinkAnimation2));
  94. document.head.appendChild(style);
  95.  
  96. // AUTOMÓVEL
  97. aguardarElemento("#DIVPadrao2000_Observacoes", function() {
  98. inserirElemento("DIVPadrao2000_Observacoes", "card-Overlay", "label-Overlay", labelStyle, "Informe que a ligação está sendo gravada");
  99. }, 1000, 900000);
  100.  
  101. aguardarElemento("#BoxDadosSegurado", function() {
  102. inserirElemento("BoxDadosSegurado", "card-Overlay", "label-Overlay", labelStyle2, "Verificar grupo de afinidade");
  103. }, 1000, 900000);
  104.  
  105. aguardarElemento("#DIVPadrao2000_Cobertura190 > div", function() {
  106. 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");
  107. var elementoInserido = document.getElementsByClassName("label-Overlay-tipo-uso")[0]
  108. document.querySelector("#BoxInforLoc > div > div:nth-child(1)").appendChild(elementoInserido)
  109. elementoInserido.style.marginLeft = "0.5em";
  110.  
  111. }, 1000, 900000);
  112.  
  113. aguardarElemento("#BoxCobsBasicas", function() {
  114. inserirElemento("BoxCobsBasicas", "card-Overlay", "label-Overlay", labelStyle2, "Verificar se as coberturas atendem o segurado");
  115. }, 1000, 900000);
  116.  
  117. aguardarElemento("#BoxBoxRenovacao", function() {
  118. inserirElemento("BoxBoxRenovacao", "card-Overlay", "label-Overlay", labelStyle, "Verificar se o segurado acionou o seguro na última vigência");
  119. }, 1000, 900000);
  120.  
  121. aguardarElemento("#DIVDadosCondutor", function() {
  122. inserirElemento("BoxInforCond", "card-Overlay", "label-Overlay-dados-condutor", labelStyle2, "Principal condutor: Deve ser o condutor mais jovem de uso frequente");
  123. var cardCondutor = document.querySelector("#DIVPadrao2000_Condutor01_Propriosegurado").style.display
  124. var slider = document.getElementsByClassName("slider round")[0]
  125. var elementoInserido = document.getElementsByClassName("label-Overlay-dados-condutor")[0]
  126. if(cardCondutor === 'none') { elementoInserido.style.display = "none"; elementoInserido.id = "label-slider-inativo"; } else { elementoInserido.style.display = ""; elementoInserido.id = "label-slider-ativo";};
  127. slider.addEventListener("click", () => { switch(elementoInserido.id) {
  128. case 'label-slider-inativo':
  129. elementoInserido.style.display = "";
  130. elementoInserido.id = "label-slider-ativo";
  131. break;
  132. case 'label-slider-ativo':
  133. elementoInserido.style.display = "none";
  134. elementoInserido.id = "label-slider-inativo";
  135. break
  136. }})
  137. }, 1000, 9000000);
  138.  
  139. aguardarElemento("#gview_GridAcomp > div:nth-child(2)", function() {
  140. if ( (document.querySelector("#DIVCondicaoComercial").textContent !== 'Residencial') && (document.querySelector("#DIVCondicaoComercial").textContent !== 'Empresarial') ) {
  141. var coberturasValoresDiv = document.querySelector("#gbox_GridAcomp")
  142. coberturasValoresDiv.id = "coberturas-valores"
  143. inserirElemento("coberturas-valores", "card-Overlay", "label-Overlay-cobertura-Valores", labelStyle, "Confirmar coberturas (inclusive teto solar e carro reserva)");
  144. var elementoInserido = document.getElementsByClassName("label-Overlay-cobertura-Valores")[0]
  145. coberturasValoresDiv.prepend(elementoInserido)}
  146. }, 1000, 900000);
  147.  
  148. aguardarElemento("#BoxInforCondAdicionais", function() {
  149. inserirElemento("BoxInforCondAdicionais", "card-Overlay", "label-Overlay", labelStyle, "Além do condutor principal, existem outros condutores mais jovens que venham a conduzir o veículo dois ou mais na semana?");
  150. }, 1000, 900000);
  151.  
  152. aguardarElemento("#DIVDadosCondutor", function() {
  153. inserirElemento("BoxGrupoJovensCondutores", "card-Overlay", "label-Overlay-dados-jovem", labelStyle2, "Informar condutores eventuais abaixo de 26 anos");
  154. var cardJovem = document.querySelector("#DIVJovensCondutores").style.display
  155. var slider = document.getElementsByClassName("slider round")[2]
  156. var elementoInserido = document.getElementsByClassName("label-Overlay-dados-jovem")[0]
  157. if(cardJovem === 'none') { elementoInserido.style.display = "none"; elementoInserido.id = "label-slider-jovem-inativo"; } else { elementoInserido.style.display = ""; elementoInserido.id = "label-slider-jovem-ativo";};
  158. slider.addEventListener("click", () => { switch(elementoInserido.id) {
  159. case 'label-slider-jovem-inativo':
  160. elementoInserido.style.display = "";
  161. elementoInserido.id = "label-slider-jovem-ativo";
  162. break;
  163. case 'label-slider-jovem-ativo':
  164. elementoInserido.style.display = "none";
  165. elementoInserido.id = "label-slider-jovem-inativo";
  166. break
  167. }})
  168. }, 1000, 9000000);
  169.  
  170. // RESIDENCIAL
  171. aguardarElemento("#BoxDadosSeg", function() {
  172. inserirElemento("BoxDadosSeg", "card-Overlay", "label-Overlay", labelStyle2, "Informe que a ligação está sendo gravada");
  173. }, 1000, 900000);
  174.  
  175. aguardarElemento("#BoxGrupo1", function() {
  176. inserirElemento("BoxGrupo1", "card-Overlay", "label-Overlay", labelStyle2, "Confirmar nome, proprietário e grupo de afinidade");
  177. }, 1000, 900000);
  178.  
  179. aguardarElemento("#BoxInforLoc > div:nth-child(3)", function() {
  180. if( document.querySelector("#DIVCondicaoComercial").textContent === 'Residencial' ) {
  181. inserirElemento("BoxInforLoc", "card-Overlay", "label-Overlay-tipo-imovel", labelStyle, "Confirmar endereço e demais informações");
  182. var elementoInserido = document.getElementsByClassName("label-Overlay-tipo-imovel")[0];
  183. document.querySelector("#BoxInforLoc > div:nth-child(3)").appendChild(elementoInserido);
  184. elementoInserido.style.marginLeft = "0.5em";}
  185. }, 1000, 900000);
  186.  
  187. aguardarElemento("#DIVDemaisCarac", function() {
  188. if( document.querySelector("#DIVCondicaoComercial").textContent === 'Residencial' ) {
  189. inserirElemento("DIVDemaisCarac", "card-Overlay", "label-Overlay", labelStyle2, "Confirmar se há protecionais e placa solar no local de risco");}
  190. }, 1000, 900000);
  191.  
  192. aguardarElemento("#DIVGridResultado > div > div:nth-child(4) > div > div.col-sm-12.text-center.border-cia > div > div:nth-child(1) > img", function() {
  193. var xpathFilter = "//img[@src='../img/logo_30015.gif']";
  194. var xpathResult = document.evaluate(xpathFilter, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
  195. for (var i = 0; i < xpathResult.snapshotLength; i++) {
  196. if ( i == 2 ) { var element = xpathResult.snapshotItem(i) }
  197. }
  198. var div = element.parentNode.parentNode.parentNode.parentNode.parentNode
  199. var divCriada = document.createElement('div')
  200. var labelCriado = document.createElement('label')
  201. labelCriado.textContent = 'Allianz indeniza por metragem original no registro de imóveis';
  202. labelCriado.style.cssText = labelStyle;
  203. labelCriado.style.fontSize = "1.2em";
  204. divCriada.appendChild(labelCriado);
  205. div.appendChild(divCriada)
  206. }, 1000, 900000);
  207.  
  208. aguardarElemento("#gview_GridAcomp > div:nth-child(2)", function() {
  209. if ( document.querySelector("#DIVCondicaoComercial").textContent === 'Residencial') {
  210. var coberturasValoresDiv = document.querySelector("#gbox_GridAcomp")
  211. coberturasValoresDiv.id = "coberturas-valores"
  212. inserirElemento("coberturas-valores", "card-Overlay", "label-Overlay-cobertura-Valores", labelStyle, "Allianz indeniza por metragem original no registro de imóveis");
  213. var elementoInserido = document.getElementsByClassName("label-Overlay-cobertura-Valores")[0]
  214. coberturasValoresDiv.prepend(elementoInserido)}
  215. }, 1000, 900000);
  216.  
  217. aguardarElemento("#BoxgrDadoSegurado", function() {
  218. if ( (document.querySelector("#DIVCondicaoComercial").textContent == 'Residencial') || (document.querySelector("#DIVCondicaoComercial").textContent == 'Empresarial') ) {
  219. inserirElemento("BoxgrDadoSegurado", "card-Overlay", "label-Overlay", labelStyle2, "Confirmar endereço do associado (nem sempre é o mesmo endereço do risco)");}
  220. }, 1000, 900000);
  221.  
  222. aguardarElemento("#BoxgrInfoAdicionaisSegurado2", function() {
  223. inserirElemento("BoxgrInfoAdicionaisSegurado2", "card-Overlay", "label-Overlay", labelStyle, "Confirmar cláusula beneficiária");
  224. }, 1000, 900000);
  225.  
  226. aguardarElemento("#BoxgrpFormaPgto", function() {
  227. inserirElemento("BoxgrpFormaPgto", "card-Overlay", "label-Overlay", labelStyle2, "Confirmar se o segurado é o titular da conta. Caso não seja, entrar em contato com o titular.");
  228. }, 1000, 900000);
  229.  
  230. //EMPRESARIAL
  231. aguardarElemento("#DIVDemaisCarac", function() {
  232. if( document.querySelector("#DIVCondicaoComercial").textContent == 'Empresarial' ) {
  233. inserirElemento("DIVPadrao4000_Cobertura9108", "card-Overlay", "label-Overlay", labelStyle2, "Confirmar se há protecionais e placa solar no local de risco");}
  234. }, 1000, 900000);
  235.  
  236. aguardarElemento("#gview_GridAcomp > div:nth-child(2)", function() {
  237. if ( document.querySelector("#DIVCondicaoComercial").textContent == 'Empresarial' ) {
  238. var coberturasValoresDiv = document.querySelector("#gbox_GridAcomp")
  239. coberturasValoresDiv.id = "coberturas-valores-empresarial"
  240. inserirElemento("coberturas-valores-empresarial", "card-Overlay", "label-Overlay-cobertura-Valores-empresarial", labelStyle, "Confirmar se coberturas e assistências estão atendendo o segurado");
  241. var elementoInserido = document.getElementsByClassName("label-Overlay-cobertura-Valores-empresarial")[0]
  242. coberturasValoresDiv.prepend(elementoInserido)}
  243. }, 1000, 900000);
  244.  
  245.  
  246. })();