CC-84: Smart Playlists
- audio preview on playlist - cleaning up some code
This commit is contained in:
parent
3b5a3e6713
commit
0d2d8218bf
14 changed files with 202 additions and 72 deletions
|
@ -40,6 +40,8 @@ $(document).ready(function(){
|
|||
var playlistIndex = $('.playlistIndex').text();
|
||||
var showID = $('.showID').text();
|
||||
var showIndex = $('.showIndex').text();
|
||||
var blockId = $('.blockId').text();
|
||||
var blockIndex = $('.blockIndex').text();
|
||||
|
||||
var numOfItems = 0;
|
||||
|
||||
|
@ -49,6 +51,8 @@ $(document).ready(function(){
|
|||
playOne(audioFileID);
|
||||
}else if (showID != "") {
|
||||
playAllShow(showID, showIndex);
|
||||
}else if(blockId != "" && blockIndex != ""){
|
||||
playBlock(blockId, blockIndex);
|
||||
}
|
||||
|
||||
$("#jp_container_1").on("mouseenter", "ul.jp-controls li", function(ev) {
|
||||
|
@ -76,6 +80,17 @@ function playAllPlaylist(p_playlistID, p_playlistIndex) {
|
|||
}
|
||||
}
|
||||
|
||||
function playBlock(p_blockId, p_blockIndex)
|
||||
{
|
||||
var viewsBlockId = $('.blockId').text();
|
||||
|
||||
if ( _idToPostionLookUp !== undefined && viewsBlockId == p_blockId ) {
|
||||
play(p_blockIndex);
|
||||
}else {
|
||||
buildplaylist("/audiopreview/get-block/blockId/"+p_blockId, p_blockIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the show to play.
|
||||
* checks with the show id given to the show id on the page/view
|
||||
|
|
|
@ -31,11 +31,16 @@ function openAudioPreview(p_event) {
|
|||
p_event.stopPropagation();
|
||||
|
||||
var audioFileID = $(this).attr('audioFile');
|
||||
var playlistID = $('#pl_id:first').attr('value');
|
||||
var playlistIndex = $(this).parent().parent().attr('id');
|
||||
playlistIndex = playlistIndex.substring(4); //remove the spl_
|
||||
var objId = $('#obj_id:first').attr('value');
|
||||
var objType = $('#obj_type:first').attr('value');
|
||||
var playIndex = $(this).parent().parent().attr('id');
|
||||
playIndex = playIndex.substring(4); //remove the spl_
|
||||
|
||||
open_playlist_preview(playlistID, playlistIndex);
|
||||
if (objType == "playlist") {
|
||||
open_playlist_preview(objId, playIndex);
|
||||
} else if (objType == "block") {
|
||||
open_block_preview(objId, playIndex);
|
||||
}
|
||||
}
|
||||
|
||||
function open_audio_preview(audioFileID, audioFileTitle, audioFileArtist) {
|
||||
|
@ -65,6 +70,17 @@ function open_playlist_preview(p_playlistID, p_playlistIndex) {
|
|||
_preview_window.focus();
|
||||
}
|
||||
|
||||
function open_block_preview(p_blockId, p_blockIndex) {
|
||||
if (p_blockIndex == undefined) //Use a resonable default.
|
||||
p_blockIndex = 0;
|
||||
|
||||
if (_preview_window != null && !_preview_window.closed)
|
||||
_preview_window.playBlock(p_blockId, p_blockIndex);
|
||||
else
|
||||
openPreviewWindow('audiopreview/block-preview/blockIndex/'+p_blockIndex+'/blockId/'+p_blockId);
|
||||
_preview_window.focus();
|
||||
}
|
||||
|
||||
/**
|
||||
*Opens a jPlayer window for the specified info, for either an audio file or playlist.
|
||||
*If audioFile, audioFileTitle, audioFileArtist is supplied the jplayer opens for one file
|
||||
|
|
|
@ -629,6 +629,9 @@ var AIRTIME = (function(AIRTIME) {
|
|||
open_playlist_preview(playlistIndex, 0);
|
||||
} else if (data.ftype === 'audioclip') {
|
||||
open_audio_preview(data.audioFile, data.track_title, data.artist_name);
|
||||
} else if (data.ftype === 'block') {
|
||||
blockIndex = $(this).parent().attr('id').substring(3); //remove the pl_
|
||||
open_block_preview(blockIndex, 0);
|
||||
}
|
||||
};
|
||||
oItems.play.callback = callback;
|
||||
|
|
|
@ -356,10 +356,11 @@ var AIRTIME = (function(AIRTIME){
|
|||
$pl.delegate(".spl_block_expand",
|
||||
{"click": function(ev){
|
||||
var id = parseInt($(this).attr("id").split("_").pop(), 10);
|
||||
var blockId = parseInt($(this).attr("blockId"), 10);
|
||||
if ($(this).hasClass('close')) {
|
||||
var sUrl = "/playlist/get-block-info";
|
||||
mod.disableUI();
|
||||
$.post(sUrl, {format:"json", id:id}, function(json){
|
||||
$.post(sUrl, {format:"json", id:blockId}, function(json){
|
||||
$html = "";
|
||||
var data = $.parseJSON(json);
|
||||
var isStatic = data.isStatic;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue