Skip to content

Instantly share code, notes, and snippets.

@nataliepo
Forked from btrott/gist:444317
Created June 18, 2010 23:32
Show Gist options
  • Save nataliepo/444363 to your computer and use it in GitHub Desktop.
Save nataliepo/444363 to your computer and use it in GitHub Desktop.
photo gallery widget from a blog
<!DOCTYPE html>
<html><head>
<meta charset="utf-8">
<title>Gallery</title>
</head><body>
<div id="gallery-widget"></div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
var blogId = '6a0133f05b13cc970b0134838b98a2970c';
$( document ).ready( function() {
$.getJSON(
'http://api.typepad.com/blogs/' + blogId + '/post-assets/@by-category/Gallery.js?callback=?',
{ 'max-results': 20 },
function( data ) {
$.each( data.entries, function( idx, asset ) {
$.each( asset.embeddedImageLinks, function( idx, link ) {
if ( link.urlTemplate ) {
var src = link.urlTemplate.replace( '{spec}', '320pi' );
var html = '<a href="' + asset.permalinkUrl + '"><img src="' + src + '" /></a>';
$( '#gallery-widget' ).append( html );
}
} );
} );
}
);
} );
</script>
</body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment