Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save decembre/b13e883caaefd2654498595a6b2d83af to your computer and use it in GitHub Desktop.
Save decembre/b13e883caaefd2654498595a6b2d83af to your computer and use it in GitHub Desktop.
Flickr - View on View on FlickRiver (2017 - Fork by Decembre)
// ==UserScript==
// @name Flickr - View on View on FlickRiver (2017 - Fork by Decembre) NO SET for Flickr Functional Suite
// @namespace http://lamehacks.net
// @description Adds links to flickriver on flickr group, user, tag and search pages
// @include http://*.flickr.com/*
// @grant none
// @include https://www.flickr.com/*
// @include https://flickr.com/*
// @exclude https://www.flickr.com/photos/*/sets/*
// @run-at document-end
// ==/UserScript==
// TEST RUN == @run-at document-start - NO
// http://stackoverflow.com/questions/26268816/how-to-get-a-greasemonkey-script-to-run-both-at-run-at-document-start-and-at-r
/*
document.addEventListener ("DOMContentLoaded", DOM_ContentReady);
window.addEventListener ("load", pageFullyLoaded);
function DOM_ContentReady () {
console.log ("==> 2nd part of script run.", new Date() );
}
*/
// OK - 2017 - TWEAK POOL PAGE
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("subnav-middle")[0].innerHTML += ' | <span> <a href="'+ riverurl+'"> Pool 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">Tags FlickRiver</span></a></span> ';
}
// TWEAK PHOTO PAGE
// RegExp(".*?flickr.com/photos/([^\/]*)")
//new RegExp("*?flickr.com\/photos\/([^\/]*)")
// OK for:
// https://www.flickr.com/photos/dingesmijn/5883891633/in/pool-portrait_faces_open_minded_
// WORKING :
// https://www.flickr.com/photos/35866663@N06/25837493794/
// WORKING :
// https://www.flickr.com/photos/outlierimagery/6783183314/in/pool-portrait_faces_open_minded_
// Working but need a special CSS (because OPACITY = O ):
// https://www.flickr.com/photos/outlierimagery/6783183314#comment72157648274250375
// OK - 2017 - PHOTO PAGE only - MATch too ALBUM with / without PRO BADGE - ( but SET DISABLE by exclude)
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("attribution-info")[0].innerHTML += ' | <span ><a href="'+ riverurl+'">F.F.S + FlickRiver</a></span> ';
}
// WORK - 2017 - ALBUM PAGE - DIABLE for Pb FLICKR FUNCTIONAL SUITE - ( but ALBUM DISABLE too by exclude)
// TEST LINK no badge : https://www.flickr.com/photos/houzyep/albums/72157622252159034
// .*?flickr.com\/.*\/albums\/
/*
var userRegex = new RegExp(".*?flickr.com\/.*\/albums\/)");
var matched = userRegex.exec(window.location);
if(matched){
var riverurl = "http://www.flickriver.com/photos/"+ matched[1] +"/";
document.getElementsByClassName("attribution-info")[0].innerHTML += ' | <span ><a href="'+ riverurl+'">View on flickriver</a></span> ';
}
*/
// wORK but - DIABLE for Pb FLICKR FUNCTIONAL SUITE - TEST SETS PRO BADGE
// TEST LINK OK : https://www.flickr.com/photos/44313561@N04/sets/72157622676208923
/*
var userRegex = new RegExp(".*?flickr.com\/.*\/sets\/)");
var matched = userRegex.exec(window.location);
if(matched){
var riverurl = "http://www.flickriver.com/photos/"+ matched[1] +"/";
document.getElementsByClassName("attribution-info")[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