From: Anna Sobiepanek Date: Thu, 14 Oct 2010 21:28:27 +0000 (-0400) Subject: Merge commit 'origin/iframe' X-Git-Tag: v0.1~15 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=c34fd2e6a635ed9c7f844630d9f4c676fd3f13d4;p=popcorn-js.git Merge commit 'origin/iframe' Conflicts: popcorn.js --- c34fd2e6a635ed9c7f844630d9f4c676fd3f13d4 diff --cc popcorn.js index 96dfaad,085f2e0..8bac9ef --- a/popcorn.js +++ b/popcorn.js @@@ -986,23 -965,32 +986,49 @@@ this.videoManager.videoElement.currentTime = this.params.seekto; }; }; + + //////////////////////////////////////////////////////////////////////////// + // Script Command + //////////////////////////////////////////////////////////////////////////// + + Popcorn.ScriptCommand = function(name, params, text, videoManager) { + Popcorn.VideoCommand.call(this, name, params, text, videoManager); + this.start = eval(this.params.start) || function() {}; + this.stop = eval(this.params.stop) || function() {}; + this.onIn = function() { + this.start(); + }; + this.onOut = function() { + this.stop(); + }; + }; + + //////////////////////////////////////////////////////////////////////////// + // 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 // Not sure if this is the best way; maybe it's too fancy? @@@ -1073,9 -1061,9 +1099,14 @@@ return new Popcorn.SeekCommand(name, params, text, videoManager); } }, + script: { + create: function(name, params, text, videoManager) { + return new Popcorn.ScriptCommand(name, params, text, videoManager); ++ } ++ }, + webpage: { + create: function(name, params, text, videoManager) { + return new Popcorn.WebPageCommand(name, params, text, videoManager); } } };