Skip to content

Instantly share code, notes, and snippets.

@lilyszajn
Created October 27, 2011 16:18
Show Gist options
  • Save lilyszajn/1320022 to your computer and use it in GitHub Desktop.
Save lilyszajn/1320022 to your computer and use it in GitHub Desktop.
how do i make these as a timeline??
<html>
<head>
<title></title>
<script src="http://code.jquery.com/jquery-1.4.2.min.js" ></script>
<script>
var apikey = "2794b427c3570f8b21835f18368f407a";
var photoid = "results.doc.photoid";
$(window).load(function()
{
$.ajax({
url: "www.itpcakemixcom/project/HI5SON!!?format=raw
",
dataType: 'jsonp',
success: function(data)
{
for(var i = 0; i < data.rows.length; i++)
{
var doc = data.rows[i].doc;
var date = new Date(doc.created_at);
date.setHours(date.getHours()+4);
var flickrUrl = "http://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key="+ apikey+"&photo_id="+ doc.photoid +"&format=json&jsoncallback=?";
$.ajax({
url: flickrUrl,
dataType:'jsonp',
success : function(flickrData)
{
$("#photos").append("<img src='"+flickrData.sizes.size[4].source+"' />");
$("#photos").append("<br />");
$("#photos").append(date.toString());
$("#photos").append("<br />");
}
});
//put date into array and count up in a for loop, then do something with the total number - could use js libr
//map number of times date shows up to 1-4 matching up with flickr sizes
}
}
});
});
</script>
</head>
<body>
<h1>Results</h1>
<div id="photos"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment