My Firefox bookmarklet to see links I've visited more reliably

December 19, 2021

I want to make links that I've already visited be clearly visible in Firefox, so that I can avoid re-reading links that I've already read. My first solution to this was to use the Firefox Stylus addon to write a brute force rule for frequently visited sites, which forced the a:visited colour to the special 'VisitedText' colour that Firefox provides. Later, when I wrote about bookmarklets versus addons, it occurred to me that a bookmarklet was a great use for this in general; I don't always need it and don't necessarily want it, but a bookmarklet would let me try to fix sites with a click and then said I didn't know enough to write it. In a comment on that entry, seth shared a bookmarklet to do a large scale restyling. I took that and turned it into a simpler version that duplicated my Stylus effort.

My current 'v' bookmarklet (it has a short name to take up as little space as possible in my tab bar) is:

   var css=document.createElement('style');
   css.innerHTML='a:visited {color: VisitedText !important;}';

Well, it is that with some indentation stripped out and run through the Vim operation ':%s/\(\n\| \)\+/%20/g', from seth's comment.

I was going to say that you could do a version of seth's full bookmarklet with using Firefox's system colours to get your browser's default colours, but it turns out that this isn't quite as simple as it looks because the normal web page foreground and background colours don't seem to be available unless you go for Firefox specific CSS colour names. I think you would want something like this:

   var css=document.createElement('style');
      * {background: -moz-default-background-color !important;
         color: -moz-default-color !important; }
      :link, :link * {color: LinkText !important;}
      :visited, :visited * {color: VisitedText !important;}';

Right now I don't feel like I want to go this far often enough to have this bookmarklet in my tab bar. Partly this is because websites that have terrible colours often have other design and layout flaws, so I'm most likely going to reach for 'View in no style' or Firefox's Reader mode. Well, after I try one brute force solution. But fortunately, completely terrible colours are uncommon, perhaps because they're so obvious, far more so than other sorts of unreadable design (like tiny fonts).

Written on 19 December 2021.
« Some brief notes for myself on growing a LVM root filesystem
Some usage notes for the Linux ss program »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sun Dec 19 23:29:27 2021
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.