From ced92ce77e939fef8b689bcbeac068b41fa16738 Mon Sep 17 00:00:00 2001 From: Anna Sobiepanek Date: Thu, 14 Oct 2010 14:03:49 -0400 Subject: [PATCH] added iframe support [#114 state:peer-review-requested] --- demos/semantic_video/index.html | 8 ++++++ demos/semantic_video/xml/webMadeMovies.xml | 8 +++--- popcorn.js | 30 ++++++++++++++++++++++ 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/demos/semantic_video/index.html b/demos/semantic_video/index.html index d0ca857..7c5fab5 100644 --- a/demos/semantic_video/index.html +++ b/demos/semantic_video/index.html @@ -168,6 +168,14 @@ + +
+
+ Collapse +
+
+
+

In this video:

diff --git a/demos/semantic_video/xml/webMadeMovies.xml b/demos/semantic_video/xml/webMadeMovies.xml index 54dd089..9dfad3f 100644 --- a/demos/semantic_video/xml/webMadeMovies.xml +++ b/demos/semantic_video/xml/webMadeMovies.xml @@ -9,7 +9,7 @@ - + @@ -304,8 +304,6 @@ along the way. Explore our credits section to see how you can get involved. - - My name is Mona Kasra @@ -317,6 +315,10 @@ using Creative Commons + + + + diff --git a/popcorn.js b/popcorn.js index 04726d4..085f2e0 100644 --- a/popcorn.js +++ b/popcorn.js @@ -965,6 +965,31 @@ this.videoManager.videoElement.currentTime = this.params.seekto; }; }; + //////////////////////////////////////////////////////////////////////////// + // WebPage Command + //////////////////////////////////////////////////////////////////////////// + + Popcorn.WebPageCommand = function(name, params, text, videoManager) { + Popcorn.VideoCommand.call(this, name, params, text, videoManager); + + // Setup a default, iframe to hold the website + var target = document.createElement('iframe'); + target.setAttribute('src', this.params.src); + target.setAttribute('width', this.params.width); + target.setAttribute('height', this.params.height); + target.setAttribute('id', this.id); + document.getElementById(this.params.target).appendChild(target); + // iframe is hidden by default + target.setAttribute('style', 'display:none'); + // toggle display of the iframe + this.target = target; + this.onIn = function() { + this.target.setAttribute('style', 'display:inline'); + }; + this.onOut = function() { + this.target.setAttribute('style', 'display:none'); + }; + }; // Wrapper for accessing commands by name // commands[name].create() returns a new command of type name @@ -1035,6 +1060,11 @@ create: function(name, params, text, videoManager) { return new Popcorn.SeekCommand(name, params, text, videoManager); } + }, + webpage: { + create: function(name, params, text, videoManager) { + return new Popcorn.WebPageCommand(name, params, text, videoManager); + } } }; -- 2.43.0