Team:UCLondon/Templates/Navigationv3
From 2012e.igem.org
(Difference between revisions)
Line 35: | Line 35: | ||
<li><a href="http://www.youtube.com/channel/UCbm54Pc1_CRQQtHKiB7q-9A"><img class="soc" src="http://db.tt/n8gy1Mao" width="28"/></a> | <li><a href="http://www.youtube.com/channel/UCbm54Pc1_CRQQtHKiB7q-9A"><img class="soc" src="http://db.tt/n8gy1Mao" width="28"/></a> | ||
- | + | <ul class="hidden-menu" id="yt"><li><a href="#">item</a></li></ul> | |
</li> | </li> | ||
Line 401: | Line 401: | ||
$('body').on('click', '#close-box', closeContactBox); | $('body').on('click', '#close-box', closeContactBox); | ||
- | + | loadPlaylist(); | |
loadLatestTweet(); | loadLatestTweet(); | ||
Line 412: | Line 412: | ||
function loadPlaylist(){ | function loadPlaylist(){ | ||
- | + | $('#yt').html(''); | |
var _pURL = 'https://gdata.youtube.com/feeds/api/playlists/PLtGCURRfxampHgpkl-tUkzSeZhItvY3_u?v=2&alt=json'; | var _pURL = 'https://gdata.youtube.com/feeds/api/playlists/PLtGCURRfxampHgpkl-tUkzSeZhItvY3_u?v=2&alt=json'; | ||
Line 420: | Line 420: | ||
dataType: "jsonp", // <== JSON-P request | dataType: "jsonp", // <== JSON-P request | ||
success: function(data){ | success: 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, 15 October 2012