Created
May 18, 2015 18:25
-
-
Save AntoineTurmel/0165ffacca59441045b8 to your computer and use it in GitHub Desktop.
Flickr RSS feed
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 Flickr RSS Feed | |
// @name:fr Flux RSS Flickr | |
// @namespace https://greasyfork.org/fr/users/11510-antoine-code | |
// @author Antoine Turmel | |
// @version 1.0.2 | |
// @description Adds back RSS feeds to Flickr galleries | |
// @description:fr Réajoute le flux RSS des galeries Flickr | |
// @icon https://cloud.githubusercontent.com/assets/119288/7681140/9284a93e-fd6d-11e4-8854-89ab643b600a.png | |
// @icon64 https://cloud.githubusercontent.com/assets/119288/7681134/811317e4-fd6d-11e4-8350-2dac0d5f0d66.png | |
// @include *://*flickr.*/photos* | |
// @grant none | |
// @run-at document-end | |
// @updateVersion 1.0.2 | |
// ==/UserScript== | |
function addJQuery(callback) { | |
var script = document.createElement("script"); | |
script.setAttribute("src", "https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"); | |
script.addEventListener('load', function() { | |
var script = document.createElement("script"); | |
script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();"; | |
document.body.appendChild(script); | |
}, false); | |
document.body.appendChild(script); | |
} | |
function main() { | |
// Get the Flickr NSID from the cover image url | |
//alert(jQ('div.coverphoto:first').css("background-image").split("coverphoto/")[1].split('_')[0]); | |
var nsid = jQ('div.coverphoto:first').css("background-image").split("coverphoto/")[1].split('_')[0]; | |
var rssfeed = "https://api.flickr.com/services/feeds/photos_public.gne?id="; | |
function injectLink(nsid) { | |
var scr = document.createElement('link'); | |
scr.rel="alternate"; | |
scr.type="application/rss+xml"; | |
scr.title="RSS"; | |
scr.href="https://api.flickr.com/services/feeds/photos_public.gne?id="+nsid; | |
document.getElementsByTagName('head')[0].appendChild(scr) | |
} | |
injectLink(nsid); | |
} | |
// load jQuery and execute the main function | |
addJQuery(main); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment