Display Google Reader Shared Items in Posterous

Display Google Reader Shared Items in Posterous Web Posterous

Just a quicky, here is some code that uses jQuery to display your shared items feed from Google Reader.

Click here to see it on dropbox.

If you bang this code into dropbox and embed it as an iframe, you can use Google Reader to create a list of URLs you want to share in Posterous – maybe on the sidebar?

It’s all client side so the feed updates instantly without caching. Basically it uses the Google API to create a JSON feed which then is ripped through and displayed by jQuery.

Change the data.items.length to adjust the number of displayed items and change the feed URL to your own unless you want to display my items! You will also need to style it to match your own style sheet.

1
2
3
4
5
6
7
8
9
10
11
12
13
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
     $(document).ready(function() {
var url = "http://www.google.com/reader/public/javascript/feed/http://www.google.com/reader/public/atom/user%2F01019311013388988458%2Fstate%2Fcom.google%2Fbroadcast?callback=?";
$.getJSON(url,
function(data) {
for(var i = 0; i < data.items.length && i < 5; i += 1)
$('.grJSON').append('<li>' + '<h4>' + '<a target="_blank" href="' + data.items[i].alternate.href + '">' + data.items[i].title + '</a>' + '</h4>' + '<br />');
$('.grJSON').wrapInner('<ul></ul>');
});
});
</script>
<div class="grJSON"></div>

Related:

About Richard Mackney

Sharer of thoughts and Photography from an iPhone while touring the UK in a Caravan and drinking Beer. Co-creator of @fishmedia and two small fry.

  • Michael Litman