Skip to content

Commit

Permalink
Refactored flickr code
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmorrison committed May 7, 2009
1 parent 82411f8 commit 9947ea6
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions index.html
Expand Up @@ -9,23 +9,6 @@
container.append($(item));
return $(item);
}


function jsonFlickrApi(data) {
$.each(data.photos.photo, function(i,photo){
//notice that "t.jpg" is where you change the
//size of the image
var t_url = "http://farm" + photo.farm +
".static.flickr.com/" + photo.server + "/" +
photo.id + "_" + photo.secret + "_" + "m.jpg";

var p_url = "http://www.flickr.com/photos/" +
photo.owner + "/" + photo.id;

push($('#flickr'), $("<img/>").attr("src", t_url).attr("class", 'flickr'))
.wrap("<li style='display: none'><a href='" + p_url + "'></a></li>");
});
}

function showNext(container) {
$('li:hidden:last', container).slideDown('slow');
Expand All @@ -49,7 +32,21 @@

function fetchFlicks() {
if ($('#flickr li:hidden').size() < 10) {
$.getJSON("http://api.flickr.com/services/rest/?callback=?&format=json&method=flickr.photos.search&text=%22tulip%20time%22%20OR%20%22tech%20embassy%22&tag_mode=all&api_key=f9eed8709bd8c9663f988960cbdad53f&jsoncallback=jsonFlickrApi")
$.getJSON("http://api.flickr.com/services/rest/?format=json&method=flickr.photos.search&text=%22tulip%20time%22%20OR%20%22tech%20embassy%22&tag_mode=all&api_key=f9eed8709bd8c9663f988960cbdad53f&nojsoncallback=?jsonFlickrApi", function(data) {
$.each(data.photos.photo, function(i,photo){
//notice that "t.jpg" is where you change the
//size of the image
var t_url = "http://farm" + photo.farm +
".static.flickr.com/" + photo.server + "/" +
photo.id + "_" + photo.secret + "_" + "m.jpg";

var p_url = "http://www.flickr.com/photos/" +
photo.owner + "/" + photo.id;

push($('#flickr'), $("<img/>").attr("src", t_url).attr("class", 'flickr'))
.wrap("<li style='display: none'><a href='" + p_url + "'></a></li>");
});
})
}
window.setTimeout(fetchFlicks, 120000);
}
Expand Down

0 comments on commit 9947ea6

Please sign in to comment.