From 4399242fe99cd988d411f4b365d7c590446bf2a1 Mon Sep 17 00:00:00 2001 From: sanj Date: Fri, 31 Dec 2010 00:59:07 +0530 Subject: [PATCH] show all layers --- padmaTexts/static/js/views/sidebar.js | 43 +++++++++++++++++---------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/padmaTexts/static/js/views/sidebar.js b/padmaTexts/static/js/views/sidebar.js index 88f2c7b..7e51c06 100644 --- a/padmaTexts/static/js/views/sidebar.js +++ b/padmaTexts/static/js/views/sidebar.js @@ -81,25 +81,13 @@ function setupPadmaLink(videoObj, data) { var currentLayers = videoObj.getLayersAtTimecode(npt2ms(linkData.tcIn)); var transcripts = filterLayersByTracks(currentLayers, ['transcript']); - // console.log(transcripts); if (transcripts.length > 0) { var annotHtml = transcripts[0].value_html; } else { var annotHtml = ''; } $('.annotationText').html(annotHtml); - /* - var closeBtn = $('
') - .addClass("close") - .click(function() { - sidebarAnimateOut(); - }) - .text("x") - .appendTo('.padmaViewer'); - */ var videoElem = $('video'); - // var videoObj = video; - videoElem.bind("play", function() { var that = this videoObj.interval = setInterval(function() { @@ -109,10 +97,9 @@ function setupPadmaLink(videoObj, data) { if (videoObj.currentLayers == allLayers) { return; } - // GLOBAL_FOO = allLayers; - var transcript = filterLayersByTracks(allLayers, ['transcript'])[0].value_html; - if (transcript != $('.annotationText').html()) { - $('.annotationText').html(transcript); + var html = getLayersHtml(time_ms, ['transcript']); + if (html != $('.annotationText').html()) { + $('.annotationText').html(html); } }, 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
"; + } + for (var i=0; i < thisTrackLayers.length; i++) { + var thisTrack = thisTrackLayers[i]; + var thisHtml = ''; + thisHtml += "" + thisTrack.creator + ":"; + thisHtml += " " + thisTrack.value_html + ""; + thisHtml += "

"; + annotHtml += thisHtml; + } + } + return annotHtml; + } + function isSidebarVisible() { if (padmaContainer.width() > 0) { return true;