Fairlight Works

Official blog of the High Weald Light Railway (1977) Co. Ltd.

Bookmarklet for Flickr BBcode

hacks photos

If you use Flickr to store photos and wish to easily generate link code to show images in posts on NGRM (or other forums which use the BBcode syntax), simply drag the link below to your browser’s bookmark bar (usually immediately below the address bar).

Once you’ve done this, when viewing any photo on Flickr you can click on the bookmark and then copy and paste the code in the message box.

[Flickr BBcode](javascript:(function()%20%7Bvar%20url=location.href;%20if%20(url.match(/http://(www.)?flickr.com//))%20%7Bimg=document.getElementsByTagName('img');for%20(i=0;i<img.length;i++)%20%7B%20if%20(img%5Bi%5D.className=='reflect')%20%7B%20preview=%7B'src':img%5Bi%5D.src.split('?')%5B0%5D%20%7D%20%7D%20%7D%20if%20(preview)%20%7B%20bbsnippet='%5Burl='+url+'%5D%5Bimg%5D'+preview.src+'%5B/img%5D%5B/url%5D';%20alert(bbsnippet);%20%7D%20%7Delse%7Balert('You're%20not%20on%20Flickr!');%7D%20%7D)() "Flickr BBcode")

I can probably add versions for other image services on request but would need to look at how their pages are laid out.