Overlay Quiver

Userscript overlay de interface de cotação

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

此脚本不应直接安装,它是供其他脚本使用的外部库。如果你需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/467732/1201002/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: #f5f5f5;
  44. line-height: 1.3em;
  45. padding: 0.2em;
  46. outline: none;
  47. animation: animate 10s linear infinite;
  48. border: 0px solid black;
  49. border-radius: 2px;
  50. animation: blinkingC 1s infinite;
  51. box-shadow: 0 4px 5px 0 rgba(0,0,0,.14), 0 1px 10px 0 rgba(0,0,0,.12), 0 2px 4px -1px rgba(0,0,0,.2);
  52. `;
  53. const labelStyle2 = `
  54. position: static;
  55. font-family: inherit;
  56. font-size: 1.5em;
  57. letter-spacing: 0px;
  58. text-transform: uppercase;
  59. width: 100%;
  60. text-align: center;
  61. font-color: #f5f5f5;
  62. line-height: 1.3em;
  63. padding: 0.2em;
  64. outline: none;
  65. animation: animate 10s linear infinite;
  66. border: 0px solid black;
  67. border-radius: 2px;
  68. animation: blinkingC2 1s infinite;
  69. box-shadow: 0 4px 5px 0 rgba(0,0,0,.14), 0 1px 10px 0 rgba(0,0,0,.12), 0 2px 4px -1px rgba(0,0,0,.2);
  70. `;
  71. const blinkAnimation = `
  72. @keyframes blinkingC {
  73. 0% {
  74. color: white;
  75. background: #03a600;
  76. }
  77. 100% {
  78. color: lightcyan;
  79. background: #bfbf10;
  80. }
  81. }
  82. `;
  83. const blinkAnimation2 = `
  84. @keyframes blinkingC2 {
  85. 0% {
  86. color: white;
  87. background: #bfbf10;
  88. }
  89. 100% {
  90. color: lightcyan;
  91. background: #03a600;
  92. }
  93. }
  94. `;
  95. const style = document.createElement('style');
  96. style.appendChild(document.createTextNode(blinkAnimation));
  97. style.appendChild(document.createTextNode(blinkAnimation2));
  98. document.head.appendChild(style);
  99.  
  100. // AUTOMÓVEL
  101. aguardarElemento("#DIVPadrao2000_Observacoes", function() {
  102. inserirElemento("DIVPadrao2000_Observacoes", "card-Overlay", "label-Overlay", labelStyle, "Informe que a ligação está sendo gravada");
  103. }, 1000, 900000);
  104.  
  105. aguardarElemento("#BoxDadosSegurado", function() {
  106. inserirElemento("BoxDadosSegurado", "card-Overlay", "label-Overlay", labelStyle2, "Verificar grupo de afinidade");
  107. }, 1000, 900000);
  108.  
  109. aguardarElemento("#DIVPadrao2000_Cobertura190 > div", function() {
  110. 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");
  111. var elementoInserido = document.getElementsByClassName("label-Overlay-tipo-uso")[0]
  112. document.querySelector("#BoxInforLoc > div > div:nth-child(1)").appendChild(elementoInserido)
  113. elementoInserido.style.marginLeft = "0.5em";
  114.  
  115. }, 1000, 900000);
  116.  
  117. aguardarElemento("#BoxCobsBasicas", function() {
  118. inserirElemento("BoxCobsBasicas", "card-Overlay", "label-Overlay", labelStyle2, "Verificar se as coberturas atendem o segurado");
  119. }, 1000, 900000);
  120.  
  121. aguardarElemento("#BoxBoxRenovacao", function() {
  122. inserirElemento("BoxBoxRenovacao", "card-Overlay", "label-Overlay", labelStyle, "Verificar se o segurado acionou o seguro na última vigência");
  123. }, 1000, 900000);
  124.  
  125. aguardarElemento("#DIVDadosCondutor", function() {
  126. inserirElemento("BoxInforCond", "card-Overlay", "label-Overlay-dados-condutor", labelStyle2, "Principal condutor: Deve ser o condutor mais jovem de uso frequente");
  127. var cardCondutor = document.querySelector("#DIVPadrao2000_Condutor01_Propriosegurado").style.display
  128. var slider = document.getElementsByClassName("slider round")[0]
  129. var elementoInserido = document.getElementsByClassName("label-Overlay-dados-condutor")[0]
  130. if(cardCondutor === 'none') { elementoInserido.style.display = "none"; elementoInserido.id = "label-slider-inativo"; } else { elementoInserido.style.display = ""; elementoInserido.id = "label-slider-ativo";};
  131. slider.addEventListener("click", () => { switch(elementoInserido.id) {
  132. case 'label-slider-inativo':
  133. elementoInserido.style.display = "";
  134. elementoInserido.id = "label-slider-ativo";
  135. break;
  136. case 'label-slider-ativo':
  137. elementoInserido.style.display = "none";
  138. elementoInserido.id = "label-slider-inativo";
  139. break
  140. }})
  141. }, 1000, 9000000);
  142.  
  143. aguardarElemento("#gview_GridAcomp > div:nth-child(2)", function() {
  144. if ( (document.querySelector("#DIVCondicaoComercial").textContent !== 'Residencial') && (document.querySelector("#DIVCondicaoComercial").textContent !== 'Empresarial') ) {
  145. var coberturasValoresDiv = document.querySelector("#gbox_GridAcomp")
  146. coberturasValoresDiv.id = "coberturas-valores"
  147. inserirElemento("coberturas-valores", "card-Overlay", "label-Overlay-cobertura-Valores", labelStyle, "Confirmar coberturas (inclusive teto solar e carro reserva)");
  148. var elementoInserido = document.getElementsByClassName("label-Overlay-cobertura-Valores")[0]
  149. coberturasValoresDiv.prepend(elementoInserido)}
  150. }, 1000, 900000);
  151.  
  152. aguardarElemento("#BoxInforCondAdicionais", function() {
  153. 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?");
  154. }, 1000, 900000);
  155.  
  156. aguardarElemento("#DIVDadosCondutor", function() {
  157. inserirElemento("BoxGrupoJovensCondutores", "card-Overlay", "label-Overlay-dados-jovem", labelStyle2, "Informar condutores eventuais abaixo de 26 anos");
  158. var cardJovem = document.querySelector("#DIVJovensCondutores").style.display
  159. var slider = document.getElementsByClassName("slider round")[2]
  160. var elementoInserido = document.getElementsByClassName("label-Overlay-dados-jovem")[0]
  161. if(cardJovem === 'none') { elementoInserido.style.display = "none"; elementoInserido.id = "label-slider-jovem-inativo"; } else { elementoInserido.style.display = ""; elementoInserido.id = "label-slider-jovem-ativo";};
  162. slider.addEventListener("click", () => { switch(elementoInserido.id) {
  163. case 'label-slider-jovem-inativo':
  164. elementoInserido.style.display = "";
  165. elementoInserido.id = "label-slider-jovem-ativo";
  166. break;
  167. case 'label-slider-jovem-ativo':
  168. elementoInserido.style.display = "none";
  169. elementoInserido.id = "label-slider-jovem-inativo";
  170. break
  171. }})
  172. }, 1000, 9000000);
  173.  
  174. // RESIDENCIAL
  175. aguardarElemento("#BoxDadosSeg", function() {
  176. inserirElemento("BoxDadosSeg", "card-Overlay", "label-Overlay", labelStyle2, "Informe que a ligação está sendo gravada");
  177. }, 1000, 900000);
  178.  
  179. aguardarElemento("#BoxGrupo1", function() {
  180. inserirElemento("BoxGrupo1", "card-Overlay", "label-Overlay", labelStyle2, "Confirmar nome, proprietário e grupo de afinidade");
  181. }, 1000, 900000);
  182.  
  183. aguardarElemento("#BoxInforLoc > div:nth-child(3)", function() {
  184. if( document.querySelector("#DIVCondicaoComercial").textContent === 'Residencial' ) {
  185. inserirElemento("BoxInforLoc", "card-Overlay", "label-Overlay-tipo-imovel", labelStyle, "Confirmar endereço e demais informações");
  186. var elementoInserido = document.getElementsByClassName("label-Overlay-tipo-imovel")[0];
  187. document.querySelector("#BoxInforLoc > div:nth-child(3)").appendChild(elementoInserido);
  188. elementoInserido.style.marginLeft = "0.5em";}
  189. }, 1000, 900000);
  190.  
  191. aguardarElemento("#DIVDemaisCarac", function() {
  192. if( document.querySelector("#DIVCondicaoComercial").textContent === 'Residencial' ) {
  193. inserirElemento("DIVDemaisCarac", "card-Overlay", "label-Overlay", labelStyle2, "Confirmar se há protecionais e placa solar no local de risco");}
  194. }, 1000, 900000);
  195.  
  196.  
  197. aguardarElemento("#DIVGridResultado > div > div:nth-child(4) > div > div.col-sm-12.text-center.border-cia > div > div:nth-child(1) > img", function() {
  198. var xpathFilter = "//img[@src='../img/logo_30015.gif']";
  199. var xpathResult = document.evaluate(xpathFilter, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
  200. for (var i = 0; i < xpathResult.snapshotLength; i++) {
  201. if ( i == 2 ) { var element = xpathResult.snapshotItem(i) }
  202. }
  203. var div = element.parentNode.parentNode.parentNode.parentNode.parentNode
  204. var divCriada = document.createElement('div')
  205. var labelCriado = document.createElement('label')
  206. labelCriado.textContent = 'Allianz indeniza por metragem original no registro de imóveis';
  207. labelCriado.style.cssText = labelStyle;
  208. labelCriado.style.fontSize = "1.2em";
  209. divCriada.appendChild(labelCriado);
  210. div.appendChild(divCriada)
  211. }, 1000, 900000);
  212.  
  213. aguardarElemento("#gview_GridAcomp > div:nth-child(2)", function() {
  214. if ( document.querySelector("#DIVCondicaoComercial").textContent === 'Residencial') {
  215. var coberturasValoresDiv = document.querySelector("#gbox_GridAcomp")
  216. coberturasValoresDiv.id = "coberturas-valores"
  217. inserirElemento("coberturas-valores", "card-Overlay", "label-Overlay-cobertura-Valores", labelStyle, "Allianz indeniza por metragem original no registro de imóveis");
  218. var elementoInserido = document.getElementsByClassName("label-Overlay-cobertura-Valores")[0]
  219. coberturasValoresDiv.prepend(elementoInserido)}
  220. }, 1000, 900000);
  221.  
  222. aguardarElemento("#BoxgrDadoSegurado", function() {
  223. if ( (document.querySelector("#DIVCondicaoComercial").textContent == 'Residencial') || (document.querySelector("#DIVCondicaoComercial").textContent == 'Empresarial') ) {
  224. inserirElemento("BoxgrDadoSegurado", "card-Overlay", "label-Overlay", labelStyle2, "Confirmar endereço do associado (nem sempre é o mesmo endereço do risco)");}
  225. }, 1000, 900000);
  226.  
  227. aguardarElemento("#BoxgrInfoAdicionaisSegurado2", function() {
  228. inserirElemento("BoxgrInfoAdicionaisSegurado2", "card-Overlay", "label-Overlay", labelStyle, "Confirmar cláusula beneficiária");
  229. }, 1000, 900000);
  230.  
  231. aguardarElemento("#BoxgrpFormaPgto", function() {
  232. 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.");
  233. }, 1000, 900000);
  234.  
  235. //EMPRESARIAL
  236. aguardarElemento("#DIVDemaisCarac", function() {
  237. if( document.querySelector("#DIVCondicaoComercial").textContent == 'Empresarial' ) {
  238. inserirElemento("DIVPadrao4000_Cobertura9108", "card-Overlay", "label-Overlay", labelStyle2, "Confirmar se há protecionais e placa solar no local de risco");}
  239. }, 1000, 900000);
  240.  
  241. aguardarElemento("#BoxInforAtiv", function() {
  242. if ( document.querySelector("#DIVCondicaoComercial").textContent == 'Empresarial' ) {
  243. var empAtividades = document.getElementById("BoxInforAtiv")
  244. inserirElemento("BoxInforAtiv", "card-Overlay", "overlay-emp-atividade", labelStyle, "Confirmar atividade principal");
  245. var elementoInserido = document.getElementsByClassName("overlay-emp-atividade")[0]
  246. empAtividades.prepend(elementoInserido)}
  247. }, 1000, 900000);
  248.  
  249. aguardarElemento("#gview_GridAcomp > div:nth-child(2)", function() {
  250. if ( document.querySelector("#DIVCondicaoComercial").textContent == 'Empresarial' ) {
  251. var coberturasValoresDiv = document.querySelector("#gbox_GridAcomp")
  252. coberturasValoresDiv.id = "coberturas-valores-empresarial"
  253. inserirElemento("coberturas-valores-empresarial", "card-Overlay", "label-Overlay-cobertura-Valores-empresarial", labelStyle, "Confirmar se coberturas e assistências estão atendendo o segurado");
  254. var elementoInserido = document.getElementsByClassName("label-Overlay-cobertura-Valores-empresarial")[0]
  255. coberturasValoresDiv.prepend(elementoInserido)}
  256. }, 1000, 900000);
  257.  
  258. aguardarElemento("#BoxInspecao", function() {
  259. if( document.querySelector("#DIVCondicaoComercial").textContent == 'Empresarial' ) {
  260. inserirElemento("BoxInspecao", "card-Overlay", "label-Overlay", labelStyle, "Confirmar cláusula beneficiária, nome completo e informações de contato");}
  261. }, 1000, 900000);
  262. })();