Team:TU Delft/fb display

From 2010.igem.org

(Difference between revisions)
Line 1: Line 1:
 +
<noinclude>
 +
 +
This is a template page that display random pictures from a facebook album.
 +
{{:Team:TU_Delft/fb_display|album=ID|count=Number of images}}
 +
 +
Parameters:
 +
album: Facebook album ID
 +
count: Number of pictures to display
 +
 +
</noinclude>
<html>
<html>
<div id="fb_scriptload"></div>
<div id="fb_scriptload"></div>
<div id="photobox"></div>
<div id="photobox"></div>
 +
 +
<style>
 +
.fb_photo {
 +
margin: 4px 4px 4px 4px;
 +
}
 +
</style>
<script type="text/javascript">
<script type="text/javascript">
Line 8: Line 24:
function fb_photos(response) {
function fb_photos(response) {
-
   var n = 10; // select 6 random pictures
+
   var n = </html>{{{count|6}}}<html>; // select 6 random pictures
   var imghtml = "";
   var imghtml = "";
   var done={}, j=0, und;
   var done={}, j=0, und;
Line 14: Line 30:
   while(j<n) {
   while(j<n) {
     var x = Math.round( Math.random()*response.data.length );
     var x = Math.round( Math.random()*response.data.length );
-
     if (und === done[x])
+
     if (!(und === done[x]))
       continue;
       continue;
     done[x] = 1;
     done[x] = 1;
-
     var imgSmall = response.data[x].picture;
+
     var item = response.data[x];
-
     imghtml += '<img src=\"'+imgSmall+'">';
+
    var imgSmall = item.picture;
 +
     imghtml += '<a href="'+ item.link +'"><img class="fb_photo" src=\"'+imgSmall+'"></a>';
     j++;
     j++;
   }
   }

Revision as of 00:51, 16 June 2010


This is a template page that display random pictures from a facebook album.

loading facebook photo's...

Parameters: album: Facebook album ID count: Number of pictures to display