0

hello i have this little image script that work on greasamonkey, the script is good and work like a charm it help me to block images i dont want to see

but i wished it has interval timer becasue i run it over site with dynamic content ..the targeted pics keep changing without even press f5 /refreshing

here the script ... where i should add setInterval??

// ==/UserScript==
// @grant       none

var images = document.getElementsByTagName ("img");
var x=0;
while(x<images.length)
{
if(images[x].alt == "category 1" || images[x].alt == "category 2")
{
images[x].src = "http://www.domain/IMAGES-REPLACER.gif";
}
x=x+1;

}

thanks hope u help i'm super noob

2
Contributors
2
Replies
12
Views
4 Years
Discussion Span
Last Post by mario90
1

You can use setInterval if you create a function of the above first.

function switchImage()
{
    // your code
}

setInterval(switchImage, 5000);
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.