Yeah, XPath syntax isn't exactly friendly. Actually I only used it because the (quite old) online resource I looked up about writing GreaseMonkey scripts put in its "Getting started" chapter [
commons.oreilly.com]
a section named "Master XPath expressions" and I duly obliged.
(IMG:[
invalid]
style_emoticons/default/biggrin.gif) (IMG:[
invalid]
style_emoticons/default/tongue.gif)
Probably rewriting the script to parse all the links in the gallery would work too and perhaps would make the script easier to port to browsers other than Firefox, but as the current version runs in
one millisecond (likely even less but that's the resolution of the console timer), I'm not in a rush to experiment...
As for the default opening in a new tab, IMO it kind of defeats the purpose. There are already multiple ways* to open a specific link in a tab, versus just one** for the reverse. However since it's a single line addition I've made a separate version and added it to the opening post.
Thanks for the kind comments.
* middle click; control key + left click; long press/right click --> "open in a new tab".
** to my knowledge, to force a default-new-tab link to open in the current tab the only way is to drag the link and drop it on the tab or the address bar; easy with a mouse, fiddly with a touchpad, impossible on touch screens ...