From 79df30005a5165b3c0e16a01dda3026fd1e7ca6c Mon Sep 17 00:00:00 2001 From: Anna Sobiepanek Date: Thu, 1 Jul 2010 16:42:16 -0400 Subject: [PATCH] edited subtitles to appear only when language is different from the xml language tag --- popcorn.js | 21 +++++++++++------ xml/webMadeMovies.xml | 54 ++++++++++++++++++++++++++----------------- 2 files changed, 47 insertions(+), 28 deletions(-) diff --git a/popcorn.js b/popcorn.js index 82da292..8dd2b2e 100644 --- a/popcorn.js +++ b/popcorn.js @@ -168,25 +168,32 @@ // Child commands. Uses onIn() and onOut() to do time based operations var SubtitleCommand = function(name, params, text, videoManager) { + VideoCommand.call(this, name, params, text, videoManager); // Creates a div for all subtitles to use if (!SubtitleCommand.subDiv) { SubtitleCommand.subDiv = document.createElement('div'); - SubtitleCommand.subDiv.setAttribute('style', - 'position:absolute;top:240px;left:1px;color:white;font-weight:bold;font-family:sans-serif;text-shadow:black 1px 1px 3px;font-size:22px;width:820px;'); - document.getElementById("videoContainer").appendChild(SubtitleCommand.subDiv); + + var style = 'position:absolute;top:240px;left:1px;color:white;font-weight:bold;font-family:sans-serif;text-shadow:black 2px 2px 6px;font-size:18px;width:80%;'; + SubtitleCommand.subDiv.setAttribute('style', style); + document.getElementById("videoContainer").appendChild(SubtitleCommand.subDiv); } this.onIn = function() { var i = document.getElementById("language").selectedIndex; - google.language.translate(this.text, '', document.getElementById("language").options[i].getAttribute("val"), function(result) { - SubtitleCommand.subDiv.innerHTML = result.translation; - }); - + if( document.getElementById("language").options[i].getAttribute("val") !== ( this.params.language || "en") ) { + google.language.translate(this.text, '', document.getElementById("language").options[i].getAttribute("val"), function(result) { + SubtitleCommand.subDiv.innerHTML = result.translation; + }); + style = SubtitleCommand.subDiv.getAttribute("style") + 'text-align:'+( this.params.align || "center" )+';'; + SubtitleCommand.subDiv.setAttribute('style', style); + } }; this.onOut = function() { SubtitleCommand.subDiv.innerHTML = ""; }; + + }; //////////////////////////////////////////////////////////////////////////// diff --git a/xml/webMadeMovies.xml b/xml/webMadeMovies.xml index bbf00f2..9ba9128 100644 --- a/xml/webMadeMovies.xml +++ b/xml/webMadeMovies.xml @@ -37,27 +37,39 @@ - - Hello! My name is Celine Celine - And I help the Internet be easier - by making things easier - My name is Mona Kasra - and I'm building a better internet - I make the Internet better - producing and sharing music - using creative commons - I make the Internet better - because I fight for open educational resources - on the web - I make the Internet better - by hacking things - without using a single line of code - I make the Internet better - by changing the world of journalism - you can mobilize people - you don't need to have money anymore - or big structures - you can do everything at home with the Internet + + Alright lets take a look and show me how much neat things you can do on the internet + Have you ever wondered if there is a common thread + that exists between mobile phone hackers in South Africa, + adventures using kites to map an oil spil, + and a video of a cat seen by tens of millions of people? + Well it's the Internet - the cat, the kite, and the cell phone hackers + would all be impossible without the internet + an open platform that lets everyone participate without asking permission. + The Internet is what lets M.I.T student Geoffrey Warren + use kites to map the Luisiana oil spill. + well wait a second why do we have to go all the way into space to take pictures of things + that are righ, literally right next to us, you know. + We can use symple tools like baloons or kites. + Have the camera taking pictures every five seconds + the idea is to get a lot of people involved + in producing maps and then share all of the information + like wikipedia style you know? + The Internet is what allows Steve Song and his friends to create a D.I.Y. phone network + called the Village Telco. + Everyone that has a device that we call a mesh potatoe actually has a phone number + and can call anyone else on the mesh at no charge. + So taking an open-source principles to a telephone company. + Everything is open umm anyone can come and anyone can join, anyone can make contributions + + + My name is Mona Kasra + and I'm building a better Internet + + + I make the Internet better + producing and sharing music + using Creative Commons This video made exclusively for drumbeat.org -- 2.43.0