-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
221 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
$(function () { | ||
$('[data-crtv-podcast="player"]').each(function () { | ||
var $container = $(this); | ||
var $embed = $container.find('[data-crtv-podcast-player]'); | ||
var $releases = $container.find('.crtv-podcast-releases'); | ||
|
||
$releases.find('[data-crtv-podcast-player-item]').on('click', function () { | ||
var $target = $(this); | ||
if ($target.parent().hasClass('active')) return false; | ||
|
||
var $embedEl; | ||
switch ($target.data('crtv-podcast-player-type')) { | ||
case 'audio': | ||
$embedEl = $('<div>').addClass('crtv-embed-audio').css({ | ||
backgroundImage: "url('" + $container.data('crtv-podcast-player-poster') + "')" | ||
}).append( | ||
$('<audio>').attr({ | ||
controls: 'controls', | ||
src: $target.data('crtv-podcast-player-item') | ||
}) | ||
); | ||
console.log($embedEl); | ||
break; | ||
case 'video': | ||
$embedEl = $('<video>').attr({ | ||
controls: 'controls', | ||
poster: $container.data('crtv-podcast-player-poster'), | ||
src: $target.data('crtv-podcast-player-item') | ||
}); | ||
break; | ||
default: | ||
$embedEl = $('<iframe>').attr({ | ||
frameborder: 0, | ||
src: $target.data('crtv-podcast-player-item') | ||
}); | ||
break; | ||
} | ||
$embed.empty().append($embedEl); | ||
$releases.find('.active').removeClass('active'); | ||
$target.parent().addClass('active'); | ||
|
||
return false; | ||
}); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
.crtv-embed-responsive { | ||
position: relative; | ||
padding-bottom: 56.25%; | ||
height: 0; | ||
overflow: hidden; | ||
max-width: 100%; | ||
} | ||
|
||
.crtv-embed-responsive iframe, | ||
.crtv-embed-responsive object, | ||
.crtv-embed-responsive embed, | ||
.crtv-embed-responsive video, | ||
.crtv-embed-responsive .crtv-embed-audio { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
.crtv-embed-audio { | ||
background-repeat: no-repeat; | ||
background-position: center center; | ||
background-size: contain; | ||
} | ||
.crtv-embed-audio audio { | ||
position: absolute; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
width: 100%; | ||
} | ||
|
||
/* | ||
* Switching | ||
*/ | ||
|
||
.crtv-podcast-releases { | ||
display: flex; | ||
flex-wrap: wrap; | ||
list-style: none; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
.crtv-podcast-release { | ||
display: flex; | ||
flex-grow: 1; | ||
border: 1px solid #ADADAD; | ||
} | ||
.crtv-podcast-release:not(:last-child) { | ||
border-right: none; | ||
} | ||
.crtv-podcast-release a { | ||
color: #333333; | ||
padding: 0.3em 1em; | ||
} | ||
.crtv-podcast-release .crtv-podcast-release-switch { | ||
flex-grow: 1; | ||
} | ||
.crtv-podcast-release.active { | ||
border-color: #204D74; | ||
background: #337AB7; | ||
color: #ffffff; | ||
} | ||
.crtv-podcast-release.active a { | ||
color: #ffffff; | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{%if __SELF__.releases.count %} | ||
<div class="crtv-podcast-player-container" | ||
data-crtv-podcast="player" | ||
data-crtv-podcast-player-poster="{{ __SELF__.episode.image ? __SELF__.episode.image.path : (__SELF__.show.image ? __SELF__.show.image.path : null) }}"> | ||
|
||
<div class="crtv-embed-responsive" data-crtv-podcast-player> | ||
{% if __SELF__.releases.first.release_type.type == 'audio' %} | ||
|
||
<div class="crtv-embed-audio" style="background-image: url('{{ __SELF__.episode.image ? __SELF__.episode.image.path : (__SELF__.show.image ? __SELF__.show.image.path : null) }}');"> | ||
<audio src="{{ __SELF__.releases.first.embed_url }}" controls></audio> | ||
</div> | ||
|
||
{% elseif __SELF__.releases.first.release_type.type == 'video' %} | ||
|
||
<video src="{{ __SELF__.releases.first.embed_url }}" | ||
controls | ||
poster="{{ __SELF__.episode.image ? __SELF__.episode.image.path : (__SELF__.show.image ? __SELF__.show.image.path : null) }}"> | ||
</video> | ||
|
||
{% else %} | ||
|
||
<iframe src="{{ __SELF__.releases.first.embed_url }}" frameborder="0"></iframe> | ||
|
||
{% endif %} | ||
</div> | ||
|
||
<ul class="crtv-podcast-releases"> | ||
|
||
{% for release in __SELF__.releases %} | ||
|
||
<li class="crtv-podcast-release {%if loop.index == 1 %}active{% endif %}"> | ||
<a class="crtv-podcast-release-switch" | ||
href="{{ release.url }}" | ||
title="Switch To" | ||
data-crtv-podcast-player-item="{{ release.embed_url }}" | ||
data-crtv-podcast-player-type="{{ release.release_type.type }}"> | ||
{{ release.release_type.name }} | ||
</a> | ||
{% if release.release_type.type in ['audio', 'video'] %} | ||
<a href="{{ release.url }}" title="Download" class="crtv-podcast-release-link"> | ||
<i class="icon-download-alt"></i> | ||
</a> | ||
{% else %} | ||
<a href="{{ release.url }}" title="Go to" class="crtv-podcast-release-link"> | ||
<i class="icon-external-link"></i> | ||
</a> | ||
{% endif %} | ||
</li> | ||
|
||
{% endfor %} | ||
|
||
</ul> | ||
|
||
</div> | ||
{% else %} | ||
|
||
{% endif %} |
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