remove console.log

This commit is contained in:
sanj 2010-11-14 07:30:22 +05:30
parent 1f2fedf419
commit d36922521a
4 changed files with 120 additions and 79 deletions

14
COPYING Normal file
View File

@ -0,0 +1,14 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@ -29,8 +29,24 @@ h1 {
font-family: "Times New Roman", Times, serif; font-family: "Times New Roman", Times, serif;
} }
#loading {
position: fixed;
right: 0px;
bottom: 40%;
top: 40%;
width: 320px;
height: 20%;
font-size: 24px;
font-weight: bold;
color: #fff;
background: #898989;
opacity: 0;
z-index: 1000;
}
#padmaSidebar { #padmaSidebar {
width: 320px; width: 320px;
height: 100%;
margin-right: 10px; margin-right: 10px;
position: fixed; position: fixed;
top: 0px; top: 0px;
@ -43,6 +59,9 @@ h1 {
#aboutTxt { #aboutTxt {
color: #363636; color: #363636;
padding: 15px; padding: 15px;
height: 90%;
margin-top: 10%;
overflow-y: scroll;
} }
#padmaSidebarRelative { #padmaSidebarRelative {
@ -55,10 +74,10 @@ h1 {
.annotationText { .annotationText {
color: #363636; color: #363636;
margin-top: 15px; margin-top: 8px;
margin-bottom: 15px; margin-bottom: 8px;
font-size: 13px; font-size: 13px;
height: 360px; height: 300px;
overflow-y: auto; overflow-y: auto;
width: 90%; width: 90%;
margin-left: auto; margin-left: auto;
@ -78,7 +97,7 @@ h1 {
.padmaViewer video { .padmaViewer video {
width: 320px; width: 320px;
margin-top: 25px; margin-top: 10px;
margin-left: -6px; margin-left: -6px;
} }
@ -90,7 +109,7 @@ h1 {
} }
.padmaLink:hover { .padmaLink:hover {
color: blue; color: red;
} }
.padmaViewer .close { .padmaViewer .close {

View File

@ -23,6 +23,7 @@ function setupPadmaLink(videoObj, data) {
var mid_frame_npt = ms2npt(parseInt((npt2ms(linkData.tcIn) + npt2ms(linkData.tcOut)) / 2)); var mid_frame_npt = ms2npt(parseInt((npt2ms(linkData.tcIn) + npt2ms(linkData.tcOut)) / 2));
// console.log(mid_frame_npt); // console.log(mid_frame_npt);
var thumbUrl = videoObj.getFrame(mid_frame_npt); var thumbUrl = videoObj.getFrame(mid_frame_npt);
break;
default: default:
var frame_npt = ms2npt(videoObj.video.poster_frame); var frame_npt = ms2npt(videoObj.video.poster_frame);
var thumbUrl = videoObj.getFrame(frame_npt); var thumbUrl = videoObj.getFrame(frame_npt);
@ -40,6 +41,85 @@ function setupPadmaLink(videoObj, data) {
$a.click(function(e) { $a.click(function(e) {
// sidebarAnimateIn();
e.preventDefault();
var currentVideo = padmaContainer.data("currentVideo");
if (currentVideo == videoObj) {
/*
if (!isSidebarVisible()) {
sidebarAnimateIn();
}
*/
return;
}
if (currentVideo) {
cleanupVideo(currentVideo);
}
$container.data("currentVideo", videoObj);
if (!isSidebarVisible()) {
sidebarAnimateIn();
}
videoObj.getLayersData(displayLayer, {'linkData': linkData});
$('#loading').fadeTo(0.5);
function displayLayer(videoObj, data) {
$('#loading').fadeOut();
var linkData = data.linkData;
var html = tmpl("tmpl_sidebar", {'video': videoObj, 'linkData': linkData});
$('#padmaSidebarWrapper').html(html);
$('#aboutTxt').hide();
//FIXME: should be a better way to deal with displaying default layer.
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 = $('<div />')
.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() {
var currentTime = parseInt(that.currentTime * 1000);
var time_ms = currentTime + npt2ms(linkData.tcIn);
var allLayers = videoObj.getLayersAtTimecode(time_ms);
if (videoObj.currentLayers == allLayers) {
return;
}
// GLOBAL_FOO = allLayers;
var transcript = filterLayersByTracks(allLayers, ['transcript'])[0].value_html;
if (transcript != $('.annotationText').html()) {
$('.annotationText').html(transcript);
}
}, 150);
});
videoElem.bind("pause", function() {
clearInterval(videoObj.interval);
});
videoElem.bind("ended", function() {
clearInterval(videoObj.interval);
// cleanupVideo(videoObj);
sidebarAnimateOut();
});
}
function sidebarAnimateIn() { function sidebarAnimateIn() {
/* /*
$container.animate({'width': '400px'}, function() { $container.animate({'width': '400px'}, function() {
@ -50,7 +130,7 @@ function setupPadmaLink(videoObj, data) {
$('#essay').animate({'width': newWidth + "px"}); $('#essay').animate({'width': newWidth + "px"});
*/ */
// $container.show(); // $container.show();
$('#aboutTxt').hide(); $('#aboutTxt').fadeOut();
} }
function sidebarAnimateOut() { function sidebarAnimateOut() {
@ -72,80 +152,7 @@ function setupPadmaLink(videoObj, data) {
return false; return false;
} }
} }
// sidebarAnimateIn();
e.preventDefault();
var currentVideo = padmaContainer.data("currentVideo");
if (currentVideo == videoObj) {
/*
if (!isSidebarVisible()) {
sidebarAnimateIn();
}
*/
return;
}
if (currentVideo) {
cleanupVideo(currentVideo);
}
$container.data("currentVideo", videoObj);
if (!isSidebarVisible()) {
sidebarAnimateIn();
}
var html = tmpl("tmpl_sidebar", {'video': videoObj, 'linkData': linkData});
$('#padmaSidebarWrapper').html(html);
$('#aboutTxt').hide();
//FIXME: should be a better way to deal with displaying default layer.
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 = $('<div />')
.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() {
var currentTime = parseInt(that.currentTime * 1000);
var time_ms = currentTime + npt2ms(linkData.tcIn);
var allLayers = videoObj.getLayersAtTimecode(time_ms);
if (videoObj.currentLayers == allLayers) {
return;
}
// GLOBAL_FOO = allLayers;
var transcript = filterLayersByTracks(allLayers, ['transcript'])[0].value_html;
if (transcript != $('.annotationText').html()) {
$('.annotationText').html(transcript);
}
}, 150);
});
videoElem.bind("pause", function() {
clearInterval(videoObj.interval);
});
videoElem.bind("ended", function() {
clearInterval(videoObj.interval);
// cleanupVideo(videoObj);
sidebarAnimateOut();
});
}); });
} }
//All functions that destroy the video must call this to ensure clean-ups are handled //All functions that destroy the video must call this to ensure clean-ups are handled

View File

@ -69,6 +69,7 @@
</div> </div>
</script> </script>
{% autoescape off %} {% autoescape off %}
<div id="loading"></div>
<div id="wrapper"> <div id="wrapper">
<h1> <h1>
{{ text.title }} {{ text.title }}