CC-5768 : jPlayer, make now playing and playlist preview buttons function

disable preview in playlist for items browser can't play.
This commit is contained in:
Naomi 2014-04-02 18:37:12 -04:00
parent b641f15b32
commit 3953cd8a7e
3 changed files with 30 additions and 17 deletions

View File

@ -2,7 +2,6 @@
$items = $this->contents;
if (count($items)) : ?>
<?php foreach($items as $item):
$media = $item->getMediaItem();
$class = "Presentation_PlaylistItem" . $media->getType();
$p = new $class($item);
@ -21,7 +20,6 @@ if (count($items)) : ?>
</div>
<?php endif; ?>
<div class="list-item-container">
<?php if ($p->canPreview()):?>
<div class="big_play">
<span class="ui-icon ui-icon-play"></span>
@ -31,24 +29,20 @@ if (count($items)) : ?>
<span class="ui-icon ui-icon-alert"></span>
</div>
<?php endif; ?>
<div class="text-row top">
<span class="spl_playlength"><?php echo $p->getCliplength(); ?></span>
<?php if ($p->canEditCues()):?>
<span class="spl_cue ui-state-default"></span>
<?php endif; ?>
<?php if ($p->canEditFades()):?>
<span class="spl_fade spl_cue ui-state-default">fade</span>
<?php endif; ?>
<span class="spl_title"><?php echo $p->getTitle(); ?></span>
</div>
<div class="text-row">
<span class="spl_artist"><?php echo $p->getCreator(); ?></span>
<span class="spl_offset"><?php echo $p->getOffset(); ?></span>
</div>
<div id="fade_0" class="spl_fade_control ui-state-default"></div>
<span class="ui-icon ui-icon-closethick"></span>
</div>
@ -77,9 +71,8 @@ if (count($items)) : ?>
<?php endif; ?>
</li>
<?php endforeach; ?>
<?php else: ?>
<li class="spl_empty">
<?php echo _("Empty playlist"); ?>
</li>
<?php endif; ?>
<?php endif; ?>

View File

@ -43,8 +43,6 @@ var AIRTIME = (function(AIRTIME) {
bMime = mime;
}
var x = audio.canPlayType(bMime);
//return a true of the browser can play this file natively, or if the
//file is an mp3 and flash is installed (jPlayer will fall back to flash to play mp3s).
//Note that checking the navigator.mimeTypes value does not work for IE7, but the alternative

View File

@ -487,25 +487,46 @@ var AIRTIME = (function(AIRTIME){
$(".input_date").datetimepicker();
}
function checkPlayability($contents) {
$contents.each(function(index, element) {
var $el = $(element),
mime = $el.data("mimeType");
if (!AIRTIME.playerPreview.isAudioSupported(mime)) {
$el.find(".big_play").attr("class", "big_play_disabled dark_class");
}
});
}
mod.redrawPlaylist = function redrawPlaylist(data) {
var $wrapper = $("div.wrapper"),
$playlist = $("#side_playlist");
$playlist = $("#side_playlist"),
$newContent = $(data.html),
$contents;
$playlist.detach();
$playlist.find("#playlist_lastmod").val(data.modified);
$playlist.find("#playlist_length").text(data.length);
$playlist.find("#spl_sortable").html(data.html).sortable("refresh");
$playlist.find("#spl_sortable").html($newContent).sortable("refresh");
$contents = $playlist.find("#spl_sortable").find("li");
checkPlayability($contents);
$wrapper.append($playlist);
};
mod.drawPlaylist = function drawPlaylist(data) {
var $playlist = $("#side_playlist");
var $playlist = $("#side_playlist"),
$newContent = $(data.html),
$contents = $newContent.find("#spl_sortable").find("li");
checkPlayability($contents);
$playlist
.empty()
.append(data.html);
.append($newContent);
makeSortable();
};
@ -629,11 +650,12 @@ var AIRTIME = (function(AIRTIME){
mod.onReady = function() {
var $playlist = $("#side_playlist");
var $playlist = $("#side_playlist"),
$contents = $("#spl_sortable").find("li");
setupCriteriaOptions();
addDatePickers();
checkPlayability($contents);
$playlist.on("click", "#spl_AND", function(e) {
e.preventDefault();