Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
c5f0b5f6e1
|
@ -73,7 +73,6 @@ function createDataGrid(){
|
|||
"bInfo": false,
|
||||
"bLengthChange": false,
|
||||
"bPaginate": false,
|
||||
"aaData": datagridData.rows,
|
||||
"aoColumns": columns,
|
||||
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
||||
if (aData[aData.length-2] == "t")
|
||||
|
@ -83,7 +82,8 @@ function createDataGrid(){
|
|||
else if (aData[0] == "b")
|
||||
$(nRow).attr("style", "background-color:#EE3B3B");
|
||||
return nRow;
|
||||
}
|
||||
},
|
||||
"bAutoWidth":false
|
||||
} );
|
||||
|
||||
|
||||
|
@ -104,15 +104,23 @@ function getAJAXURL(){
|
|||
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){
|
||||
datagridData = data.entries;
|
||||
createDataGrid();
|
||||
updateDataTable();
|
||||
}});
|
||||
}
|
||||
|
||||
function init2(){
|
||||
updateData();
|
||||
getData();
|
||||
|
||||
if (typeof registerSongEndListener == 'function' && !registered){
|
||||
registered = true;
|
||||
|
@ -128,6 +136,8 @@ function redirect(url){
|
|||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
createDataGrid();
|
||||
if (viewType == "day"){
|
||||
$('#now_view').click(function(){redirect('/Nowplaying/index')});
|
||||
|
||||
|
|
|
@ -73,8 +73,6 @@ function nextShowStart(){
|
|||
nextShowPrepare = true;
|
||||
currentShow[0] = nextShow.shift();
|
||||
updatePlaybar();
|
||||
|
||||
//notifySongEndListener();
|
||||
}
|
||||
|
||||
/* Called every "uiUpdateInterval" mseconds. */
|
||||
|
@ -108,6 +106,9 @@ function updateProgressBarValue(){
|
|||
if (nextSongs.length > 0 && nextSongPrepare){
|
||||
var diff = nextSongs[0].songStartPosixTime - estimatedSchedulePosixTime;
|
||||
if (diff < serverUpdateInterval){
|
||||
|
||||
//sometimes the diff is negative (-100ms for example). Still looking
|
||||
//into why this could sometimes happen.
|
||||
if (diff < 0)
|
||||
diff=0;
|
||||
|
||||
|
@ -195,22 +196,13 @@ function calcAdditionalShowData(show){
|
|||
if (show.length > 0){
|
||||
show[0].showStartPosixTime = convertDateToPosixTime(show[0].start_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;
|
||||
}
|
||||
}
|
||||
|
||||
function parseItems(obj){
|
||||
APPLICATION_ENV = obj.env;
|
||||
|
||||
var schedulePosixTime = convertDateToPosixTime(obj.schedulerTime);
|
||||
schedulePosixTime += parseInt(obj.timezoneOffset)*1000;
|
||||
|
||||
|
||||
$('#time-zone').text(obj.timezone);
|
||||
|
||||
previousSongs = obj.previous;
|
||||
|
@ -227,10 +219,10 @@ function parseItems(obj){
|
|||
calcAdditionalShowData(obj.currentShow);
|
||||
calcAdditionalShowData(obj.nextShow);
|
||||
|
||||
if (localRemoteTimeOffset == null){
|
||||
var date = new Date();
|
||||
localRemoteTimeOffset = date.getTime() - schedulePosixTime;
|
||||
}
|
||||
var schedulePosixTime = convertDateToPosixTime(obj.schedulerTime);
|
||||
schedulePosixTime += parseInt(obj.timezoneOffset)*1000;
|
||||
var date = new Date();
|
||||
localRemoteTimeOffset = date.getTime() - schedulePosixTime;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue