Fortunately, most customizations can be done via bookmarklets.
Benefits of bookmarklets:
- Easy to edit
- Inactive until clicked
- Work in all browsers
- Work on mobile
- Integrate nicely into the UI. You can move them around, put them into any bookmark folder, assign shortcuts.
I wrote this bookmarlet editor which makes it easy to convert between clean code and a bookmarklet:
https://www.gibney.org/bookmarklet_editor
Here is one that I use to read HN:
if (!location.href.match('ycom'))
location.href='https://news.ycombinator.com';
doTheMagic = function() {
if (typeof e!=='undefined')
e.style.background='#c0c0c0';
e=Array.from(document.querySelectorAll('.age a:not(.seen)')).sort().at(-1);e.style.background='#ff0';
e.classList.add('seen');
e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"});
}
doTheMagic();
if (typeof theMagicIsActive=='undefined') {
document.addEventListener("keydown", function(evnt) {
if (evnt.key === "n") doTheMagic();
});
theMagicIsActive = true;
}
When clicked and HN is not already opened, it opens HN. When on HN, it jumps to the next newest story. Or comment - it also works in the threads. After jumping to the newest story, clicking it again jumps to the next newest story. Instead of clicking it, pressing "n" also works.Also works in the comments view of a profile. So when you want to see if someone replied to your comments, you click on "comments" in your profile and then on the bookmarklet to jump to the newest reply.