Created
October 1, 2014 09:13
-
-
Save peterlozano/891e2a4dba9e9e30cece to your computer and use it in GitHub Desktop.
Drupalcon Amsterdam 2014 Video list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>DC Amsterdam Videos</title> | |
<script src="//underscorejs.org/underscore-min.js"></script> | |
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script> | |
</head> | |
<body> | |
<script id="tmpl-videos" type="text/template"> | |
<% for (var i = 0; i < videos.length; i++) { %> | |
<% var video = videos[i].video; %> | |
<% if (typeof video.player != 'undefined') { %> | |
<li> | |
<a href="<%= video.player.default %>" target="_blank"><em><%= video.title %></em></a> | |
</li> | |
<% } %> | |
<% } %> | |
</script> | |
<script type="application/javascript"> | |
(function ($) { | |
$(document).ready(function() { | |
var init = 1; | |
do { | |
var video_json_url = 'http://gdata.youtube.com/feeds/api/playlists/PLpeDXSh4nHjQBf_SOdQgY-k6TnbCn3pSj?&v=2&alt=jsonc&max-results=50&start-index=' + init; | |
$.getJSON(video_json_url, function(data) { | |
if (data.data.items) { | |
var tmplMarkup = $('#tmpl-videos').html(); | |
console.log(data.data.items); | |
var compiledTmpl = _.template(tmplMarkup); | |
var html = compiledTmpl({ videos : data.data.items }); | |
$('#video-list').append(html); | |
} | |
}); | |
init += 50; | |
} while (init < 500); | |
}); | |
})(jQuery); | |
</script> | |
<ul id="video-list"> | |
</ul> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment