Created
January 6, 2011 05:57
-
-
Save poppen/767587 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function jsonFlickrApi(data) { | |
var photos = []; | |
var randOrd = function() { | |
return (Math.round(Math.random()) - 0.5); | |
}; | |
$.each(data.photoset.photo, function(i,p) { | |
var get_url = function(url) { | |
return url; | |
}; | |
var get_alt = function(title) { | |
try { | |
return p.title; | |
} catch(e) { | |
return ""; | |
} | |
}; | |
photos.push({ | |
src: get_url(p.url_m), | |
alt: get_alt(p.title), | |
}); | |
}); | |
photos.sort(randOrd); | |
$("#dump").append($.dump(photos)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment