Hello everything is fine? I made a script to detect the change of a page, so when there is a request, the page warns with an audible alert, the script is working very well, but I realize that after a few hours active and without any request, it is "absent" updates the page but if there is any change (in this case the request) it does not warn with the sound, if I open the tab again it leaves the absent mode and goes back to making the sound warnings
does anyone know how i can solve this?
// ==UserScript==
// @name Auto-Refresh
// @include http://200.144.30.103:8081/SIPAT/patios/
// ==/UserScript==
//--- https://stackoverflow.com/questions/25484978/i-want-a-simple-greasemonkey-script-to-reload-the-page-every-minute
var alerta = false;
function search() {
document.getElementById('divCentral').click();
const music = new Audio('https://cdn.discordapp.com/attachments/325444032178159626/1015951750638882908/EFEITO_BUZINA_CAMINHAO.mp4');
var table = document.getElementById("ctl00_ContentPlaceHolder1_gv").getElementsByTagName("tbody")[0];
var atualizar = 0;
var timer = 8000;
for (var i = 0; i <= table.getElementsByTagName("tr").length - 1; i++) {
if (table.getElementsByTagName("tr")[i].className.replace(/\n/g, '') != 'HeaderStyle') {
for (var u = 0; u <= table.getElementsByTagName("tr")[i].getElementsByTagName("td").length - 1; u++) {
if (table.getElementsByTagName("tr")[i].getElementsByTagName("td")[u].textContent.replace(/ /g, '') == "SOLICITAÇÃOGUINCHO") {
atualizar++;
}
}
}
}
if (atualizar >= 1 && alerta == false) {
alerta = true;
if(confirm(`Têm ${atualizar} Solicitação(ões) de guincho pendente!`) == true){
alerta = false;
} else {
music.play();
}
setTimeout(function(){ location.reload(); }, 8000);
}
setTimeout(function(){ location.reload(); }, 10000);
setInterval(search, timer);
}
setTimeout(search,3000);