Untitled
unknown
plain_text
a year ago
1.5 kB
15
Indexable
(function visitRandomLink() {
// Function to get a random link from the current website
function getRandomInternalLink() {
// Get all <a> elements (links)
var links = document.querySelectorAll('a');
var sameSiteLinks = [];
// Filter out links that are not on the same domain
for (var i = 0; i < links.length; i++) {
var link = links[i];
// Check if the link's host is the same as the current page's host
if (link.hostname === window.location.hostname) {
sameSiteLinks.push(link);
}
}
// If we found internal links, pick a random one
if (sameSiteLinks.length > 0) {
var randomIndex = Math.floor(Math.random() * sameSiteLinks.length); // Random link index
return sameSiteLinks[randomIndex];
}
return null;
}
// Function to visit the random internal link
function visitLink() {
var link = getRandomInternalLink();
if (link && link.href) {
window.location.href = link.href; // Navigate to the random internal link
}
}
// Function to generate a random interval between 40 and 60 seconds
function getRandomInterval() {
return Math.floor(Math.random() * 20000) + 40000; // Random time between 40,000ms (40s) and 60,000ms (60s)
}
// Set a random interval to visit a new link
setInterval(visitLink, getRandomInterval());
})();Editor is loading...
Leave a Comment