Team:TU Delft/fb listalbums

From 2010.igem.org

(Difference between revisions)
 
(16 intermediate revisions not shown)
Line 1: Line 1:
 +
== What to enter? ==
 +
 +
You need to find a facebook page number, or any other facebook object number that has albums in it.
 +
For example, if I go to the iGEM TU Delft facebook page, the browser location shows:
 +
http://www.facebook.com/#!/pages/TU-Delft-iGEM-team/112242102125963
 +
 +
The last part of this is the Facebook page number, which can be entered into the box below.
 +
 +
== Running ==
<html>
<html>
<div id="fb_scriptload"></div>
<div id="fb_scriptload"></div>
<div id="albumlist"></div>
<div id="albumlist"></div>
-
 
<form onsubmit='return updateAlbumView()' >
<form onsubmit='return updateAlbumView()' >
-
User/Group ID: <input type='text' id='user_id_txt' /><br />
+
User/Group ID: <input type='text' id='user_id_txt' value='112242102125963'/><br />
<input type='submit' value='List albums' />
<input type='submit' value='List albums' />
</form>
</form>
-
 
<style>
<style>
.fb_photo {
.fb_photo {
  margin: 4px 4px 4px 4px;
  margin: 4px 4px 4px 4px;
 +
}
 +
.fb_album {
 +
display:block;
 +
margin: 4px 4px;
 +
}
 +
.fbcodegen {
 +
  background-color: #ddd;
 +
  padding: 5px;
 +
  font-family: courier;
}
}
</style>
</style>
Line 24: Line 40:
   var html = '';
   var html = '';
-
   alert(albums.length);
+
   if (response.error) {
 +
    alert(response.error.message);
 +
    $("#albumlist").html("");
 +
    return;
 +
  }
    
    
   var i;
   var i;
   for(i=0;i<albums.length;i++) {
   for(i=0;i<albums.length;i++) {
     var item = albums[i];
     var item = albums[i];
-
     html += '<a href="' + item.link + '">' + item.name + ' (' + item.id + ') </a>';
+
     html += '<div class="fb_album"><a href="' + item.link + '">' + item.name + '</a>: ' + item.id;
 +
    html += " <div class='fbcodegen' id='gencode" + item.id + "'>Generate code</div>";
 +
    html += '</div>';
   }
   }
   $("#albumlist").html(html);
   $("#albumlist").html(html);
 +
 +
  for(i=0;i<albums.length;i++) {
 +
    var item = albums[i];
 +
    $("#gencode" + item.id).text('{{:Team:TU_Delft/fb_photodisplay|album=' + item.id + '|count=20|css=CSS class}}' );
 +
  }
}
}
Line 71: Line 98:
function updateAlbumView() {
function updateAlbumView() {
   var id = $("#user_id_txt").attr('value');
   var id = $("#user_id_txt").attr('value');
-
  alert("id: " + id);
 
   fetchAlbums(id);
   fetchAlbums(id);
   return false;
   return false;

Latest revision as of 13:03, 23 October 2010

What to enter?

You need to find a facebook page number, or any other facebook object number that has albums in it. For example, if I go to the iGEM TU Delft facebook page, the browser location shows:

http://www.facebook.com/#!/pages/TU-Delft-iGEM-team/112242102125963

The last part of this is the Facebook page number, which can be entered into the box below.

Running

User/Group ID: