CC-4640: Automatically jump to current song when loading the Now Playing page.

-done
This commit is contained in:
denise 2012-10-29 15:20:16 -04:00
parent fdd889d7a8
commit 332f9993c0
1 changed files with 22 additions and 3 deletions

View File

@ -339,11 +339,23 @@ var AIRTIME = (function(AIRTIME){
});
};
mod.jumpToCurrentTrack = function() {
var $scroll = $sbContent.find(".dataTables_scrolling");
var scrolled = $scroll.scrollTop();
var scrollingTop = $scroll.offset().top;
var oTable = $('#show_builder_table').dataTable();
var current = $sbTable.find("."+NOW_PLAYING_CLASS);
var currentTop = current.offset().top;
$scroll.scrollTop(currentTop - scrollingTop + scrolled);
}
mod.builderDataTable = function() {
$sbContent = $('#show_builder');
$lib = $("#library_content"),
$sbTable = $sbContent.find('table');
var isInitialized = false;
oSchedTable = $sbTable.dataTable( {
"aoColumns": [
/* checkbox */ {"mDataProp": "allowed", "sTitle": "", "sWidth": "15px", "sClass": "sb-checkbox"},
@ -636,6 +648,11 @@ var AIRTIME = (function(AIRTIME){
$("#draggingContainer").remove();
},
"fnDrawCallback": function fnBuilderDrawCallback(oSettings, json) {
if (!isInitialized) {
mod.jumpToCurrentTrack();
}
isInitialized = true;
var wrapperDiv,
markerDiv,
$td,
@ -1021,7 +1038,7 @@ var AIRTIME = (function(AIRTIME){
if (AIRTIME.button.isDisabled('icon-step-forward', true) === true) {
return;
}
/*
var $scroll = $sbContent.find(".dataTables_scrolling"),
scrolled = $scroll.scrollTop(),
scrollingTop = $scroll.offset().top,
@ -1029,6 +1046,8 @@ var AIRTIME = (function(AIRTIME){
currentTop = current.offset().top;
$scroll.scrollTop(currentTop - scrollingTop + scrolled);
*/
mod.jumpToCurrentTrack();
});
//delete overbooked tracks.
@ -1196,7 +1215,7 @@ var AIRTIME = (function(AIRTIME){
};
}
});
});
};
return AIRTIME;