Skip to content

Instantly share code, notes, and snippets.

@plainas
Created February 6, 2012 01:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plainas/1748810 to your computer and use it in GitHub Desktop.
Save plainas/1748810 to your computer and use it in GitHub Desktop.
View on flickriver userscript
// ==UserScript==
// @name View on flifkriver
// @namespace http://lamehacks.net
// @description Adds links to flickriver on flickr group, user, tag and search pages
// @include http://*.flickr.com/*
// @match http://*.flickr.com/*
// ==/UserScript==
var groupRegex = new RegExp(".*?flickr.com/groups/([^\/]*)");
var matched = groupRegex.exec(window.location);
if(matched){
var riverurl = "http://www.flickriver.com/groups/"+ matched[1] +"/pool/interesting/";
document.getElementsByClassName("LinksNew")[0].innerHTML += ' | <span> <a href="'+ riverurl+'"> View on flickriver </a> </span> ';
}
var tagRegex = new RegExp(".*?flickr.com/photos/tags/([^\/]*)");
var matched = tagRegex.exec(window.location);
if(matched){
var riverurl = "http://www.flickriver.com/photos/tags/"+ matched[1] +"/interesting/";
document.getElementById("SSButtonHugger").innerHTML += ' <span class="slideshow-box"><a href="'+ riverurl+'"><span class="slideshow-link-wrapper">View on flickriver</span></a></span> ';
}
var userRegex = new RegExp(".*?flickr.com/photos/([^\/]*)");
var matched = userRegex.exec(window.location);
if(matched){
var riverurl = "http://www.flickriver.com/photos/"+ matched[1] +"/";
document.getElementsByClassName("LinksNew")[0].innerHTML += ' | <span ><a href="'+ riverurl+'">View on flickriver</a></span> ';
}
var searchRegex = new RegExp(".*?flickr.com/search/([^\/]*)");
var matched = searchRegex.exec(window.location);
if(matched){
var sphraseRegex = new RegExp(".*?q=([^&]*)");
var searchphrase = sphraseRegex.exec(matched[1]);
var riverurl = "http://flickriver.com/search/"+ searchphrase[1] +"/";
document.getElementsByClassName("ViewControls")[0].innerHTML += ' | <span ><a href="'+ riverurl+'">View on flickriver</a></span> ';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment