Team:UCLondon/Templates/Navigationv3

From 2012e.igem.org

(Difference between revisions)
Line 345: Line 345:
function loadPlaylist(){
function loadPlaylist(){
         $('#yt').html('');
         $('#yt').html('');
 +
        var playListURL = 'feed://gdata.youtube.com/feeds/api/playlists/PLtGCURRfxampHgpkl-tUkzSeZhItvY3_u?v=2&alt=json&callback=?';
 +
        var videoURL= 'http://www.youtube.com/watch?v=';
 +
        $.getJSON(playListURL, function(data) {
 +
          var list_data="";
 +
          $.each(data.feed.entry, function(i, item) {
 +
                var feedTitle = item.title.$t;
 +
                var feedURL = item.link[1].href;
 +
                var fragments = feedURL.split("/");
 +
                var videoID = fragments[fragments.length - 2];
 +
                var url = videoURL + videoID;
 +
                var thumb = "http://img.youtube.com/vi/"+ videoID +"/default.jpg";
 +
              list_data += '<li><a href="'+ url +'" title="'+ feedTitle +'"><img alt="'+ feedTitle+'" src="'+ thumb +'"</a></li>';
 +
        });
 +
    $(list_data).appendTo("#yt");
 +
});​

Revision as of 20:30, 14 October 2012