show all layers

This commit is contained in:
sanj 2010-12-31 00:59:07 +05:30
parent d6a4d9c0ee
commit 4399242fe9

View File

@ -81,25 +81,13 @@ function setupPadmaLink(videoObj, data) {
var currentLayers = videoObj.getLayersAtTimecode(npt2ms(linkData.tcIn)); var currentLayers = videoObj.getLayersAtTimecode(npt2ms(linkData.tcIn));
var transcripts = filterLayersByTracks(currentLayers, ['transcript']); var transcripts = filterLayersByTracks(currentLayers, ['transcript']);
// console.log(transcripts);
if (transcripts.length > 0) { if (transcripts.length > 0) {
var annotHtml = transcripts[0].value_html; var annotHtml = transcripts[0].value_html;
} else { } else {
var annotHtml = ''; var annotHtml = '';
} }
$('.annotationText').html(annotHtml); $('.annotationText').html(annotHtml);
/*
var closeBtn = $('<div />')
.addClass("close")
.click(function() {
sidebarAnimateOut();
})
.text("x")
.appendTo('.padmaViewer');
*/
var videoElem = $('video'); var videoElem = $('video');
// var videoObj = video;
videoElem.bind("play", function() { videoElem.bind("play", function() {
var that = this var that = this
videoObj.interval = setInterval(function() { videoObj.interval = setInterval(function() {
@ -109,10 +97,9 @@ function setupPadmaLink(videoObj, data) {
if (videoObj.currentLayers == allLayers) { if (videoObj.currentLayers == allLayers) {
return; return;
} }
// GLOBAL_FOO = allLayers; var html = getLayersHtml(time_ms, ['transcript']);
var transcript = filterLayersByTracks(allLayers, ['transcript'])[0].value_html; if (html != $('.annotationText').html()) {
if (transcript != $('.annotationText').html()) { $('.annotationText').html(html);
$('.annotationText').html(transcript);
} }
}, 150); }, 150);
}); });
@ -152,6 +139,30 @@ function setupPadmaLink(videoObj, data) {
*/ */
} }
function getLayersHtml(tc, tracks) {
//FIXME: This code is retarded, but we do want a way to group transcripts, descriptions, etc.
var currentLayers = videoObj.getLayersAtTimecode(tc);
var annotLayers = [];
var annotHtml = '';
for (var t=0; t < tracks.length; t++) {
var thisTrack = tracks[t];
var thisTrackLayers = filterLayersByTracks(currentLayers, [thisTrack]);
if (thisTrackLayers.length > 0) {
annotHtml += thisTrack + "s<br />";
}
for (var i=0; i < thisTrackLayers.length; i++) {
var thisTrack = thisTrackLayers[i];
var thisHtml = '';
thisHtml += "<span class='padmaContributor'>" + thisTrack.creator + ":</span>";
thisHtml += " <span class='padmaAnnotation'>" + thisTrack.value_html + "</span>";
thisHtml += "<br /><br />";
annotHtml += thisHtml;
}
}
return annotHtml;
}
function isSidebarVisible() { function isSidebarVisible() {
if (padmaContainer.width() > 0) { if (padmaContainer.width() > 0) {
return true; return true;