Last active
March 11, 2022 07:36
-
-
Save pranjaltech/5f7cdcffa0f0aed13453aa4cf090d1a6 to your computer and use it in GitHub Desktop.
[Open all links] Open links specified by a jQuery path.
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
| // CONFIG | |
| search_criteria = '.lista2t .lista a[onmouseover]' | |
| blacklist = []; | |
| startFromIndex = 0 | |
| // | |
| i_start = startFromIndex | |
| i_stop = $(search_criteria).length | |
| function sleep(delay) { | |
| var start = new Date().getTime(); | |
| while (new Date().getTime() < start + delay); | |
| } | |
| function randomIntFromInterval(min, max) { | |
| return Math.floor(Math.random() * (max - min + 1) + min); | |
| } | |
| index = i_start | |
| delay = 0 | |
| elements = $(search_criteria); | |
| indexes = keys(elements); | |
| links = indexes.map(_i => elements[_i]); | |
| while (index < i_stop) { | |
| // Checking for blacklist | |
| title = links[index].innerText || ''; | |
| if (blacklist.some(item => title.includes(item))) { | |
| console.log("Not opening: ", title); | |
| } else { | |
| //Open the link | |
| window.open(links[index].href, '_blank'); | |
| delay = randomIntFromInterval(800, 3000); | |
| sleep(delay); | |
| } | |
| index += 1; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment