Team:TU Delft/fb display

From 2010.igem.org

(Difference between revisions)
Line 27: Line 27:
   var imghtml = "";
   var imghtml = "";
   var done={}, j=0, und;
   var done={}, j=0, und;
 +
  var remaining=response.data;
 +
  if (n>response.data.length)
 +
    n=response.data.length;
   while(j<n) {
   while(j<n) {
-
     var x = Math.round( Math.random()*response.data.length );
+
     var x = Math.round( Math.random()*remaining.length );
-
    if (!(und === done[x]))
+
-
      continue;
+
-
    done[x] = 1;
+
-
     var item = response.data[x];
+
     var item = remaining.splice(x, 1)[0];
     var imgSmall = item.picture;
     var imgSmall = item.picture;
     imghtml += '<a href="'+ item.link +'"><img class="fb_photo" src=\"'+imgSmall+'"></a>';
     imghtml += '<a href="'+ item.link +'"><img class="fb_photo" src=\"'+imgSmall+'"></a>';

Revision as of 01:05, 16 June 2010


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