Team:TU Delft/fb display
From 2010.igem.org
(Difference between revisions)
(New page: <html> <div id="fb_scriptload"></div> <div id="photobox"></div> <script type="text/javascript"> var albumName = "</html>{{{album}}}<html>"; function fb_albums(response) { for(var i in...) |
|||
Line 5: | Line 5: | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
- | var | + | // 133985909951582 |
+ | var albumID = "</html>{{{album}}}<html>"; | ||
- | function | + | function fb_photos(response) { |
for(var i in response.data) { | for(var i in response.data) { | ||
var item = response.data[i]; | var item = response.data[i]; | ||
- | + | // $("#photobox").append(item.name + "<br>"); | |
} | } | ||
var n = 6; // select 6 random pictures | var n = 6; // select 6 random pictures | ||
+ | var imghtml = ""; | ||
for(var i=0;i<n;i++) { | for(var i=0;i<n;i++) { | ||
- | + | var x = Math.random()*response.data.length; | |
+ | var imgSmall = response.data[x].picture; | ||
+ | imghtml += '<img src=\"'+imgSmall+'">'; | ||
} | } | ||
+ | $("#photobox").html(imghtml); | ||
} | } | ||
+ | |||
$(function() { | $(function() { | ||
- | var baseurl = "https://graph.facebook.com | + | var baseurl = "https://graph.facebook.com/"; |
function addScript(url) { | function addScript(url) { | ||
Line 28: | Line 34: | ||
} | } | ||
- | function | + | function fetchPhotos() { |
- | addScript(baseurl + " | + | addScript(baseurl + "/" + albumID + "/photos?callback=fb_photos"); |
} | } | ||
- | + | fetchPhotos(); | |
}); | }); |
Revision as of 00:36, 16 June 2010