From: Nick Cammarata Date: Wed, 30 Jun 2010 20:27:17 +0000 (-0400) Subject: Merge branch '0.1' of http://github.com/annasob/popcorn-js into newcredits X-Git-Tag: v0.1~60^2~1^2~1 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=a1a15b52d8af24e91014b40d3b3fba40d3e15b82;p=popcorn-js.git Merge branch '0.1' of http://github.com/annasob/popcorn-js into newcredits Conflicts: index.html popcorn.js xml/webMadeMovies.xml --- a1a15b52d8af24e91014b40d3b3fba40d3e15b82 diff --cc index.html index dd43170,0342b01..fd63842 --- a/index.html +++ b/index.html @@@ -1,116 -1,211 +1,211 @@@ - - - html5 video demo - - - - - - - - - - -
- - - -

-

-

-
In this video:

-
-
-
-

-

+
+ + +
+ + +

+
+

Google News +

+
+
+
+

This video's copyright information

+
+
+ Attribution +
+
+
+ + + + -
-
+ - - + + + + + diff --cc popcorn.js index 48f98a5,22f6b81..732999d --- a/popcorn.js +++ b/popcorn.js @@@ -154,115 -155,32 +154,141 @@@ }; }; + //////////////////////////////////////////////////////////////////////////// + // GoogleNews Command + //////////////////////////////////////////////////////////////////////////// + + var GoogleNewsCommand = function(name, params, text, videoManager) { + VideoCommand.call(this, name, params, text, videoManager); + this.target = document.createElement('div'); + this.target.setAttribute('style', 'display:none;border:0px;'); + document.getElementById(this.params.target).appendChild(this.target); + this.target.setAttribute('id', this.id); + var content = document.getElementById(this.id); + var options = { + format : "300x250", + queryList : [ + {q: this.params.topic || "Top Stories"} + ] + }; + var newsShow = new google.elements.NewsShow(content, options); + this.onIn = function() { + this.target.setAttribute('style', 'display:inline'); + }; + this.onOut = function() { + this.target.setAttribute('style', 'display:none'); + }; + }; + + //////////////////////////////////////////////////////////////////////////// + // Credits Command + //////////////////////////////////////////////////////////////////////////// + var credits = { + add: function() { + + } + } + var CreditsCommand = function(name, params, text, videoManager) { + VideoCommand.call(this, name, params, text, videoManager); + $("#credits") + .width(this.videoManager.videoElement.clientWidth) + .height(this.videoManager.videoElement.clientHeight) + this.params["in"]=this.videoManager.videoElement.duration-.1; + this.params["out"]=this.videoManager.videoElement.duration+.1; + var that = this; + this.onIn = function() { + $("#credits").show(); + $("#choices").animate({ right:'+=200px' }, 1000); + CreditsCommand.add( [ + { + text: "Play Again", + click:function() { + CreditsCommand.killCol(0) + $('video')[0].currentTime=0; + } + }, + { + text: "People", + next:[ + { + text: "Nick Cammarata", + next: [ + { text: "Twitter", href: "http://twitter.com/nicklovescode" }, + { text: "Flickr", href: "http://flickr.com/nicklovescode" } + ] + }, + { + text: "Celine Celine", + href: "http://twitter.com/celinecelines" + } + ] + }, + { text: "Places" }, + { text: "Articles" } + ]); + }; + this.onOut = function() { + $("#choices").css("right","-200px"); + $("#credits").hide(); + }; + }; + CreditsCommand.colIndex = 0; + CreditsCommand.killCol = function(index, callback) { + $(".column").each(function() { + if ($(this).attr("colindex")>index) { + $(this).addClass("removing").animate( { left: -$(this).outerWidth() + "px" }, 1200, function() { + $(this).remove(); + }); + } + }); + if (callback) callback(); + } + + CreditsCommand.add = function(items) { + CreditsCommand.colIndex++; + var ul = $("") + .addClass('column') + .attr('colindex',parseInt(CreditsCommand.colIndex)) + $.each(items, function(i, val) { + var li = $(document.createElement('li')) + .append($(document.createElement('a')) + .text(val.text) + .attr("href",val.href||"#") + .attr("target",val.href?"_blank":"")) + .appendTo(ul) + .addClass('play') + .click(function() { + if (val.href) return true; + var colIndex = $(this).parent().attr('colindex'); + if (CreditsCommand.colIndex>colIndex) { + CreditsCommand.killCol(colIndex); + CreditsCommand.colIndex = colIndex; + } + var hasClass = $(this).hasClass('selected'); + if (!hasClass) { + if (val.click) val.click(); + if (val.next) CreditsCommand.add(val.next); + } + $(this) + .parent() + .find('.selected') + .removeClass('selected') + if (!hasClass) $(this).addClass('selected'); + }) + }); + var width = 0; + $(".column:not(.removing)").each(function() { + width+=$(this).outerWidth(); + }) + ul + .appendTo("#credit_inner") + .css("z-index",1000-CreditsCommand.colIndex) + .css("left",-ul.outerWidth()) + .animate({ + left: width + "px" + },750) + } + //////////////////////////////////////////////////////////////////////////// // TagThisPerson Command //////////////////////////////////////////////////////////////////////////// @@@ -552,6 -460,16 +577,11 @@@ create: function(name, params, text, videoManager) { return new AttributionCommand(name, params, text, videoManager); } + }, + googlenews: { + create: function(name, params, text, videoManager) { + return new GoogleNewsCommand(name, params, text, videoManager); + } - }, - flickr: { - create: function(name, params, text, videoManager) { - return new FlickrCommand(name, params, text, videoManager); - } } }; diff --cc xml/webMadeMovies.xml index b487021,6309526..fb13f6b --- a/xml/webMadeMovies.xml +++ b/xml/webMadeMovies.xml @@@ -73,14 -74,12 +74,15 @@@ Celine Celine - - + + - - - + + test + + + + +