Grab videos from YouTube for impressions

Esse commit está contido em:
Robin Mehner
2013-05-19 17:30:24 +02:00
commit 8fee6f1ada
3 arquivos alterados com 36 adições e 3 exclusões
+1 -1
Ver Arquivo
@@ -133,7 +133,7 @@
</script>
<script src="/js/vendor/jquery.js"></script>
<script src="/js/vendor/jquery-ajax-localstorage-cache.js"></script>
<script src="/js/modules.js"></script>
<script src="/js/main.js"></script>
<script type="text/javascript">
var $win = $(window);
var $wrap = $('.header-links-wrap');
+12
Ver Arquivo
@@ -0,0 +1,12 @@
---
layout: default
title: The NodeCopter - Programming flying robots with node.js
introTitle: Impressions of NodeCopter events
introText: |
Some videos and photos of NodeCopter events from all around the world
---
If you want to see your video here, make sure you we can find your video on
YouTube when searching for "nodecopter".
<div class="js-videos"></div>
+23 -2
Ver Arquivo
@@ -115,11 +115,12 @@
});
};
$(function() {
var showNpmModules = function() {
// which element to append modules to
var ul = $('.modules-all');
if (!ul.length) return;
// appends module to the list
function appendModules(modules) {
$('.modules-loading').remove();
@@ -154,7 +155,27 @@
appendModules(modules);
});
});
};
var showYouTubeVideos = function() {
var $container = $('.js-videos');
if (!$container.length) return;
$.getJSON('https://gdata.youtube.com/feeds/api/videos?q=nodecopter&alt=jsonc&v=2&orderby=viewCount', function(videos) {
var videoString = '';
var tpl = '<iframe width="512" height="288" src="http://www.youtube.com/embed/{{id}}" frameborder="0" allowfullscreen></iframe>';
videos.data.items.forEach(function(video) {
videoString += tpl.replace('{{id}}', video.id);
});
$('.js-videos').append(videoString);
});
};
$(function() {
showNpmModules();
showYouTubeVideos();
});
}(window, jQuery));