GreaseMonkey Script - Flickr Photo Set Orginal File Download Links

This is a GreaseMonkey script which let you to get the links of all the orginal file links, which you have uploaded into flickr, in the photo set display page itself. I am thinking of extending this to download all the photos in a single click, if anyone has any ideas please post those as comments.

I tested this out on Firefox 1.5.0.8

Requirements: FireFox, GreaseMonkey

Please do post in you comments....

Filename: flickrphotosetdownload.user.js

// A Script that lets you to get the orginal photos links for a eacho photo in your photo set from flickr
// ==UserScript==
// @name Flickr Photo Set Download
// @namespace http://k5rec.blogspot.com
// @description get the orginal photos links for a eacho photo in your photo set from www.flickr.com
// @include http://www.flickr.com/photos/*/sets/*
// ==/UserScript==

var orgsize = new Array();
var orgname = new Array();
var count = 0;
tumbnails=document.getElementById('setThumbs');
for( i=0; i < tumbnails.childNodes.length; i++) {
node = tumbnails.childNodes[i];
if (node.className == "thumb_link") {
childnode = node.childNodes[0];
var imglink = childnode.attributes.getNamedItem('src').value;
imglink = imglink.replace('_s.jpg','_o_d.jpg');
if ( imglink != "undefined" ) {
var imgname = childnode.attributes.getNamedItem('alt').value;
orgsize[count] = imglink;
orgname[count++] = imgname
}
}
}

tumbtbody = document.getElementById('ViewSet').getElementsByTagName('tbody')[0];
var row = document.createElement("tr");
var cell = document.createElement("td");
cell.setAttribute('colspan','2');
cell.setAttribute('border','1');
cell.setAttribute('align','center');
cell.innerHTML='\tDownload the Original Files: (Greasemonkey script by http://k5rec.blogspot.com
';
var innertable = document.createElement("table");
for(i = 0; i < count; i += 5) {
var inrow = document.createElement("tr");
for(j=0;((j<5) && ( (i + j) < count));j++) {
var incell = document.createElement("td");
incell.innerHTML = (i+j+1)+'. ';

var imgloc = document.createElement("a");
imgloc.setAttribute('title',orgname[i+j]);
imgloc.setAttribute('href',orgsize[i+j]);
imgloc.innerHTML = orgname[i+j];

incell.appendChild(imgloc);
inrow.appendChild(incell);
}
innertable.appendChild(inrow);
}
cell.appendChild(innertable);
row.appendChild(cell);
tumbtbody.appendChild(row);

Note: Make sure append .user.js in the filename

Note: I am a novice in java and greasemonkey scripting and this is my first script..... :)