By Jordon Kalilich
Has 27 other scripts.
// Facebook Image Download Helper, a Greasemonkey user script
// Version 0.1 - April 6, 2008
// Copyright 2007-2008 Jordon Kalilich (http://www.theworldofstuff.com/)
// Released under the GPL version 3
// http://www.gnu.org/copyleft/gpl.html
//
// ==UserScript==
// @name Facebook Image Download Helper
// @namespace http://www.theworldofstuff.com/greasemonkey/
// @description Allows you to use a download manager such as DownThemAll! on Facebook image gallery pages.
// @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
*/
updateNotifier();
var images = document.getElementsByTagName('img');
if (images) {
// create hidden div for hidden links
var hideMe = document.createElement('div');
with (hideMe.style) {
position: 'absolute !important';
top: '0px !important';
left: '0px !important';
zIndex: '-100 !important';
visibility: 'hidden !important';
}
for (i = 0; i < images.length; i++) {
if ( (images[i].src.indexOf('photos') > -1) && (images[i].src.indexOf('facebook.com') > -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="' + images[i].src.replace(/\/s(\d+_)/i,'/n$1') + '" style="visibility: hidden !important">Added by Facebook Image Download Helper</a>';
}
}
if (hideMe.innerHTML) {
document.getElementsByTagName('body')[0].appendChild(hideMe);
}
}
// UPDATE NOTIFIER (Version 8: March 10, 2008)
function updateNotifier() {
var scriptName = "Facebook Image Download Helper";
var shortName = "facebookdownthemall";
var scriptID = "24843";
var scriptVersion = 0.1;
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 + 3600) { // (number of seconds in 1 hour
GM_xmlhttpRequest({
method: 'GET',
url: 'http://www.theworldofstuff.com/greasemonkey/' + shortName + '.txt',
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 = '1000'; 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);
document.getElementById('upgradeLink').addEventListener('click', function(event) {
notice.parentNode.removeChild(notice);
}, true);
document.getElementById('waitLink').addEventListener('click', function(event) {
event.stopPropagation();
event.preventDefault();
alert('You will be notified again in one week.');
GM_setValue('lastCheck', currentTime + 601200); // 1 week minus 1 hour (will be set after the one below)
notice.parentNode.removeChild(notice);
}, true);
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);
}
var linkStyle = 'color: #00f; text-decoration: underline; font: 12px sans-serif';
if (info.match(/[\d\.]+/)) {
var versionOnSite = info.match(/[\d\.]+/);
var updateURL = 'http://userscripts.org/scripts/show/' + scriptID;
if (info.indexOf(';') > 0) {
updateURL = info.split(";")[1];
}
if (versionOnSite > scriptVersion) {
var noticeText = 'An update to the Greasemonkey user script "' + scriptName + '" is available. You are using version ' + scriptVersion + '.<br /><a href="' + updateURL + '" style="' + linkStyle + '; font-weight: bold" id="upgradeLink" target="_blank">Review changes and upgrade to version ' + versionOnSite + '</a> <a href="#" style="' + linkStyle + '; font-weight: normal" id="waitLink">Notify me later</a> <a href="#" style="' + linkStyle + '; font-weight: normal" id="offLink">Turn off these notifications</a>';
createNotice(noticeText);
}
}
else if (info.indexOf('-') == 0) { // if the script will no longer be maintained
GM_setValue('checkForUpdates', false);
}
}
}
});
GM_setValue('lastCheck', currentTime);
}
}
} // END OF UPDATE NOTIFIER