By Gary Cohen
Has no other scripts.
// ==UserScript==
// @name Flickr Ticker Link
// @description This script adds a link to the user's Flickr Ticker page (http://www.flickrticker.com/). It is almost entirely based on netomer's scout link gm script.
// @author Gary Cohen
// @version 1.1
// @namespace http://www.flickrticker.com/gm/
// @include http://flickr.com/photos/*
// @include http://www.flickr.com/photos/*
// @include http://flickr.com/groups/*
// @include http://www.flickr.com/groups/*
// ==/UserScript==
(function() {
var getElementsByClassName = function(clsName)
{
var elems = document.getElementsByTagName('*');
var j = 0;
var arr = new Array();
for (var i=0; (elem = elems[i]); i++) {
if (elem.className == clsName) {
arr[j] = elem;
j++;
}
}
return (arr.length > 0) ? arr : 'undefined';
}
var photos = function()
{
// the include wildcards match too many pages. we only want the index.
var onlyIndexRE = /.*\/photos\/([^\/]*)(\/)?$/gi;
if (!document.location.href.match(onlyIndexRE)) return;
addLink('userID');
}
var groups = function()
{
// the include wildcards match too many pages. we only want the index.
var onlyPoolRE = /.*\/groups\/([^\/]*)\/pool(\/)?$/gi;
if (!document.location.href.match(onlyPoolRE)) return;
addLink('groupID');
}
var addLink = function(idName)
{
var extras, header, userId, links, img, link;
links = getElementsByClassName("Links");
if (!links) {
return;
} else {
links = links[0];
}
var id = document.getElementsByTagName('link')[1].getAttribute('href').split('=')[1].split('&')[0];
img = document.createElement('img');
img.src = '/images/subnavi_dots.gif';
img.alt = '';
img.width = '1';
img.height = '11';
link = document.createElement('a');
link.href = 'http://www.flickrticker.com/gm/?gm=true&' + idName + '=' + id;
link.appendChild(document.createTextNode('Ticker'));
links.appendChild(img);
links.appendChild(link);
}
photos();
groups();
})();