Skip to content

Instantly share code, notes, and snippets.

@divinity76
Last active February 17, 2021 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save divinity76/9d5842797317ad5d1917 to your computer and use it in GitHub Desktop.
Save divinity76/9d5842797317ad5d1917 to your computer and use it in GitHub Desktop.
(function(){
const beep=function(){
let beepElement = document.getElementById("beepElement");
if(!beepElement){
beepElement = document.createElement("audio");
beepElement.id = "beepElement";
beepElement.autoplay=false;
beepElement.src="https://images.wikia.com/monchbox/images/0/01/Beep-sound.ogg";
document.head.appendChild(beepElement);
}
beepElement.play();
};
var iframe = document.createElement("iframe");
var check = function () {
check.new = iframe.contentWindow.window.document.body.innerHTML.toString();
check.new = check.new.replace(/\<span id\=\"paristz\" class\=\"bold\"\>.*?\<\/span\>/gim, "cats");
if (check.old == undefined) {
check.old = check.new;
iframe.contentWindow.window.location.reload();
return;
};
if (check.old != check.new) {
//my job here is done!
setInterval(beep, 200);
return;
};
check.old = check.new;
iframe.contentWindow.window.location.reload();
return;
};
var src = window.location.toString();
document.body.appendChild(iframe);
iframe.addEventListener("load", check);
iframe.addEventListener("error", check);
iframe.addEventListener("error", beep);
iframe.src = src;
//iframe.contentWindow.window.location.reload()
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment