-fixed formatting
This commit is contained in:
parent
bb38512bae
commit
f581b0536e
|
@ -1,182 +1,180 @@
|
||||||
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(), $cursor = $('tr.cursor-selected-row'), check = false;
|
||||||
$cursor = $('tr.cursor-selected-row'),
|
|
||||||
check = false;
|
// make sure library items are selected and a cursor is selected.
|
||||||
|
if (selected !== 0 && $cursor.length !== 0) {
|
||||||
//make sure library items are selected and a cursor is selected.
|
check = true;
|
||||||
if (selected !== 0 && $cursor.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 {
|
} 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)
|
"timeline");
|
||||||
.data("screen", "timeline");
|
};
|
||||||
};
|
|
||||||
|
mod.fnDrawCallback = function fnLibDrawCallback() {
|
||||||
mod.fnDrawCallback = function fnLibDrawCallback() {
|
|
||||||
|
mod.redrawChosen();
|
||||||
mod.redrawChosen();
|
mod.checkToolBarIcons();
|
||||||
mod.checkToolBarIcons();
|
|
||||||
|
$('#library_display tr.lib-audio, tr.lib-pl, tr.lib-stream')
|
||||||
$('#library_display tr.lib-audio, tr.lib-pl, tr.lib-stream').draggable({
|
.draggable(
|
||||||
helper: function(){
|
{
|
||||||
|
helper : function() {
|
||||||
var $el = $(this),
|
|
||||||
selected = mod.getChosenItemsLength(),
|
var $el = $(this), selected = mod
|
||||||
container,
|
.getChosenItemsLength(), container, thead = $("#show_builder_table thead"), colspan = thead
|
||||||
thead = $("#show_builder_table thead"),
|
.find("th").length, width = thead.find(
|
||||||
colspan = thead.find("th").length,
|
"tr:first").width(), message;
|
||||||
width = thead.find("tr:first").width(),
|
|
||||||
message;
|
// dragging an element that has an unselected
|
||||||
|
// checkbox.
|
||||||
//dragging an element that has an unselected checkbox.
|
if (mod.isChosenItem($el) === false) {
|
||||||
if (mod.isChosenItem($el) === false) {
|
selected++;
|
||||||
selected++;
|
}
|
||||||
}
|
|
||||||
|
if (selected === 1) {
|
||||||
if (selected === 1) {
|
message = "Adding 1 Item.";
|
||||||
message = "Adding 1 Item.";
|
} else {
|
||||||
}
|
message = "Adding " + selected + " Items.";
|
||||||
else {
|
}
|
||||||
message = "Adding "+selected+" Items.";
|
|
||||||
}
|
container = $('<div/>').attr('id',
|
||||||
|
'draggingContainer').append('<tr/>')
|
||||||
container = $('<div/>').attr('id', 'draggingContainer')
|
.find("tr").append('<td/>').find("td")
|
||||||
.append('<tr/>')
|
.attr("colspan", colspan).width(width)
|
||||||
.find("tr")
|
.addClass("ui-state-highlight").append(
|
||||||
.append('<td/>')
|
message).end().end();
|
||||||
.find("td")
|
|
||||||
.attr("colspan", colspan)
|
return container;
|
||||||
.width(width)
|
},
|
||||||
.addClass("ui-state-highlight")
|
cursor : 'pointer',
|
||||||
.append(message)
|
connectToSortable : '#show_builder_table'
|
||||||
.end()
|
});
|
||||||
.end();
|
};
|
||||||
|
|
||||||
return container;
|
mod.dblClickAdd = function(data, type) {
|
||||||
},
|
var i, length, temp, aMediaIds = [], aSchedIds = [], aData = [];
|
||||||
cursor: 'pointer',
|
|
||||||
connectToSortable: '#show_builder_table'
|
// process selected files/playlists.
|
||||||
});
|
aMediaIds.push( {
|
||||||
};
|
"id" : data.id,
|
||||||
|
"type" : type
|
||||||
mod.dblClickAdd = function(data, type) {
|
});
|
||||||
var i,
|
|
||||||
length,
|
$("#show_builder_table tr.cursor-selected-row").each(function(i, el) {
|
||||||
temp,
|
|
||||||
aMediaIds = [],
|
|
||||||
aSchedIds = [],
|
|
||||||
aData = [];
|
|
||||||
|
|
||||||
//process selected files/playlists.
|
|
||||||
aMediaIds.push({"id": data.id, "type": type});
|
|
||||||
|
|
||||||
$("#show_builder_table tr.cursor-selected-row").each(function(i, el){
|
|
||||||
aData.push($(el).prev().data("aData"));
|
aData.push($(el).prev().data("aData"));
|
||||||
});
|
});
|
||||||
|
|
||||||
//process selected schedule rows to add media after.
|
// process selected schedule rows to add media after.
|
||||||
for (i=0, length = aData.length; i < length; i++) {
|
for (i = 0, length = aData.length; i < length; i++) {
|
||||||
temp = aData[i];
|
temp = aData[i];
|
||||||
aSchedIds.push({"id": temp.id, "instance": temp.instance, "timestamp": temp.timestamp});
|
aSchedIds.push( {
|
||||||
|
"id" : temp.id,
|
||||||
|
"instance" : temp.instance,
|
||||||
|
"timestamp" : temp.timestamp
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(aSchedIds.length == 0){
|
if (aSchedIds.length == 0) {
|
||||||
alert("Please select a cursor position on timeline.");
|
alert("Please select a cursor position on timeline.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
console.log(aMediaIds);
|
console.log(aMediaIds);
|
||||||
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
|
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
|
||||||
};
|
};
|
||||||
|
|
||||||
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 library items after selected cursors in the timeline"><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 library items after selected cursors in the timeline"><span class="ui-icon ui-icon-plusthick"></span></li>')
|
||||||
//add to timeline 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 timeline button
|
||||||
if (AIRTIME.button.isDisabled('lib-button-add') === true) {
|
$toolbar
|
||||||
return;
|
.find('.lib-button-add')
|
||||||
}
|
.click(
|
||||||
|
function() {
|
||||||
var selected = AIRTIME.library.getSelectedData(),
|
|
||||||
data,
|
if (AIRTIME.button.isDisabled('lib-button-add') === true) {
|
||||||
i,
|
return;
|
||||||
length,
|
}
|
||||||
temp,
|
|
||||||
aMediaIds = [],
|
var selected = AIRTIME.library.getSelectedData(), data, i, length, temp, aMediaIds = [], aSchedIds = [], aData = [];
|
||||||
aSchedIds = [],
|
|
||||||
aData = [];
|
// process selected files/playlists.
|
||||||
|
for (i = 0, length = selected.length; i < length; i++) {
|
||||||
//process selected files/playlists.
|
data = selected[i];
|
||||||
for (i = 0, length = selected.length; i < length; i++) {
|
aMediaIds.push( {
|
||||||
data = selected[i];
|
"id" : data.id,
|
||||||
aMediaIds.push({"id": data.id, "type": data.ftype});
|
"type" : data.ftype
|
||||||
}
|
});
|
||||||
|
}
|
||||||
$("#show_builder_table tr.cursor-selected-row").each(function(i, el){
|
|
||||||
aData.push($(el).prev().data("aData"));
|
$("#show_builder_table tr.cursor-selected-row")
|
||||||
});
|
.each(function(i, el) {
|
||||||
|
aData.push($(el).prev().data("aData"));
|
||||||
//process selected schedule rows to add media after.
|
});
|
||||||
for (i=0, length = aData.length; i < length; i++) {
|
|
||||||
temp = aData[i];
|
// process selected schedule rows to add media
|
||||||
aSchedIds.push({"id": temp.id, "instance": temp.instance, "timestamp": temp.timestamp});
|
// after.
|
||||||
}
|
for (i = 0, length = aData.length; i < length; i++) {
|
||||||
|
temp = aData[i];
|
||||||
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
|
aSchedIds.push( {
|
||||||
});
|
"id" : temp.id,
|
||||||
|
"instance" : temp.instance,
|
||||||
//delete from library.
|
"timestamp" : temp.timestamp
|
||||||
$toolbar.find('.lib-button-delete')
|
});
|
||||||
.click(function() {
|
}
|
||||||
|
|
||||||
if (AIRTIME.button.isDisabled('lib-button-delete') === true) {
|
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
|
||||||
return;
|
});
|
||||||
}
|
|
||||||
|
// delete from library.
|
||||||
AIRTIME.library.fnDeleteSelectedItems();
|
$toolbar.find('.lib-button-delete').click(function() {
|
||||||
});
|
|
||||||
|
if (AIRTIME.button.isDisabled('lib-button-delete') === true) {
|
||||||
mod.createToolbarDropDown();
|
return;
|
||||||
};
|
}
|
||||||
|
|
||||||
return AIRTIME;
|
AIRTIME.library.fnDeleteSelectedItems();
|
||||||
|
});
|
||||||
|
|
||||||
|
mod.createToolbarDropDown();
|
||||||
|
};
|
||||||
|
|
||||||
|
return AIRTIME;
|
||||||
|
|
||||||
}(AIRTIME || {}));
|
}(AIRTIME || {}));
|
||||||
|
|
Loading…
Reference in New Issue