Skip to content

Instantly share code, notes, and snippets.

@adnoh
Created March 17, 2025 09:44
Show Gist options
  • Select an option

  • Save adnoh/1038c7b1ff3bd317a21fb1d15d27c4f2 to your computer and use it in GitHub Desktop.

Select an option

Save adnoh/1038c7b1ff3bd317a21fb1d15d27c4f2 to your computer and use it in GitHub Desktop.
fab.com
ownedTimer=null
var xpath = "//div[contains(text(),'Saved in My Library')]";
function startRandomIntervalOwned(N) {
ownedTimer=setTimeout(() => {
var result = document.evaluate(xpath, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
console.log("clearing");
for (i=0; i < result.snapshotLength; i++) {
result.snapshotItem(i).parentElement.parentElement.parentElement.remove()
}
startRandomIntervalOwned(N);
}, N * 1000); // Convert seconds to milliseconds
}
startRandomIntervalOwned(2)
scrollTimer=null
// Function to scroll the page to the bottom
function scrollToBottom() {
window.scrollTo({
top: document.documentElement.scrollHeight,
behavior: 'smooth' // Optional: Adds smooth scrolling
});
console.log('Page scrolled to the bottom');
}
// Function to generate a random number between min and max (inclusive)
function getRandomInterval(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
// Function to start the interval with a random delay
function startRandomIntervalScroll() {
const N = getRandomInterval(3, 7); // Get a random number between A and B
console.log(`Next scroll in ${N} seconds...`);
scrollTimer=setTimeout(() => {
scrollToBottom();
startRandomIntervalScroll(); // Call the function again to set the next interval
}, N * 1000); // Convert seconds to milliseconds
}
// Start the process
startRandomIntervalScroll();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment