Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
54 lines (52 sloc) 1.77 KB
<!DOCTYPE html>
<html lang="en">
<head>
<title>Vancouver Photos every 60 seconds: Owner, Id Lat/Lon</title>
</head>
<body>
<ol>
<div id="dummy">
</div>
</ol>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script>
(function($){
$.ajaxSetup({
cache: false // turn off AJAX caching
});
function doIt() {
var d = new Date();
var now = Math.round(d.getTime() * 0.001);
var n_str = now + '';
var intervalToSearchForGeoTaggedPhotos = now - 1200; // 60 * 20 == 20 minutes ago
var intervalToSearchForGeoTaggedPhotos_str = intervalToSearchForGeoTaggedPhotos +'';
var apiKey = 'a3b9e1fec66dfb1797c7414dfbb81974';
var woeID = '9807';
$.getJSON("http://api.flickr.com//services/rest/?method=flickr.photos.search"+
"&api_key="+apiKey+
"&format=json&content_type=1&woe_id="+woeID+
"&per_page=10&min_upload_date="+intervalToSearchForGeoTaggedPhotos_str+
"&extras=date_taken,geo,url_sq,url_t,url_s,url_m,url_o,url_z,url_l"+
"&max_upload_date="+n_str+
"&page=1&sort=date-posted-desc&jsoncallback=?",
function(flickrjs){ //flickrjs is the JSON object from flickr
if (parseInt(flickrjs.photos.total) == 0) {
$("#dummy").append("<li>No Vancouver geotagged photos at:"+d.toLocaleString()
+" pages:"+flickrjs.photos.pages+" status:"+flickrjs.stat+
"</li>");
}
else {
$.each(flickrjs.photos.photo,function(i,photo) {
$("#dummy").append("<li><a href=\"http://flickr.com/photos/"+photo.owner+
"/"+photo.id+"/\"><img src=\""+photo.url_s+"\" /></a><p>Latitude:"+photo.latitude+" Longitude:"+
photo.longitude+"</p></li>");
});
}
});
setTimeout(doIt, 60000);
};
setTimeout(doIt, 1000);
})(jQuery);
</script>
</body>
</html>