My first Greasemonkey Script

flickr_logo_gammaIt’s been years since I did any Javascript programing, but I had a simple problem and decided to dive into it.

Like many of the little programs I write, I had a “problem” and wanted to solve it. I wanted a convenient link on the photo page to cut and paste the short URL of FLickr Images.  Look at this URL for a nice photo my wife took:

As a URL goes, not too bad, but suppose you wanted to insert the link in
Twitter or Facebook? It’s a little verbose.  Wouldn’t this be better?

Yep, I think so too and so does Flickr:
This thread showed how to do it:

The FlickrBase58 function in the script was written entirely by ‘Xenocryst @ Antares Scorpii’

Other than reformating, taken verbatim from link here

The Original way *I* wrote it was to retrieve the HTML, Parse it for
<link rev=”canonical” type=”text/html” src=”//″ >

And use that link. While fun to write, that’s the wrong way to do it so I rewrote it to use the function written by ‘Xenocryst @ Antares Scorpii’ .  When installed on Firefox running the Greasemonkey extension, it will insert a link on the page on the right side just under “Flag your photo” that says:

The link is:

This will allow you to right click the URL, copy it and paste into Twitter or Facebook.

Here is the script.

NOTE: I’m pretty certain it’s harmless, but use at your own risk. It’s hardly great programming and I’m sure someone else would have done it too, if not better.

Music I’m listening to right Now:
Paralyzer ” by Finger Eleven from the “Them VS. You VS. Me” Album.

4 responses to “My first Greasemonkey Script

  1. Stefan, the “@namespace” you provided in the script does not link to ( does not work. Maybe you should link it to a redirect to this posting.

    • Well, the namespace is typically used to differentiate scripts with the same name but by different authors. In this case, the namespace is used to show where to get it from. See here at “Dive into Greasemonkey”.

  2. Is there a way to get a link similar to this to go to a Set or a Collection?

    Or does the site just not work that way?

  3. Well, I’ve played with it a bit and so far, it looks like nope.