From d36922521a81c111a80f66b75e9117fac859bf7b Mon Sep 17 00:00:00 2001 From: sanj Date: Sun, 14 Nov 2010 07:30:22 +0530 Subject: [PATCH] remove console.log --- COPYING | 14 +++ padmaTexts/static/css/text.css | 29 ++++- padmaTexts/static/js/text.js | 155 ++++++++++++++------------- padmaTexts/templates/text_embed.html | 1 + 4 files changed, 120 insertions(+), 79 deletions(-) create mode 100644 COPYING diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..5a8e332 --- /dev/null +++ b/COPYING @@ -0,0 +1,14 @@ + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + 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. + diff --git a/padmaTexts/static/css/text.css b/padmaTexts/static/css/text.css index 5c482a3..a3b57af 100644 --- a/padmaTexts/static/css/text.css +++ b/padmaTexts/static/css/text.css @@ -29,8 +29,24 @@ h1 { 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 { width: 320px; + height: 100%; margin-right: 10px; position: fixed; top: 0px; @@ -43,6 +59,9 @@ h1 { #aboutTxt { color: #363636; padding: 15px; + height: 90%; + margin-top: 10%; + overflow-y: scroll; } #padmaSidebarRelative { @@ -55,10 +74,10 @@ h1 { .annotationText { color: #363636; - margin-top: 15px; - margin-bottom: 15px; + margin-top: 8px; + margin-bottom: 8px; font-size: 13px; - height: 360px; + height: 300px; overflow-y: auto; width: 90%; margin-left: auto; @@ -78,7 +97,7 @@ h1 { .padmaViewer video { width: 320px; - margin-top: 25px; + margin-top: 10px; margin-left: -6px; } @@ -90,7 +109,7 @@ h1 { } .padmaLink:hover { - color: blue; + color: red; } .padmaViewer .close { diff --git a/padmaTexts/static/js/text.js b/padmaTexts/static/js/text.js index 5ae4a1b..a78e055 100644 --- a/padmaTexts/static/js/text.js +++ b/padmaTexts/static/js/text.js @@ -23,6 +23,7 @@ function setupPadmaLink(videoObj, data) { var mid_frame_npt = ms2npt(parseInt((npt2ms(linkData.tcIn) + npt2ms(linkData.tcOut)) / 2)); // console.log(mid_frame_npt); var thumbUrl = videoObj.getFrame(mid_frame_npt); + break; default: var frame_npt = ms2npt(videoObj.video.poster_frame); var thumbUrl = videoObj.getFrame(frame_npt); @@ -40,6 +41,85 @@ function setupPadmaLink(videoObj, data) { $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 = $('
') + .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() { /* $container.animate({'width': '400px'}, function() { @@ -50,7 +130,7 @@ function setupPadmaLink(videoObj, data) { $('#essay').animate({'width': newWidth + "px"}); */ // $container.show(); - $('#aboutTxt').hide(); + $('#aboutTxt').fadeOut(); } function sidebarAnimateOut() { @@ -72,80 +152,7 @@ function setupPadmaLink(videoObj, data) { 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 = $('
') - .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 diff --git a/padmaTexts/templates/text_embed.html b/padmaTexts/templates/text_embed.html index f5209c7..af55a70 100644 --- a/padmaTexts/templates/text_embed.html +++ b/padmaTexts/templates/text_embed.html @@ -69,6 +69,7 @@
{% autoescape off %} +

{{ text.title }}