Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
c5f0b5f6e1
2 changed files with 23 additions and 21 deletions
|
@ -73,7 +73,6 @@ function createDataGrid(){
|
||||||
"bInfo": false,
|
"bInfo": false,
|
||||||
"bLengthChange": false,
|
"bLengthChange": false,
|
||||||
"bPaginate": false,
|
"bPaginate": false,
|
||||||
"aaData": datagridData.rows,
|
|
||||||
"aoColumns": columns,
|
"aoColumns": columns,
|
||||||
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
||||||
if (aData[aData.length-2] == "t")
|
if (aData[aData.length-2] == "t")
|
||||||
|
@ -83,7 +82,8 @@ function createDataGrid(){
|
||||||
else if (aData[0] == "b")
|
else if (aData[0] == "b")
|
||||||
$(nRow).attr("style", "background-color:#EE3B3B");
|
$(nRow).attr("style", "background-color:#EE3B3B");
|
||||||
return nRow;
|
return nRow;
|
||||||
}
|
},
|
||||||
|
"bAutoWidth":false
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,15 +104,23 @@ function getAJAXURL(){
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateData(){
|
function updateDataTable(){
|
||||||
|
var table = $('#nowplayingtable').dataTable();
|
||||||
|
|
||||||
|
table.fnClearTable(false);
|
||||||
|
table.fnAddData(datagridData.rows);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function getData(){
|
||||||
$.ajax({ url: getAJAXURL(), dataType:"json", success:function(data){
|
$.ajax({ url: getAJAXURL(), dataType:"json", success:function(data){
|
||||||
datagridData = data.entries;
|
datagridData = data.entries;
|
||||||
createDataGrid();
|
updateDataTable();
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
|
|
||||||
function init2(){
|
function init2(){
|
||||||
updateData();
|
getData();
|
||||||
|
|
||||||
if (typeof registerSongEndListener == 'function' && !registered){
|
if (typeof registerSongEndListener == 'function' && !registered){
|
||||||
registered = true;
|
registered = true;
|
||||||
|
@ -128,6 +136,8 @@ function redirect(url){
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
createDataGrid();
|
||||||
if (viewType == "day"){
|
if (viewType == "day"){
|
||||||
$('#now_view').click(function(){redirect('/Nowplaying/index')});
|
$('#now_view').click(function(){redirect('/Nowplaying/index')});
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,6 @@ function nextShowStart(){
|
||||||
nextShowPrepare = true;
|
nextShowPrepare = true;
|
||||||
currentShow[0] = nextShow.shift();
|
currentShow[0] = nextShow.shift();
|
||||||
updatePlaybar();
|
updatePlaybar();
|
||||||
|
|
||||||
//notifySongEndListener();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called every "uiUpdateInterval" mseconds. */
|
/* Called every "uiUpdateInterval" mseconds. */
|
||||||
|
@ -108,6 +106,9 @@ function updateProgressBarValue(){
|
||||||
if (nextSongs.length > 0 && nextSongPrepare){
|
if (nextSongs.length > 0 && nextSongPrepare){
|
||||||
var diff = nextSongs[0].songStartPosixTime - estimatedSchedulePosixTime;
|
var diff = nextSongs[0].songStartPosixTime - estimatedSchedulePosixTime;
|
||||||
if (diff < serverUpdateInterval){
|
if (diff < serverUpdateInterval){
|
||||||
|
|
||||||
|
//sometimes the diff is negative (-100ms for example). Still looking
|
||||||
|
//into why this could sometimes happen.
|
||||||
if (diff < 0)
|
if (diff < 0)
|
||||||
diff=0;
|
diff=0;
|
||||||
|
|
||||||
|
@ -195,22 +196,13 @@ function calcAdditionalShowData(show){
|
||||||
if (show.length > 0){
|
if (show.length > 0){
|
||||||
show[0].showStartPosixTime = convertDateToPosixTime(show[0].start_timestamp);
|
show[0].showStartPosixTime = convertDateToPosixTime(show[0].start_timestamp);
|
||||||
show[0].showEndPosixTime = convertDateToPosixTime(show[0].end_timestamp);
|
show[0].showEndPosixTime = convertDateToPosixTime(show[0].end_timestamp);
|
||||||
|
|
||||||
//hack to fix case where show end is next day, but we have it set
|
|
||||||
//as the same day.
|
|
||||||
if (show[0].showEndPosixTime - show[0].showStartPosixTime < 0)
|
|
||||||
show[0].showEndPosixTime += 1000*3600*24;
|
|
||||||
|
|
||||||
show[0].showLengthMs = show[0].showEndPosixTime - show[0].showStartPosixTime;
|
show[0].showLengthMs = show[0].showEndPosixTime - show[0].showStartPosixTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseItems(obj){
|
function parseItems(obj){
|
||||||
APPLICATION_ENV = obj.env;
|
APPLICATION_ENV = obj.env;
|
||||||
|
|
||||||
var schedulePosixTime = convertDateToPosixTime(obj.schedulerTime);
|
|
||||||
schedulePosixTime += parseInt(obj.timezoneOffset)*1000;
|
|
||||||
|
|
||||||
$('#time-zone').text(obj.timezone);
|
$('#time-zone').text(obj.timezone);
|
||||||
|
|
||||||
previousSongs = obj.previous;
|
previousSongs = obj.previous;
|
||||||
|
@ -227,10 +219,10 @@ function parseItems(obj){
|
||||||
calcAdditionalShowData(obj.currentShow);
|
calcAdditionalShowData(obj.currentShow);
|
||||||
calcAdditionalShowData(obj.nextShow);
|
calcAdditionalShowData(obj.nextShow);
|
||||||
|
|
||||||
if (localRemoteTimeOffset == null){
|
var schedulePosixTime = convertDateToPosixTime(obj.schedulerTime);
|
||||||
var date = new Date();
|
schedulePosixTime += parseInt(obj.timezoneOffset)*1000;
|
||||||
localRemoteTimeOffset = date.getTime() - schedulePosixTime;
|
var date = new Date();
|
||||||
}
|
localRemoteTimeOffset = date.getTime() - schedulePosixTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue