Last active
April 2, 2021 18:09
-
-
Save dlo/77426445e6403da12c652ac00b86764f to your computer and use it in GitHub Desktop.
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
var r1 = /(\$|£|€)\d+(k|K)/m | |
var r2 = /\d+-\d+(k|K)/m | |
var r3 = /\d+(k|K)\s?(€|EUR)/m | |
var candidates = [r1, r2, r3]; | |
var linkQueue = [] | |
var comments = document.getElementsByTagName("tr") | |
for (var i in comments) { | |
var comment = comments[i]; | |
if (comment.className && comment.className.indexOf("athing comtr") != -1) { | |
for (var j in candidates) { | |
if (comment.innerHTML.search(candidates[j]) != -1) { | |
var linkElements = comment.getElementsByTagName("a"); | |
for (var k in linkElements) { | |
var link = linkElements[k] | |
if (link.id && link.id.startsWith("up_") && (!link.className || (link.className && link.className != "nosee"))) { | |
linkQueue.push(link); | |
} | |
} | |
} | |
} | |
} | |
} | |
var identifier = setInterval(function() { | |
var link = linkQueue.pop(); | |
if (link) { | |
link.scrollIntoView(); | |
link.click(); | |
console.log(link); | |
} else { | |
clearInterval(identifier); | |
} | |
}, 3000 + 3000 * Math.random()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment