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

Recommended Answers

All 2 Replies

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

function switchImage()
{
    // your code
}

setInterval(switchImage, 5000);

Thank you so much worked !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.