Search code examples
javascripturlbookmarkletflickr

Simple Javascript bookmarklet question


First, I know very little about writing code or javascript - so be gentle. I had used a JavaScript bookmarklet (essentially a bookmark that would run simple code) in Firefox, because I'm lazy, to jump to the large size of an image in Flickr.

Example: going to a Flickr image you would get a URL that looked like this - http://www.flickr.com/photos/aloudnoise/5626322378/

The bookmarklet I had, that I cobbled together as a series of best guesses, was -

javascript:(function(){%20location.href%20=%20location.href%20+%20'sizes/l/';%20})();

This simply added "sizes/l/" to the end of the URL and saved me a couple of extra clicks.

Now, when you click on an image in Flickr the returned URL looks like this - http://www.flickr.com/photos/aloudnoise/5626322378/in/photostream

This broke my bookmarklet, as clicking it now appends the url to "/in/photostream/sizes/l/" which is not a valid Flickr URL.

I'd like to change the bookmarklet to simply replace "/in/photosteam" with "/sizes/l/"

Note: on an ethical note, the "sizes/l/" simply loads the large size of the image, if available and if ALLOWED by the uploader, it is not meant to, nor does it, side-step an uploaders settings in flickr. As I indicated, it just eliminates having to deal with a drop down box and a few extra clicks.


Solution

  • How about:

    javascript:(function(){location.href=location.href.replace('/in/photostream', '/sizes/l/')})();