Skip to content

Commit

Permalink
Merge pull request #782 from alphagov/revert-780-allow-links-to-youtu…
Browse files Browse the repository at this point in the history
…be-from-govspeak-content

Revert "Check for a data attribute to turn off the video player"
  • Loading branch information
fofr committed May 5, 2016
2 parents 00b881e + 398f6e2 commit 4a4775a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,22 @@
}
}

function shouldConvertToEmbeddedPlayer($link){
return $link.attr("data-youtube-player") != "off";
}

function enhanceYoutubeVideoLinks($el) {
$el.find("a[href*='youtube.com'], a[href*='youtu.be']").each(function (i){

var $link = $(this);

if (shouldConvertToEmbeddedPlayer($link)) {
var videoId = parseYoutubeVideoId($link.attr('href')),
$holder = $('<span class="media-player" />'),
$captions = $link.siblings('.captions');

if(typeof videoId !== 'undefined') {
$link.parent().replaceWith($holder);

$holder.player({
id: 'youtube-'+i,
media: videoId,
captions: $captions.length > 0 ? $captions.attr('href') : null,
url: (document.location.protocol + '//www.youtube.com/apiplayer?enablejsapi=1&version=3&playerapiid=')
});
}
function enhanceYoutubeVideoLinks($el){
$el.find("a[href*='youtube.com'], a[href*='youtu.be']").each(function(i){
var $link = $(this),
videoId = parseYoutubeVideoId($link.attr('href')),
$holder = $('<span class="media-player" />'),
$captions = $link.siblings('.captions');

if(typeof videoId !== 'undefined'){
$link.parent().replaceWith($holder);

$holder.player({
id: 'youtube-'+i,
media: videoId,
captions: $captions.length > 0 ? $captions.attr('href') : null,
url: (document.location.protocol + '//www.youtube.com/apiplayer?enablejsapi=1&version=3&playerapiid=')
});
}
});
}
Expand Down

This file was deleted.

0 comments on commit 4a4775a

Please sign in to comment.