News for hackers. Stuff that matters.
Re:Ask HN: How do you use userscripts? by Anthony-G on Wednesday March 06, 2024 @05:24PM (#39622540)
If you’re using uBlock Origin (and you should be), it’s easy to declutter web pages by removing unwanted elements from the DOM.

I recently discovered that it can go even further in improving the user experience: it can also be used to modify most (if not all) styles on a web page. For a good description and example use case (a “dark mode” skin for Hacker News), see https://darekkay.com/blog/ublock-website-themes/

Re:Ask HN: How do you use userscripts? by eps on Wednesday March 06, 2024 @05:45PM (#39622745)
This doesn't work for many sites that use randomly generated class names and IDs. For example, it's really difficult to trim all the cruft and junk from Twitter's web interface without an userscript. With the script though it's trivial and you can also filter the feed to remove ads, suggestions, posts liked by some random people, etc.
Re:Ask HN: How do you use userscripts? by Anthony-G on Wednesday March 06, 2024 @06:49PM (#39623340)
I only modify a small number of sites that I regularly visit and so far I’ve only once come across a site with random class names and IDs (I’m guessing that’s done as a way to defeat what we’re talking about). If I remember correctly, I got around the random name problem by removing the parent element which had a defined name.

I don’t visit Twitter and certainly never tried to do anything as sophisticated as what you’re describing (though it sounds like other users on this page would benefit from your userscript). I just make the sites that I regularly visit that bit easier on the eye without spending too much effort on modifying styles (I also haven’t done web development in the last 10-15 years so delving into scripts and the DOM wouldn’t be my forté).

Re:Ask HN: How do you use userscripts? by ecnahc515 on Thursday March 07, 2024 @11:11AM (#39630758)
The popular modern css and react style frameworks use dynamically generated ids and classes so it’s not necessarily to prevent userscripts but it does make it harder to use them.