Overlay Quiver

Userscript overlay de interface de cotação

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