How would I go about implementing this as a bookmarklet?
This is the function that I have:
javascript: function tr_f() {
var followlinks = [];
for (var i=0; i < document.links.length; i++) {
if (document.links[i].getAttribute("class")=="follow"){
followlinks[followlinks.length] = document.links[i];
}
}
for (var i=0; i<followlinks.length; i++) {
var rrr=followlinks[i].onclick();
}
} tr_f();
I want to modify this code to perform the function, then refresh the page, wait a few seconds, and execute the function again – in an infinite loop.
Alternatively, in fact a better method, would be to refresh the page once the bookmarklet has been clicked, execute the function on page load, and then do it again.
You cannot do it as a bookmarklet, all code is lost after the page reloads and then loaded again but your bookmarklet isn’t part of the page so you have to manually execute it again which means you are back to square one.
However, what are you trying to do anyway? You could use localStorage so your script doesn’t have to start from scratch every time it is ran.