Last active
July 18, 2025 20:31
-
-
Save SophieShears/39a918b1f9b7168ae36fb57f4b21041e to your computer and use it in GitHub Desktop.
Click All Links Then Scroll to the Bottom
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OpenAll { | |
constructor() { | |
this.seenUrls = new Set(); | |
} | |
openWindows() { | |
const links = document.getElementsByTagName('a'); | |
const url = 'crm.kuhnlawgroup.com'; | |
for (let i = 0; i < links.length; i ++) { | |
if (!links[i].href.includes(url) && links[i].href.includes('.com')) { | |
if (! this.seenUrls.has(links[i].href)){ | |
this.seenUrls.add(links[i].href); | |
window.open(links[i].href, '_blank'); | |
} | |
} | |
} | |
} | |
scrollAndOpen(timesToScroll) { | |
const windowTable = document.getElementsByClassName('window-table')[0]; | |
for (let i=0; i < timesToScroll; i++) { | |
this.openWindows(); | |
const scrollDistance = windowTable.scrollTop + document.body.scrollHeight; | |
windowTable.scrollTo(0, scrollDistance); | |
}; | |
}; | |
} | |
const windowOpen = new OpenAll(); | |
windowOpen.scrollAndOpen(1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment