Created
July 23, 2012 10:31
-
-
Save kentfredric/3162993 to your computer and use it in GitHub Desktop.
manipulate the source of a PhotoBucket album so that it can be easily mass-downloaded.
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
jQuery(function($){ | |
// This is a script to manipulate the source of a PhotoBucket album so that it can be easily mass-downloaded. | |
// change the settings as per your requirements. | |
// copy-paste this source into your WebConsole ( in the WebDeveloper tools menu ) and run it, for great success. | |
var settings = { | |
images: false, | |
links: true, | |
description: true, | |
delete_original: true, | |
}; | |
var new_document = $(document.createElement('div')); | |
$('body').prepend(new_document); | |
$('div.thumbnail').each(function(index,elem){ | |
var content = $(elem).attr("pbinfo"); | |
content = content.replace(/'/g , '"' ); | |
var cdata = $.parseJSON(content); | |
var container = $(document.createElement("div")); | |
var img = $(document.createElement("img")).attr('src', cdata.mediaUrl ); | |
var desc = $(document.createElement('div')).text(cdata.mediaFilename ); | |
new_document.append(container); | |
var href = $(document.createElement('a')).attr('href',cdata.mediaUrl); | |
if ( settings.links && settings.images ) { href.append( img ); } | |
if ( settings.links && settings.description ) { href.append( desc ); } | |
if (( ! settings.links ) && settings.images ) { container.append( img ); } | |
if (( ! settings.links ) && settings.description ) {container.append( desc ); } | |
if ( settings.links ) { container.append( href ); } | |
}); | |
if( settings.delete_original ) { | |
$('body').empty().append(new_document); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment