There are 2 previous versions of this script.
// ==UserScript==
// @name Facebook Image Download Helper
// @version 0.4
// @date 2009-04-22
// @description Allows you to use a download manager such as DownThemAll! on Facebook image gallery pages.
// @namespace http://www.theworldofstuff.com/greasemonkey/
// @copyright Copyright 2007-2009 Jordon Kalilich (http://www.theworldofstuff.com/)
// @license GNU GPL version 3 or later; http://www.gnu.org/copyleft/gpl.html
// @include http://*.facebook.com/*
// ==/UserScript==
/*
Thumbnail: http://photos-d.ak.facebook.com/photos-ak-sf2p/v194/168/85/2033694/s2033694_46660227_5009.jpg
Actual: http://photos-d.ak.facebook.com/photos-ak-sf2p/v194/168/85/2033694/n2033694_46660227_5009.jpg
more recent examples:
thumb http://photos-f.ak.fbcdn.net/photos-ak-snc1/v2566/122/90/732231195/s732231195_2089629_1667721.jpg
actual http://photos-f.ak.fbcdn.net/photos-ak-snc1/v2566/122/90/732231195/n732231195_2089629_1667721.jpg
thumb http://photos-b.ak.fbcdn.net/hphotos-ak-snc1/hs031.snc1/3218_84768565126_642460126_2426481_27000_s.jpg
actual http://photos-b.ak.fbcdn.net/hphotos-ak-snc1/hs031.snc1/3218_84768565126_642460126_2426481_27000_n.jpg
*/
updateNotifier();
window.getImages = function() {
var allLinks = document.getElementsByTagName('a');
var links = new Array();
for (i = 0; i < allLinks.length; i++) {
if ((allLinks[i].href) && (allLinks[i].href.indexOf('photo.php?') > -1)) {
links.push(allLinks[i]);
}
}
if (links) {
// create hidden div for hidden links
var hideMe = document.getElementById('hideMe');
if (!hideMe) {
hideMe = document.createElement('div');
hideMe.id = 'hideMe';
with (hideMe.style) {
position: 'absolute !important';
top: '0px !important';
left: '0px !important';
zIndex: '-100 !important';
visibility: 'hidden !important';
}
}
else {
hideMe.innerHTML = '';
}
for (i = 0; i < links.length; i++) {
var image = links[i].getElementsByTagName('img')[0];
if (image) {
// we want photos-*.facebook.com urls, but not ones like "http://photos-815.ll.facebook.com/photos-ll-sctm/genericv2b/898/23/01AwcA9hkVuDcAAAABAAAAAAAAAAA:.jpg"
if ( (image.src.indexOf('photos') > -1) && (image.src.indexOf('facebook.com') > -1 || image.src.indexOf('fbcdn.net') > -1) && (image.src.indexOf('generic') == -1) && (image.src.indexOf('app') == -1) ) {
// strange bug: if the link has no style of its own and text of the link is more than one word, the link will be visible.
hideMe.innerHTML += '<a href="' + image.src.replace(/(\/|_)s(\d+_|\.[a-z]+)/i,'$1n$2') + '" style="visibility: hidden !important">Added by Facebook Image Download Helper</a>';
}
}
}
if (hideMe.innerHTML) {
document.getElementsByTagName('body')[0].appendChild(hideMe);
}
}
}
document.addEventListener('click', function(event) {
getImages();
}, true);
getImages();
// UPDATE NOTIFIER (Version 12: June 19, 2008)
// Usage Information: http://www.theworldofstuff.com/greasemonkey/updatenotifier.html
function updateNotifier() {
// PARAMETERS //
var scriptName = "Facebook Image Download Helper";
var scriptURL = "http://userscripts.org/scripts/show/24843";
var scriptVersion = 0.4;
var updateURL = "http://www.theworldofstuff.com/greasemonkey/facebookdownthemall.txt";
var updateInterval = 3600;
// END OF PARAMETERS //
var checkForUpdates = GM_getValue('checkForUpdates', true);
if (checkForUpdates == true) {
var lastCheck = GM_getValue('lastCheck', 0);
var d = new Date();
var currentTime = Math.round(d.getTime() / 1000); // Unix time in seconds
if (currentTime >= lastCheck + updateInterval) {
GM_xmlhttpRequest({
method: 'GET',
url: updateURL,
headers: {'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey','Accept': 'text/plain',},
onload: function(responseDetails) {
if (responseDetails.status == 200) {
var info = responseDetails.responseText;
function createNotice(noticeText) {
var notice = document.createElement('div');
with (notice.style) { id = 'GMscriptnotice'; position = 'fixed'; top = '0px'; left = '0px'; width = '100%'; background = '#ffeb7c'; zIndex = '50000'; textAlign = 'center'; font = '12px sans-serif'; fontWeight = 'normal'; color = '#000'; padding = '5px 3px 5px 3px'; margin = '0px'; borderTop = '0px'; borderRight = '0px'; borderBottom = '1px solid #beaf5d'; borderLeft = '0px'; }
notice.innerHTML = noticeText;
document.getElementsByTagName('body')[0].appendChild(notice);
if (document.getElementById('offLink')) {
document.getElementById('offLink').addEventListener('click', function(event) {
event.stopPropagation();
event.preventDefault();
var confirmTurnOff = confirm('Are you sure you no longer want to be notified of updates to this script?');
if (confirmTurnOff) {
alert('You will no longer be notified of updates to ' + scriptName + '. You can change this preference in about:config.');
GM_setValue('checkForUpdates', false);
notice.parentNode.removeChild(notice);
}
}, true);
}
if (document.getElementById('ignoreLink')) {
document.getElementById('ignoreLink').addEventListener('click', function(event) {
event.stopPropagation();
event.preventDefault();
alert('You will not be notified until the script is updated again.');
GM_setValue('ignoreVersionNumber', versionOnSite.toString());
notice.parentNode.removeChild(notice);
}, true);
}
document.getElementById('closeLink').addEventListener('click', function(event) {
event.stopPropagation();
event.preventDefault();
notice.parentNode.removeChild(notice);
}, true);
}
var linkStyle = 'color: #00f; text-decoration: underline; font: 12px sans-serif';
if (info.match(/^[\d\.]+/)) {
var ignoreVersionNumber = parseFloat(GM_getValue('ignoreVersionNumber', '0'), 10);
var versionOnSite = info.match(/[\d\.]+/);
if (info.indexOf(';') > 0) {
scriptURL = info.split(";")[1];
}
if ((versionOnSite > scriptVersion) && (versionOnSite > ignoreVersionNumber)) {
createNotice('An update to the Greasemonkey user script "' + scriptName + '" is available. You are using version ' + scriptVersion + '.<br /><a href="' + scriptURL + '" style="' + linkStyle + '; font-weight: bold" id="upgradeLink">Review changes and upgrade to version ' + versionOnSite + '</a> <a href="#" style="' + linkStyle + '; font-weight: normal" id="ignoreLink">Wait until next version</a> <a href="#" style="' + linkStyle + '; font-weight: normal" id="offLink">Turn off these notifications</a> <a href="#" style="' + linkStyle + '; font-weight: normal" id="closeLink">Close</a>');
}
}
else if (info.indexOf('-') == 0) { // if the script will no longer be maintained
GM_setValue('checkForUpdates', false);
if (info.indexOf(';') == 1) {
scriptURL = info.split(";")[1];
createNotice('The Greasemonkey user script "' + scriptName + '" will no longer be updated.<br /><a href="' + scriptURL + '" style="' + linkStyle + '; font-weight: bold" id="upgradeLink">More information</a> <a href="#" style="' + linkStyle + '; font-weight: normal" id="closeLink">Close</a>');
}
}
}
}
});
GM_setValue('lastCheck', currentTime);
}
}
} // END OF UPDATE NOTIFIER
