-fixed formatting
This commit is contained in:
parent
96f693687b
commit
bb38512bae
|
@ -1,169 +1,161 @@
|
||||||
var AIRTIME = (function(AIRTIME){
|
var AIRTIME = (function(AIRTIME) {
|
||||||
var mod;
|
var mod;
|
||||||
|
|
||||||
if (AIRTIME.library === undefined) {
|
if (AIRTIME.library === undefined) {
|
||||||
AIRTIME.library = {};
|
AIRTIME.library = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
mod = AIRTIME.library;
|
mod = AIRTIME.library;
|
||||||
|
|
||||||
mod.checkAddButton = function() {
|
mod.checkAddButton = function() {
|
||||||
var selected = mod.getChosenItemsLength(),
|
var selected = mod.getChosenItemsLength(), sortable = $('#spl_sortable'), check = false;
|
||||||
sortable = $('#spl_sortable'),
|
|
||||||
check = false;
|
// make sure audioclips are selected and a playlist is currently open.
|
||||||
|
if (selected !== 0 && sortable.length !== 0) {
|
||||||
//make sure audioclips are selected and a playlist is currently open.
|
check = true;
|
||||||
if (selected !== 0 && sortable.length !== 0) {
|
}
|
||||||
check = true;
|
|
||||||
}
|
if (check === true) {
|
||||||
|
AIRTIME.button.enableButton("lib-button-add");
|
||||||
if (check === true) {
|
} else {
|
||||||
AIRTIME.button.enableButton("lib-button-add");
|
AIRTIME.button.disableButton("lib-button-add");
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
AIRTIME.button.disableButton("lib-button-add");
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.fnRowCallback = function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
mod.fnRowCallback = function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
|
||||||
var $nRow = $(nRow);
|
var $nRow = $(nRow);
|
||||||
if (aData.ftype === "audioclip") {
|
if (aData.ftype === "audioclip") {
|
||||||
$nRow.addClass("lib-audio");
|
$nRow.addClass("lib-audio");
|
||||||
} else if (aData.ftype === "stream"){
|
} else if (aData.ftype === "stream") {
|
||||||
$nRow.addClass("lib-stream");
|
$nRow.addClass("lib-stream");
|
||||||
} else if (aData.ftype === "block") {
|
} else if (aData.ftype === "block") {
|
||||||
$nRow.addClass("lib-block");
|
$nRow.addClass("lib-block");
|
||||||
} else {
|
} else {
|
||||||
$nRow.addClass("lib-pl");
|
$nRow.addClass("lib-pl");
|
||||||
}
|
}
|
||||||
|
|
||||||
$nRow.attr("id", aData["tr_id"])
|
$nRow.attr("id", aData["tr_id"]).data("aData", aData).data("screen",
|
||||||
.data("aData", aData)
|
"playlist");
|
||||||
.data("screen", "playlist");
|
|
||||||
|
if (aData["bl_type"] !== undefined) {
|
||||||
if (aData["bl_type"] !== undefined) {
|
$nRow.attr("bl_type", aData["bl_type"]);
|
||||||
$nRow.attr("bl_type", aData["bl_type"]);
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
|
mod.fnDrawCallback = function() {
|
||||||
mod.fnDrawCallback = function() {
|
|
||||||
|
mod.redrawChosen();
|
||||||
mod.redrawChosen();
|
mod.checkToolBarIcons();
|
||||||
mod.checkToolBarIcons();
|
|
||||||
|
$('#library_display tr.lib-audio, tr.lib-stream, tr.lib-pl, tr.lib-block')
|
||||||
$('#library_display tr.lib-audio, tr.lib-stream, tr.lib-pl, tr.lib-block').draggable({
|
.draggable(
|
||||||
helper: function(){
|
{
|
||||||
|
helper : function() {
|
||||||
var $el = $(this),
|
|
||||||
selected = mod.getChosenAudioFilesLength(),
|
var $el = $(this), selected = mod
|
||||||
container,
|
.getChosenAudioFilesLength(), container, message, li = $("#side_playlist ul li:first"), width = li
|
||||||
message,
|
.width(), height = li.height();
|
||||||
li = $("#side_playlist ul li:first"),
|
|
||||||
width = li.width(),
|
// dragging an element that has an unselected
|
||||||
height = li.height();
|
// checkbox.
|
||||||
|
if (mod.isChosenItem($el) === false) {
|
||||||
//dragging an element that has an unselected checkbox.
|
selected++;
|
||||||
if (mod.isChosenItem($el) === false) {
|
}
|
||||||
selected++;
|
|
||||||
}
|
if (selected === 1) {
|
||||||
|
message = "Adding 1 Item.";
|
||||||
if (selected === 1) {
|
} else {
|
||||||
message = "Adding 1 Item.";
|
message = "Adding " + selected + " Items.";
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
message = "Adding "+selected+" Items.";
|
container = $('<div class="helper"/>').append(
|
||||||
}
|
"<li/>").find("li").addClass(
|
||||||
|
"ui-state-default").append("<div/>")
|
||||||
container = $('<div class="helper"/>')
|
.find("div").addClass(
|
||||||
.append("<li/>")
|
"list-item-container").append(
|
||||||
.find("li")
|
message).end().width(width)
|
||||||
.addClass("ui-state-default")
|
.height(height).end();
|
||||||
.append("<div/>")
|
|
||||||
.find("div")
|
return container;
|
||||||
.addClass("list-item-container")
|
},
|
||||||
.append(message)
|
cursor : 'pointer',
|
||||||
.end()
|
connectToSortable : '#spl_sortable'
|
||||||
.width(width)
|
});
|
||||||
.height(height)
|
};
|
||||||
.end();
|
|
||||||
|
mod.dblClickAdd = function(data, type) {
|
||||||
return container;
|
var i, aMediaIds = [];
|
||||||
},
|
|
||||||
cursor: 'pointer',
|
// process selected files/playlists.
|
||||||
connectToSortable: '#spl_sortable'
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
mod.dblClickAdd = function(data, type) {
|
|
||||||
var i,
|
|
||||||
aMediaIds = [];
|
|
||||||
|
|
||||||
//process selected files/playlists.
|
|
||||||
aMediaIds.push(new Array(data.id, data.ftype));
|
aMediaIds.push(new Array(data.id, data.ftype));
|
||||||
|
|
||||||
//check if a playlist/block is open before adding items
|
// check if a playlist/block is open before adding items
|
||||||
if ($('input[id="obj_type"]').val() == 'playlist' || $('input[id="obj_type"]').val() == 'block') {
|
if ($('input[id="obj_type"]').val() == 'playlist'
|
||||||
|
|| $('input[id="obj_type"]').val() == 'block') {
|
||||||
AIRTIME.playlist.fnAddItems(aMediaIds, undefined, 'after');
|
AIRTIME.playlist.fnAddItems(aMediaIds, undefined, 'after');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.setupLibraryToolbar = function() {
|
mod.setupLibraryToolbar = function() {
|
||||||
var $toolbar = $(".lib-content .fg-toolbar:first");
|
var $toolbar = $(".lib-content .fg-toolbar:first");
|
||||||
|
|
||||||
$toolbar
|
$toolbar
|
||||||
.append("<ul />")
|
.append("<ul />")
|
||||||
.find('ul')
|
.find('ul')
|
||||||
.append('<li class="ui-state-default lib-button-select" title="Select"><span class="ui-icon ui-icon-document-b"></span></li>')
|
.append(
|
||||||
.append('<li class="ui-state-default ui-state-disabled lib-button-add" title="Add selected library items to the current playlist"><span class="ui-icon ui-icon-plusthick"></span></li>')
|
'<li class="ui-state-default lib-button-select" title="Select"><span class="ui-icon ui-icon-document-b"></span></li>')
|
||||||
.append('<li class="ui-state-default ui-state-disabled lib-button-delete" title="Delete selected library items"><span class="ui-icon ui-icon-trash"></span></li>');
|
.append(
|
||||||
|
'<li class="ui-state-default ui-state-disabled lib-button-add" title="Add selected library items to the current playlist"><span class="ui-icon ui-icon-plusthick"></span></li>')
|
||||||
//add to playlist button
|
.append(
|
||||||
$toolbar.find('.lib-button-add')
|
'<li class="ui-state-default ui-state-disabled lib-button-delete" title="Delete selected library items"><span class="ui-icon ui-icon-trash"></span></li>');
|
||||||
.click(function() {
|
|
||||||
|
// add to playlist button
|
||||||
if (AIRTIME.button.isDisabled('lib-button-add') === true) {
|
$toolbar
|
||||||
return;
|
.find('.lib-button-add')
|
||||||
}
|
.click(function() {
|
||||||
|
|
||||||
var aData = AIRTIME.library.getSelectedData(),
|
if (AIRTIME.button.isDisabled('lib-button-add') === true) {
|
||||||
i,
|
return;
|
||||||
temp,
|
}
|
||||||
length,
|
|
||||||
aMediaIds = [];
|
var aData = AIRTIME.library.getSelectedData(), i, temp, length, aMediaIds = [];
|
||||||
|
|
||||||
//process selected files/playlists.
|
// process selected files/playlists.
|
||||||
for (i = 0, length = aData.length; i < length; i++) {
|
for (i = 0, length = aData.length; i < length; i++) {
|
||||||
temp = aData[i];
|
temp = aData[i];
|
||||||
if (temp.ftype === "audioclip" || temp.ftype === "block" ||
|
if (temp.ftype === "audioclip"
|
||||||
(temp.ftype === "stream" && $("#obj_type").val() === "playlist")) {
|
|| temp.ftype === "block"
|
||||||
aMediaIds.push(new Array (temp.id, temp.ftype));
|
|| (temp.ftype === "stream" && $(
|
||||||
}
|
"#obj_type").val() === "playlist")) {
|
||||||
}
|
aMediaIds.push(new Array(temp.id,
|
||||||
if (aMediaIds.length > 0) {
|
temp.ftype));
|
||||||
AIRTIME.playlist.fnAddItems(aMediaIds, undefined, 'after');
|
}
|
||||||
} else {
|
}
|
||||||
if ($('#obj_type').val() == 'block') {
|
if (aMediaIds.length > 0) {
|
||||||
alert('You can only add tracks to smart blocks.');
|
AIRTIME.playlist.fnAddItems(aMediaIds,
|
||||||
} else if ($('#obj_type').val() == 'playlist') {
|
undefined, 'after');
|
||||||
alert('You can only add tracks, smart blocks, and webstreams to playlists.');
|
} else {
|
||||||
}
|
if ($('#obj_type').val() == 'block') {
|
||||||
}
|
alert('You can only add tracks to smart blocks.');
|
||||||
});
|
} else if ($('#obj_type').val() == 'playlist') {
|
||||||
|
alert('You can only add tracks, smart blocks, and webstreams to playlists.');
|
||||||
//delete from library.
|
}
|
||||||
$toolbar.find('.lib-button-delete')
|
}
|
||||||
.click(function() {
|
});
|
||||||
|
|
||||||
if (AIRTIME.button.isDisabled('lib-button-delete') === true) {
|
// delete from library.
|
||||||
return;
|
$toolbar.find('.lib-button-delete').click(function() {
|
||||||
}
|
|
||||||
|
if (AIRTIME.button.isDisabled('lib-button-delete') === true) {
|
||||||
AIRTIME.library.fnDeleteSelectedItems();
|
return;
|
||||||
});
|
}
|
||||||
|
|
||||||
mod.createToolbarDropDown();
|
AIRTIME.library.fnDeleteSelectedItems();
|
||||||
};
|
});
|
||||||
|
|
||||||
return AIRTIME;
|
mod.createToolbarDropDown();
|
||||||
|
};
|
||||||
|
|
||||||
|
return AIRTIME;
|
||||||
|
|
||||||
}(AIRTIME || {}));
|
}(AIRTIME || {}));
|
||||||
|
|
Loading…
Reference in New Issue