]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
Merge commit 'origin/iframe'
authorAnna Sobiepanek <annaopensource@gmail.com>
Thu, 14 Oct 2010 21:28:27 +0000 (17:28 -0400)
committerAnna Sobiepanek <annaopensource@gmail.com>
Thu, 14 Oct 2010 21:28:27 +0000 (17:28 -0400)
Conflicts:
popcorn.js

1  2 
popcorn.js

diff --cc popcorn.js
index 96dfaad857dcfff4b877897d74b34d415308dd0d,085f2e0ec648cf46a24ab7015b06de021c1ee0fc..8bac9effd873671cda20fdc419396cf194456a5d
        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?
          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);
        }
      }
    };