4 ms·
I miss: bookmarklets and user scripts I use bookmarklets all the time. I can't imagine living without them. For example, this is how I read HN: https://twitte
by mg 4y ago
I miss: bookmarklets and user scripts
I use bookmarklets all the time. I can't imagine living without them. For example, this is how I read HN:
https://twitter.com/marekgibney/status/1551483561621979136 https://twitter.com/marekgibney/status/1551483561621979136
The bookmarklet takes me to the latest HN post I have not seen. When I click it again, it takes me to the next I have not seen. As soon as I see a post I have seen before, I know I am up to date.
I can't imagine reading HN any other way. Because otherwise, I would have to skim the whole front page to see what's new.
It also works on threads. So, when I post something on HN and want to see the latest replies, the same bookmarklet does this for me.
I have bookmarklets for every site I use frequently.
- schwartzworld 4y agoI use then to automate annoying workflows for FE development. Sometimes you need to click through a series of things to get the UI into the state you need. A bookmarklet is a perfect solution.
- lanktastic 4y agoCheck out Facebook’s Storybook if you haven’t already. It’s life changing when you don’t have to click through an app to get the state you need.
- lobstrosity420 4y agoStorybook is awesome. Just wanted to clarify is has nothing to do with Facebook or Meta.
- geraldwhen 4y agoIt is also trivial to turn storybook into visual regression tests.
- b15h0p 4y agoDo you have a link? I have a really hard time googling this.
- capableweb 4y agohttps://storybook.js.org/ https://storybook.js.org/
- petra 4y agoThat looks great. Is there something similar for comments ?
- mg 4y agoThe HN structure is the same for top level posts and comments. So the bookmarklet works for both.
- geuis 4y agoThis has me really confused. The example you shared in that tweet is very misformed code that I cannot get to run anywhere.
- lioeters 4y agojavascript:if (typeof e!=='undefined') e.style.background='#ccc'; e=Array.from(document.querySelectorAll('.age%20a:not(.s)')).sort().at(-1); e.style.background='#ff0';e.classList.add('s'); e.scrollIntoView({behavior:"smooth",block:"center",});{} Looks like the code got mangled in the Twitter post, in particular the curly braces at the end. And the line order, "e=" should be at the beginning logically. javascript:e=Array.from(document.querySelectorAll('.age%20a:not(.s)')).sort().at(-1); if (typeof e!=='undefined') { e.style.background='#ccc'; e.style.background='#ff0'; e.classList.add('s'); e.scrollIntoView({behavior:"smooth",block:"center"}); }
- mg 4y agoIt is all one line. Yes, Twitter formats it in a way that makes it impossible to copy just the text. Because it thinks that .style is a toplevel domain and #ccc is a hashtag. Here is a repo from which it is easy to copy: https://github.com/no-gravity/hn-bookmarklet https://github.com/no-gravity/hn-bookmarklet
- javajosh 4y agoDid you write this? If so, why did you add the "{}" at the end? Also, can't you use newlines in bookmarklets?
- mg 4y agoYes, I wrote it. The {} prevents the code from evaluating to a value that the browser then would use as the new value for the DOM, overwriting the existing page. Try bookmarking javascript:123 and see what happens when you click it. Bookmarklets are URLs, so a newline in the code would be urlencoded as %0A. So you could do: javascript:alert(1)%0Aalert(2) But I would prefer: javascript:alert(1);alert(2)
- lioeters 4y agoAh that's nice, thank you. Sorry I mis-rewrote when I tried to correct what was copied from Twitter. It addeded some extraneous "https:// https://" too. javascript:if (!location.href.match('ycom')) {location.href='https://news.ycombinator.com'};if (typeof e!=='undefined') e.style.background='#c0c0c0';e=Array.from(document.querySelectorAll('.age%20a:not(.seen)')).sort().at(-1);e.style.background='#ff0';e.classList.add('seen');e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"});{} I see, that {} at the end is intentional, as you described in another comment. And accessing the variable e before assigning it a value, now I see that probably serves a practical purpose too.
- slowmovintarget 4y agohttps://hckrnews.com/ https://hckrnews.com/
- muyuu 4y agolast I checked archive.is had killed its bookmarklet, which is very annoying haven't checked in a while though, maybe there are workarounds