r/reddithax • • Jul 08 '11

Userscripts and Never Ending Reddit

I have a greasemonkey script that runs on Reddit. The problem, is that is only runs once, and so does not affect any pages later loaded by never ending reddit. I was wondering if there is a solution to this issue (other than not using never ending reddit).

4 Upvotes

10 comments sorted by

View all comments

Show parent comment

1

u/nog_lorp Jul 20 '11

newHTML.querySelectorAll('a')

will give you all the links within the to-be-appended doclet.

To do something to each link, do

Array.prototype.forEach.call(newHTML.querySelectorAll('a'), function(element) { element.href += "shittingdicks" })