Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
4c317d1891
@ -76,7 +76,7 @@ function updateProgressBarValue(){
|
||||
var scheduled_play_line_to_switch = scheduled_play_div.parent().find(".line-to-switch");
|
||||
|
||||
if (currentSong !== null){
|
||||
var songElpasedTime = 0;
|
||||
var songElapsedTime = 0;
|
||||
songPercentDone = (estimatedSchedulePosixTime - currentSong.songStartPosixTime)/currentSong.songLengthMs*100;
|
||||
songElapsedTime = estimatedSchedulePosixTime - currentSong.songStartPosixTime;
|
||||
if (songPercentDone < 0 || songPercentDone > 100){
|
||||
|
||||
@ -48,14 +48,20 @@ var AIRTIME = (function(AIRTIME){
|
||||
$('#library_display tr.lib-audio').draggable({
|
||||
helper: function(){
|
||||
|
||||
var selected = mod.getChosenAudioFilesLength(),
|
||||
var $el = $(this),
|
||||
selected = mod.getChosenAudioFilesLength(),
|
||||
container,
|
||||
message,
|
||||
li = $("#side_playlist ul li:first"),
|
||||
width = li.width(),
|
||||
height = li.height();
|
||||
|
||||
//dragging an element that has an unselected checkbox.
|
||||
if (mod.isChosenItem($el) === false) {
|
||||
selected++;
|
||||
}
|
||||
|
||||
if (selected === 0 || selected === 1) {
|
||||
if (selected === 1) {
|
||||
message = "Adding 1 Item.";
|
||||
}
|
||||
else {
|
||||
|
||||
@ -48,14 +48,20 @@ var AIRTIME = (function(AIRTIME){
|
||||
$('#library_display tr.lib-audio, tr.lib-pl').draggable({
|
||||
helper: function(){
|
||||
|
||||
var selected = mod.getChosenItemsLength(),
|
||||
var $el = $(this),
|
||||
selected = mod.getChosenItemsLength(),
|
||||
container,
|
||||
thead = $("#show_builder_table thead"),
|
||||
colspan = thead.find("th").length,
|
||||
width = thead.find("tr:first").width(),
|
||||
message;
|
||||
|
||||
if (selected === 0 || selected === 1) {
|
||||
//dragging an element that has an unselected checkbox.
|
||||
if (mod.isChosenItem($el) === false) {
|
||||
selected++;
|
||||
}
|
||||
|
||||
if (selected === 1) {
|
||||
message = "Adding 1 Item.";
|
||||
}
|
||||
else {
|
||||
|
||||
@ -98,6 +98,13 @@ var AIRTIME = (function(AIRTIME) {
|
||||
}
|
||||
};
|
||||
|
||||
mod.isChosenItem = function($el) {
|
||||
var id = $el.attr("id"),
|
||||
item = chosenItems[id];
|
||||
|
||||
return item !== undefined ? true : false;
|
||||
};
|
||||
|
||||
mod.addToChosen = function($el) {
|
||||
var id = $el.attr("id");
|
||||
|
||||
|
||||
@ -2,6 +2,8 @@ var AIRTIME = (function(AIRTIME){
|
||||
var mod,
|
||||
oSchedTable,
|
||||
SB_SELECTED_CLASS = "sb-selected",
|
||||
CURSOR_SELECTED_CLASS = "cursor-selected-row",
|
||||
NOW_PLAYING_CLASS = "sb-now-playing",
|
||||
$sbContent,
|
||||
$sbTable,
|
||||
$toolbar,
|
||||
@ -79,7 +81,7 @@ var AIRTIME = (function(AIRTIME){
|
||||
};
|
||||
|
||||
mod.checkJumpToCurrentButton = function() {
|
||||
var $current = $sbTable.find(".sb-now-playing");
|
||||
var $current = $sbTable.find("."+NOW_PLAYING_CLASS);
|
||||
|
||||
if ($current.length !== 0) {
|
||||
AIRTIME.button.enableButton("sb-button-current");
|
||||
@ -108,13 +110,32 @@ var AIRTIME = (function(AIRTIME){
|
||||
mod.checkJumpToCurrentButton();
|
||||
mod.checkCancelButton();
|
||||
};
|
||||
|
||||
mod.selectCursor = function($el) {
|
||||
|
||||
$el.addClass(CURSOR_SELECTED_CLASS);
|
||||
mod.checkToolBarIcons();
|
||||
};
|
||||
|
||||
mod.removeCursor = function($el) {
|
||||
|
||||
$el.removeClass(CURSOR_SELECTED_CLASS);
|
||||
mod.checkToolBarIcons();
|
||||
};
|
||||
|
||||
mod.getSelectedData = function() {
|
||||
/*
|
||||
* sNot is an optional string to filter selected elements by. (ex removing the currently playing item)
|
||||
*/
|
||||
mod.getSelectedData = function(sNot) {
|
||||
var $selected = $sbTable.find("tbody").find("input:checkbox").filter(":checked").parents("tr"),
|
||||
aData = [],
|
||||
i, length,
|
||||
$item;
|
||||
|
||||
if (sNot !== undefined) {
|
||||
$selected = $selected.not("."+sNot);
|
||||
}
|
||||
|
||||
for (i = 0, length = $selected.length; i < length; i++) {
|
||||
$item = $($selected.get(i));
|
||||
aData.push($item.data('aData'));
|
||||
@ -513,7 +534,7 @@ var AIRTIME = (function(AIRTIME){
|
||||
$nRow.data({"aData": aData});
|
||||
|
||||
if (aData.scheduled === 1) {
|
||||
$nRow.addClass("sb-now-playing");
|
||||
$nRow.addClass(NOW_PLAYING_CLASS);
|
||||
}
|
||||
else if (aData.scheduled === 0) {
|
||||
$nRow.addClass("sb-past");
|
||||
@ -618,7 +639,7 @@ var AIRTIME = (function(AIRTIME){
|
||||
|
||||
//order of importance of elements for setting the next timeout.
|
||||
elements = [
|
||||
$sbTable.find("tr.sb-now-playing"),
|
||||
$sbTable.find("tr."+NOW_PLAYING_CLASS),
|
||||
$sbTable.find("tbody").find("tr.sb-future.sb-footer, tr.sb-future.sb-header").filter(":first")
|
||||
];
|
||||
|
||||
@ -776,7 +797,7 @@ var AIRTIME = (function(AIRTIME){
|
||||
forcePlaceholderSize: true,
|
||||
distance: 10,
|
||||
helper: function(event, item) {
|
||||
var selected = mod.getSelectedData(),
|
||||
var selected = mod.getSelectedData(NOW_PLAYING_CLASS),
|
||||
thead = $("#show_builder_table thead"),
|
||||
colspan = thead.find("th").length,
|
||||
trfirst = thead.find("tr:first"),
|
||||
@ -816,7 +837,17 @@ var AIRTIME = (function(AIRTIME){
|
||||
receive: fnReceive,
|
||||
update: fnUpdate,
|
||||
start: function(event, ui) {
|
||||
var elements = $sbTable.find('tr:not(:first) input:checked').parents('tr');
|
||||
/*
|
||||
var elements = $sbTable.find('tr input:checked').parents('tr')
|
||||
.not(ui.item)
|
||||
.not("."+NOW_PLAYING_CLASS);
|
||||
|
||||
//remove all other items from the screen,
|
||||
//don't remove ui.item or else we can not get position information when the user drops later.
|
||||
elements.remove();
|
||||
*/
|
||||
|
||||
var elements = $sbTable.find('tr input:checked').parents('tr');
|
||||
|
||||
elements.hide();
|
||||
}
|
||||
@ -895,7 +926,7 @@ var AIRTIME = (function(AIRTIME){
|
||||
var $scroll = $sbContent.find(".dataTables_scrolling"),
|
||||
scrolled = $scroll.scrollTop(),
|
||||
scrollingTop = $scroll.offset().top,
|
||||
current = $sbTable.find(".sb-now-playing"),
|
||||
current = $sbTable.find("."+NOW_PLAYING_CLASS),
|
||||
currentTop = current.offset().top;
|
||||
|
||||
$scroll.scrollTop(currentTop - scrollingTop + scrolled);
|
||||
@ -935,22 +966,20 @@ var AIRTIME = (function(AIRTIME){
|
||||
//add events to cursors.
|
||||
$sbTable.find("tbody").on("click", "div.marker", function(event) {
|
||||
var $tr = $(this).parents("tr"),
|
||||
cursorSelClass = "cursor-selected-row";
|
||||
$trs;
|
||||
|
||||
if ($tr.hasClass(cursorSelClass)) {
|
||||
$tr.removeClass(cursorSelClass);
|
||||
if ($tr.hasClass(CURSOR_SELECTED_CLASS)) {
|
||||
mod.removeCursor($tr);
|
||||
}
|
||||
else {
|
||||
$tr.addClass(cursorSelClass);
|
||||
mod.selectCursor($tr);
|
||||
}
|
||||
|
||||
if (event.ctrlKey === false) {
|
||||
$sbTable.find('.'+cursorSelClass).not($tr)
|
||||
.removeClass(cursorSelClass);
|
||||
$trs = $sbTable.find('.'+CURSOR_SELECTED_CLASS).not($tr);
|
||||
mod.removeCursor($trs);
|
||||
}
|
||||
|
||||
mod.checkToolBarIcons();
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
@ -983,7 +1012,9 @@ var AIRTIME = (function(AIRTIME){
|
||||
if (oItems.selCurs !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
$(this).parents('tr').next().addClass(cursorClass);
|
||||
var $tr = $(this).parents('tr').next();
|
||||
|
||||
mod.selectCursor($tr);
|
||||
};
|
||||
|
||||
oItems.selCurs.callback = callback;
|
||||
@ -993,7 +1024,9 @@ var AIRTIME = (function(AIRTIME){
|
||||
if (oItems.delCurs !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
$(this).parents('tr').next().removeClass(cursorClass);
|
||||
var $tr = $(this).parents('tr').next();
|
||||
|
||||
mod.removeCursor($tr);
|
||||
};
|
||||
|
||||
oItems.delCurs.callback = callback;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user