|
|
Line 37: |
Line 37: |
| <script type="text/javascript"> | | <script type="text/javascript"> |
| <!--//--><![CDATA[// ><!-- | | <!--//--><![CDATA[// ><!-- |
- |
| |
- |
| |
- | (function() {
| |
- | function createPlayer(jqe, video, options) {
| |
- | var ifr = $('iframe', jqe);
| |
- | if (ifr.length === 0) {
| |
- | ifr = $('<iframe scrolling="no" frameborder="no">');
| |
- | ifr.addClass('player');
| |
- | if (options.playeropts)
| |
- | ifr.attr(options.playeropts);
| |
- | }
| |
- | var src = 'http://www.youtube.com/embed/' + video;
| |
- | if (options.playopts) {
| |
- | src += '?';
| |
- | for (var k in options.playopts) {
| |
- | src+= k + '=' + options.playopts[k] + '&';
| |
- | }
| |
- | }
| |
- | ifr.attr('src', src);
| |
- | jqe.append(ifr);
| |
- | }
| |
- |
| |
- | var defoptions = {
| |
- | autoplay: false,
| |
- | user: null,
| |
- | player: createPlayer,
| |
- | playeropts: {},
| |
- | loaded: function() {},
| |
- | playopts: {
| |
- | fs: 1,
| |
- | showinfo: 1,
| |
- | modestbranding: 1
| |
- | }
| |
- | };
| |
- |
| |
- | $.fn.extend({
| |
- | youTubeChannel: function(options) {
| |
- | var md = $(this);
| |
- | var allopts = $.extend(true, {}, defoptions, options);
| |
- |
| |
- | var stramp = String.fromCharCode(38);
| |
- | var youurl = "'http://gdata.youtube.com/feeds/api/users/' + allopts.user + '/uploads?alt=jsonc' + stramp + 'v=2'";
| |
- |
| |
- | $.getJSON(youurl_fixed, null, function(data) {
| |
- | var videos = [];
| |
- | var playlist = '';
| |
- | $.each(data.data.items, function(i, item) {
| |
- | videos.push(item.id);
| |
- | if (i > 0)
| |
- | playlist += item.id + ',';
| |
- | });
| |
- | allopts.playopts.playlist = playlist;
| |
- | allopts.player(md, videos[0], allopts);
| |
- | });
| |
- | }
| |
- | });
| |
- |
| |
- | })();
| |
| | | |
| $(function() { | | $(function() { |
Line 195: |
Line 137: |
| <div id="featured_video"></div> | | <div id="featured_video"></div> |
| <p><a href="/Notebook/Videos" class="more-link">More Videos</a></p> | | <p><a href="/Notebook/Videos" class="more-link">More Videos</a></p> |
- | <script type="text/javascript">
| + | </div> |
- | | + | |
- | <!--//--><![CDATA[// ><!--
| + | |
- | | + | |
- | var featured_url = "http://gdata.youtube.com/feeds/api/playlists/8340F2FAB32CAB64?alt=jsonc%20v=2";
| + | |
- | $.get(featured_url, function(data) {
| + | |
- | var src = 'http://www.youtube.com/embed/' + data.data.items[0].video.id + '?width=250%20height=180';
| + | |
- | ifr = $('<iframe scrolling="no" frameborder="no">');
| + | |
- | ifr.attr({'src': src, width: 250, height: 180});
| + | |
- | $('#featured_video').html(ifr);
| + | |
- | });
| + | |
- | | + | |
- | //--><!]]>
| + | |
- | | + | |
- | </script> </div>
| + | |
| </div> | | </div> |
| <div id="block-block-6" class="block block-block"> | | <div id="block-block-6" class="block block-block"> |