i want to play a sound when a text changes at spesific area on a webpage which continiously refresh with script.
I want that code to refresh and play a sound when it is not match the text i entered.
// ==UserScript==
// @name Audio Script
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://x
// @match https://x
// @match https://x
// @grant none
// ==/UserScript==
(function() {
'use strict';
var audio = document.createElement("audio");
audio.src = "http://y/vuvuzela-trumpet.mp3";
function reload()
{ location.reload();};
var x = document.getElementsByClassName("sl-nm")[0].firstChild.attributes[0].nodeValue;
console.log(x)
if ( x != "/a/b" ); // text i entered
audio.play;
var interval = Math.random()*5000
var interval2 = Math.random()*5000
var gecikme = (interval+interval2)*2.3
console.log(gecikme/60000)
var myVar = setInterval(() => reload(), gecikme)
// Your code here...
})();
The problem was that, if anyone gets same error like me;
if ( x != "/a/b" ); // text i entered
audio.play;
Must change like
if ( x != "/a/b" ); // text i entered
audio.play() ;