Created
March 10, 2009 13:14
-
-
Save ecarnevale/76890 to your computer and use it in GitHub Desktop.
A greasemonkey script to automatically redirect a flickr page to IHardlyKnowHer
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 IHardlyKnowHer | |
// @namespace http://emanuelcarnevale.com | |
// @include http://flickr.com/* | |
// @include http://www.flickr.com/* | |
// @exclude http://www.flickr.com/photos/friends/* | |
// ==/UserScript== | |
function get(url, cb) { | |
GM_xmlhttpRequest({ | |
method: "GET", | |
url: url, | |
onload: function(xhr) { cb(xhr.responseText,url) } | |
}) | |
} | |
function goIfAuthorized(text,newLocation) { | |
//a dumb dumb way to check if the user authorized IHKH to show his photos, but hey, it's just a quick hack ;) | |
if(!text.match("<div class=\"default\">")){ | |
window.location.href = newLocation; | |
} | |
} | |
(function() { | |
var newLocation = window.location.href.replace(/flickr\.com\/photos/, 'ihardlyknowher\.com'); | |
get(newLocation, goIfAuthorized); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment