Interface overlay
目前為
此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/467601/1198371/Overlay%20QuiverPRO%20-%20Coneccta.js
function waitForElementToDisplay(selector, callback, checkFrequencyInMs, timeoutInMs) {
var startTimeInMs = Date.now();
function loopSearch() {
if (document.querySelector(selector) !== null) {
console.log(document.querySelector(selector));
callback();
return;
} else {
setTimeout(function() {
if (timeoutInMs && Date.now() - startTimeInMs > timeoutInMs) {
return;
}
loopSearch();
}, checkFrequencyInMs);
}
}
loopSearch();
}
(function() {
'use strict';
// Function to insert the first overlay element
function insertElement(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)
console.log("Inseriu elemento " + referencia);
}
// Define the styles for the first overlay element
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;
`;
// Define the styles for the second overlay element
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;
`;
// Define the blinking animation for the label element
const blinkAnimation = `
@keyframes blinkingC {
0% {
color: white;
background: #03a600;
}
100% {
color: lightcyan;
background: #bfbf10;
}
}
`;
// Define the blinking animation for the label element
const blinkAnimation2 = `
@keyframes blinkingC2 {
0% {
color: white;
background: #bfbf10;
}
100% {
color: lightcyan;
background: #03a600;
}
}
`;
// Add the blinking animation to the page
const style = document.createElement('style');
style.appendChild(document.createTextNode(blinkAnimation));
style.appendChild(document.createTextNode(blinkAnimation2));
document.head.appendChild(style);
waitForElementToDisplay("#DIVPadrao2000_Observacoes", function() {
console.log("testeatt");
insertElement("DIVPadrao2000_Observacoes", "card-Overlay", "label-Overlay", labelStyle, "Informe que a ligação está sendo gravada");
}, 10000, 900000);
waitForElementToDisplay("#DIVPadrao2000_Cobertura190 > div", function() {
insertElement("BoxDadosSegurado", "card-Overlay", "label-Overlay", labelStyle2, "Verificar grupo de afinidade");
}, 10000, 900000);
waitForElementToDisplay("#DIVPadrao2000_Cobertura190 > div", function() {
insertElement("DIVPadrao2000_Cobertura190", "card-Overlay", "label-Overlay", labelStyle, "Esclarecer que uso particular implica em não utilizar o veículo para atividade comercial");
}, 10000, 900000);
waitForElementToDisplay("#BoxCobsBasicas", function() {
insertElement("BoxCobsBasicas", "card-Overlay", "label-Overlay", labelStyle2, "Verificar se as coberturas atendem o segurado");
}, 10000, 900000);
})();