HACKER Q&A
📣 quibono

How do you use userscripts?


I'd like to see use cases for userscripts, anything interesting or helpful. I see them as better at customising the web experience compared to browser extensions.


  👤 Leftium Accepted Answer ✓
I manage my userscripts via Violentmonkey. I have about 6 active scripts:

- https://github.com/mnghsn/google-search-sidebar

- https://github.com/Zren/ResizeYoutubePlayerToWindowSize/

- https://greasyfork.org/en/scripts/457219-disable-youtube-aut...

- https://web.archive.org/web/20190216022504/https://greasyfor...

- https://github.com/zerodytrash/Simple-YouTube-Age-Restrictio...

- "Red scrolling indicator": marks unread vs read scroll position on page-down

- "Bkmks Instant": custom script to turn bkmks.com search box into instant filter.


👤 Anthony-G
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/


👤 romdev
I personally will use Bookmarklets rather than Userscripts to fulfill the same purpose. Bookmarklets work even in locked-down browsers including Edge (bookmarks bar, not favorites sidebar).

The one I use most often is modelled after a similar one - after you fill out a web form you can capture your entries and restore them with a single click:

https://github.com/mossrich/Bookmarklets/blob/master/Bookmar...


👤 apimade
I created my own extension for Firefox to revert Slack’s design overhaul.

https://addons.mozilla.org/en-US/firefox/addon/slackrevert/

That has just stopped working as legacy frontend components have been removed.

You could restore the old UX with some CSS hacking but ain’t nobody got time for that.


👤 zzo38computer
For many uses (especially those related to specific web sites, web apps, services, etc), they are better at customizing the web experience compared to browser extensions, but for some uses it isn't.

One use I used it for is to be able to view files on GitHub without needing to load all of the scripts from GitHub (which are much larger than mine). This works without any additional network connections, because the data is included in the HTML file.

On some web pages, I use userscripts to add accesskey attributes.

Sometimes, I will fix bugs on web pages by adding user scripts.

I find document.evaluate very useful in many of these cases and many other scripts I have written.

However, for many web pages, I find user CSS is useful and scripts do not need to be added. (Sometimes, I add both.)


👤 derkades
I only use userscripts for MusicBrainz: https://github.com/ROpdebee/mb-userscripts

It massively speeds up the process of adding new data, along with a-tisket.


👤 r87
I use one to clip coupons automatically. The store my wife and I get most of our groceries from issues a ton of coupons, and wants you to click them individually.

I have some RSI issues so manual was a non starter.


👤 srhtftw
I use Stylus to override design choice that don't work for me. Generally things like colors, fonts and hard-coded page widths. Sometimes I'll use Tampermonkey to alter content a bit.

Here is one I use to improve my experience on HN.

https://pastebin.com/JQY4cXfU


👤 jimmyswimmy
I can't deal with dates unless they include day of week. I wrote a very simple script (basically a regex) to add a letter indicating the day.

Also fun for changing website themes, extracting streams to files, augmenting games. Violentmonkey is my tool of choice for managing and live editing them.


👤 barryrandall
I have a list of domains/keywords that I use to suppress articles on Google/Hacker News/RSS feeds. It's mostly sites with ad blocker blockers, and the rest are a mix of politicians, internet celebrities, and news-like infotainment products.

👤 brudgers
In Firefox I use them to customize HN. For example font sizes and text colors.

👤 iamevn
I wrote a couple userscripts for myself at work that put the information I usually care about from job logs on gitlab right at the top of the page.

👤 Leftium
Some userscripts I wish existed:

- open discord thread in new tab (with ctrl-click)

- mark YouTube video as already watched with less than 5 clicks


👤 KomoD
a script for filtering posts on HN based on keywords with a toggle button, a script for holding down control to mass click "not interested" on youtube videos on hover (or alt for mass "do not recommend channel") and a script for some small reddit fixes