Skip to content

Instantly share code, notes, and snippets.

@peterlozano
Last active August 29, 2015 14:02
Show Gist options
  • Save peterlozano/4c629fb49caec323f03b to your computer and use it in GitHub Desktop.
Save peterlozano/4c629fb49caec323f03b to your computer and use it in GitHub Desktop.
Drupalcon Austin Videos
<html>
<head>
<meta charset="UTF-8">
<title>DC Austin 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/PLpeDXSh4nHjSt4ii-1xQpb6kCGAEKGEJS?&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();
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