By Lee Kelleher
Has 3 other scripts.
// ==UserScript==
// @name Last.fm Event Tags on Flickr
// @namespace http://code.leekelleher.com/
// @description This is a greasemonkey script that associates a Flickr page with a Last.fm Event. When a photo is associated to an event (using a Last.fm machine-tag, e.g. "lastfm:event=148549"), a link will appear to the Last.fm Event information page.
// @version 1.0
// @identifier http://code.leekelleher.com/greasemonkey/lastfmflickrtags.user.js
// @date 2007-06-11
// @creator Lee Kelleher (lee@vertino.net)
// @include http://*flickr.com/photos/*
// ==/UserScript==
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script.
//
// To install, you need Greasemonkey: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
//
// --------------------------------------------------------------------
// Copyright (C) 2007 Lee Kelleher
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// The GNU General Public License is available by visiting
// http://www.gnu.org/copyleft/gpl.html
// or by writing to
// Free Software Foundation, Inc.
// 51 Franklin Street, Fifth Floor
// Boston, MA 02110-1301
// USA
var getTags = document.getElementsByTagName('a');
var lastfmTest = new RegExp("^lastfm:", "i");
var lastfmTags = new Array();
// helping vars
var splitTag = new Array();
var splitValue = new Array();
// loop through all the machine-tags
for (var i = 0; i < getTags.length; i++)
{
if (getTags[i].className == 'Plain')
{
if (lastfmTest.test(getTags[i].innerHTML))
{
splitTag = getTags[i].innerHTML.split(":");
splitValue = splitTag[1].split("=");
lastfmTags[splitValue[0]] = splitValue[1];
}
}
}
var lastfm_image = 'data:image/gif;base64,R0lGODlhNwAYAOYAAGxsbHt7e+vr6+rq6peXl3R0dOTk5I6Ojufn58nJyYaGhsLCwuLi4nJycoeH' +
'h25ub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BNdfXF0ud5l+uNpuJcgPO7yvvq7++i' +
't91Ba+BPduBQd9QNQ+FTeemDn9w6ZvfT3fbO2dQKQfbK1vrh6PbL1/3199kmV/vo7eh6mPXI1MDA' +
'wPCpvNs1YtcbTvvr79QORN9Lc/3y9fnf5uFXffK4yOmCnuFUetMDO/rj6eFVe+ZxkeBSefK0xZqa' +
'mpubm9IAOQAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5' +
'BAAAAAAALAAAAAA3ABgAAAf/gEuCg4SFhoeIiYlIio2Oj4hHkJOUi5WXmJKDSZydnp6YlYyCn6Wf' +
'oZOaS6asSYNKhEqwgrKztbSyS7O6g6OrraWvwry7w7y4uruqnDcWPAAzJJwaLCkynMa1tsW7t7Df' +
'g8sKExtAIh0vBisDGCMPJa60w9zZ9YK+SSEfnh4AEQAEQOECRyyXMILHEuJD0MNTEBcUiIA4UKBB' +
'PFSO8CUo8slAixwCfuC4cBGjomU1AniyIUBFBU5DHJQcmPBbrm7JiglaBiODERQSOOwgYCKGjgUH' +
'fMysefCVLXmGliWBEGCAEAYFOJ1AkCCAgKW3iNEE9zTqJmCnCtEre8ygzntnOtF2MhS25s15h/DJ' +
'nWuyka9fcvs6UiW48N/CfQkjNnkEiePGRxojkRz58eTLlitPpoyZcmTInJHQCAQAOw==';
if (lastfmTags['event'])
{
imgLastFm = document.createElement('img');
imgLastFm.setAttribute('src', lastfm_image);
imgLastFm.setAttribute('onmouseover', 'javascript:this.src="' + lastfm_image_over + '";');
imgLastFm.setAttribute('onmouseout', 'javascript:this.src="' + lastfm_image + '";');
lnkLastFm = document.createElement('a');
lnkLastFm.setAttribute('href', 'http://www.lastfm.com/event/' + lastfmTags['event']);
lnkLastFm.setAttribute('target', '_blank');
lnkLastFm.appendChild(imgLastFm);
document.getElementById('button_bar').appendChild(lnkLastFm);
}