Created
February 6, 2012 01:27
-
-
Save plainas/1748810 to your computer and use it in GitHub Desktop.
View on flickriver userscript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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