From: ScottDowne Date: Thu, 1 Jul 2010 23:19:13 +0000 (-0700) Subject: Lower third implimented. Radical. X-Git-Tag: v0.1~53^2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=fe64eb33b29838a812d92e5081691ad0f91a4f15;p=popcorn-js.git Lower third implimented. Radical. --- diff --git a/index.html b/index.html index ca480ca..6b1470b 100644 --- a/index.html +++ b/index.html @@ -74,7 +74,7 @@
- +
@@ -112,22 +112,22 @@
-

Twitter Updates -  

- Collapse -
-
+

Twitter Updates +  

+ Collapse +
+
-

Flickr Images -  

- Collapse -
-
+

Flickr Images +  

+ Collapse +
+
@@ -139,69 +139,67 @@
-
+

Filmed in:

-
+
+ +
-
- -
+
-

Twitter

- Collapse -
-
+

Twitter

+ Collapse +
+
-

Wikipedia

- Collapse +

Wikipedia

+ Collapse -
- Use the #Evernote Fx Add-on to save, organize, & search info you find on the Web http://bit.ly/evernotewebclipper /via @rockyourfirefox - more -
-
-
-

Flickr Images

- Collapse +
-
-
+
+ +
+

Flickr Images

+ Collapse +
+

-

Google News -

-
-
-
-

This video's copyright information

+

Google News +

+
+
+ +

This video's copyright information

-
+
Attribution
-
+ @@ -211,4 +209,4 @@ - + \ No newline at end of file diff --git a/popcorn.js b/popcorn.js index 7b5866d..096fec7 100644 --- a/popcorn.js +++ b/popcorn.js @@ -189,6 +189,44 @@ }; }; + //////////////////////////////////////////////////////////////////////////// + // Lower third text Command + //////////////////////////////////////////////////////////////////////////// + + var LowerThirdCommand = function(name, params, text, videoManager) { + VideoCommand.call(this, name, params, text, videoManager); + + // Creates a div for all subtitles to use + if (!LowerThirdCommand.ltDiv) { + LowerThirdCommand.ltDiv = document.createElement('div'); + LowerThirdCommand.ltDiv.setAttribute('style', + 'padding-left:40px;padding-right:40px;padding-top:40px;position:absolute;top:150px;left:1px;color:white;font-weight:bold;font-family:sans-serif;text-shadow:black 1px 1px 3px;font-size:22px;width:450px;'); + document.getElementById("videoContainer").appendChild(LowerThirdCommand.ltDiv); + } + this.onIn = function() { + $(LowerThirdCommand.ltDiv).css("text-align", (this.params.align || 'left')); + var i = document.getElementById("language").selectedIndex; + google.language.translate((this.params.salutation || ""), '', document.getElementById("language").options[i].getAttribute("val"), function(result) { + var span = document.createElement('span'); + span.innerHTML = result.translation + " "; + span.setAttribute('style', 'font-size:26px;'); + LowerThirdCommand.ltDiv.appendChild(span); + }); + google.language.translate((this.params.name || ""), '', document.getElementById("language").options[i].getAttribute("val"), function(result) { + var span = document.createElement('span'); + span.innerHTML = result.translation; + span.setAttribute('style', 'font-size:26px;'); + LowerThirdCommand.ltDiv.appendChild(span); + }); + google.language.translate((this.params.role || ""), '', document.getElementById("language").options[i].getAttribute("val"), function(result) { + LowerThirdCommand.ltDiv.innerHTML += "
" + result.translation; + }); + }; + this.onOut = function() { + LowerThirdCommand.ltDiv.innerHTML = ""; + }; + }; + //////////////////////////////////////////////////////////////////////////// // GoogleNews Command //////////////////////////////////////////////////////////////////////////// @@ -479,7 +517,49 @@ this.target.setAttribute('style', 'display:none'); }; }; + + //////////////////////////////////////////////////////////////////////////// + // Wiki Command + //////////////////////////////////////////////////////////////////////////// + + var WikiCommand = function(name, params, text, videoManager) { + VideoCommand.call(this, name, params, text, videoManager); + + var src = this.params.src; + var length = this.params.numberOfWords; + // Setup a default, hidden div to hold the images + var target = document.createElement('div'); + target.setAttribute('id', this.id); + document.getElementById(this.params.target).appendChild(target); + // Div is hidden by default + target.setAttribute('style', 'display:none'); + // This uses jquery + $.getJSON("http://en.wikipedia.org/w/api.php?action=parse&props=text&page=" + ( this.params.title || src.slice(src.lastIndexOf("/")+1) ) + "&format=json&callback=?", function(data){ + if( data ) { + //make a link to the document + var link = document.createElement('a'); + link.setAttribute('href', src); + var p = document.createElement('p'); + p.innerHTML = data.parse.displaytitle; + link.appendChild(p); + // get the first 140 characters of the wiki content + var desc = document.createElement('p'); + var text = data.parse.text.*.substr(data.parse.text.*.indexOf('

')); + text = text.replace(/((<(.|\n)+?>)|(\((.*?)\) )|(\[(.*?)\]))/g, ""); + desc.innerHTML = text.substr(0, ( length || 140 )) + " ..."; + target.appendChild(link); + target.appendChild(desc); + } + }); + this.target = target; + this.onIn = function() { + this.target.setAttribute('style', 'display:inline'); + }; + this.onOut = function() { + this.target.setAttribute('style', 'display:none'); + }; + }; //////////////////////////////////////////////////////////////////////////// // Footnote Command //////////////////////////////////////////////////////////////////////////// @@ -612,6 +692,16 @@ create: function(name, params, text, videoManager) { return new GoogleNewsCommand(name, params, text, videoManager); } + }, + wiki: { + create: function(name, params, text, videoManager) { + return new WikiCommand(name, params, text, videoManager); + } + }, + lowerthird: { + create: function(name, params, text, videoManager) { + return new LowerThirdCommand(name, params, text, videoManager); + } } }; @@ -692,4 +782,3 @@ }, false); }()); - diff --git a/xml/webMadeMovies.xml b/xml/webMadeMovies.xml index d11728c..6a2355f 100644 --- a/xml/webMadeMovies.xml +++ b/xml/webMadeMovies.xml @@ -21,21 +21,21 @@ + - + + license="CC-BY-NC-ND" licenseurl="http://creativecommons.org/licenses/by-nc/2.0/"/> + + + - - - - - + Hello! My name is Celine Celine @@ -65,76 +65,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - This video made exclusively for drumbeat.org - - - - - - - - - The Village Telco, Richard Mills - KeyBoard Cat, Charlie Schmidt - Grassroots Mapping, Tungsten Monkey - + + + A Shared Culture, Jesse Dylan @@ -150,23 +83,29 @@ Village Telco Guy Charlie Schmidt Keyboard Cat - Charlie Schmidt - Jonathan Zittrain - NCSA guy - Computer Chronicles guy #1 - Computer Chronicles guy #2 - Computer Chronicles guy #3 + Charlie Schmidt + Jonathan Zittrain + NCSA guy + Computer Chronicles guy #1 + Computer Chronicles guy #2 + Computer Chronicles guy #3 Jonathan Zittrain Mona Kasra Noah Workman - Brazillian dude - Keechang Kim - Celine Celines + Brazillian dude + Keechang Kim + Celine Celines + + + + + + \ No newline at end of file