Hacker News new | ask | show | jobs
by lildoggo 2337 days ago
I wrote something very similar for reddit a while back using an extension called Tampermonkey. Reddit uses the same CSS classes on all their promoted content so if twitter does this same this could work.

Basically, you make an eventlistener on the scroll wheel and do document.getElementsByClassName('promoted-css-class-name'). Loop over the array of elements found and set the element style to 'display:none' for every element found every time you scroll.

Not the most efficient approach, but effective!

1 comments

Oh, adding the event listener to the scroll is very clever. I was trying to do it "right" and using a MutationObserver to find when they added nodes to the document but this gets too convoluted fast.