Permalink
Browse files

Replace feedjs with talking directly to Flickr's API.

  • Loading branch information...
1 parent 230eee7 commit 874674da2a3363522eb795988d7f6dadf904a4dc @jschementi committed Jul 2, 2010
Showing with 15 additions and 17 deletions.
  1. +14 −8 public/app.js
  2. +1 −9 public/index.html
View
@@ -123,15 +123,21 @@ var renderBlogPost = function(post) {
return post_div;
}
-var generatePhotoFeed = function() {
+var generateHomepagePhotoFeed = function(rsp) {
+ if (rsp.stat != "ok") {
+ return;
+ }
$(document).ready(function() {
- $('#home-photos .rss-box').replaceWith($('#home-photos .rss-item p a img').parent().addClass('flickr'));
- $('#home-photos img').removeAttr('width').removeAttr('height');
- $('#home-photos img').each(function() {
- $(this).attr('src',
- $(this).attr('src').split('m.jpg')[0] + 's.jpg')
- $(this).parent().attr('rel', 'flickr-latest');
- });
+ for (i = 0; i < 20; i++) {
+ p = rsp.photos.photo[i];
+ thumbnail = "http://farm" + p.farm + ".static.flickr.com/" + p.server + "/" + p.id + "_" + p.secret + "_s.jpg";
+ page = "http://www.flickr.com/photos/jschementi/"+ p.id;
+ medium = "http://farm" + p.farm + ".static.flickr.com/" + p.server + "/" + p.id + "_" + p.secret + "_b.jpg";
+ a = $(document.createElement('a')).addClass('flickr').attr('href', medium).attr('rel', 'flickr-latest');
+ img = $(document.createElement('img')).attr('src', thumbnail);
+ a.html(img);
+ $('#home-photos').append(a);
+ }
$("a[rel='flickr-latest']").colorbox({width:"80%", height:"80%", iframe:true});
});
}
View
@@ -157,15 +157,7 @@
<div class='container' style='clear: none; margin-top:45em;'>
<div id="home-photos" class='section'>
<h2><a href='http://flickr.com/photos/jschementi' target='_blank'>Flickr</a></h2>
-
- <!--<script language="JavaScript" src="http://feed2js.org//feed2js.php?src=http%3A%2F%2Fapi.flickr.com%2Fservices%2Ffeeds%2Fphotos_public.gne%3Fid%3D24458122%40N00%26lang%3Den-us%26format%3Drss_200&amp;num=25&amp;html=a" type="text/javascript"></script>
- <noscript>
- <a href="http://feed2js.org//feed2js.php?src=http%3A%2F%2Fapi.flickr.com%2Fservices%2Ffeeds%2Fphotos_public.gne%3Fid%3D24458122%40N00%26lang%3Den-us%26format%3Drss_200&amp;num=25&amp;html=y">View RSS feed</a>
- </noscript>-->
-
- <script type='text/javascript'>
- generatePhotoFeed();
- </script>
+ <script type="text/javascript" src="http://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&api_key=1486775479faf0d20ae61c3cc1a137a8&user_id=24458122%40N00&format=json&jsoncallback=generateHomepagePhotoFeed"></script>
</div>
<!--

0 comments on commit 874674d

Please sign in to comment.