*/
var _feedFired = false,
- _feedLoaded = false;
+ _feedLoaded = false,
+ i = 1;
// insert google api and dynamic feed control script once, as well as the dynamic feed css file
if ( !_feedFired ) {
// that already exists in the parent div gets overwritten
var newdiv = document.createElement( "div" );
newdiv.style.display = "none";
+ newdiv.id = "_feed"+i;
+ newdiv.style.width = "100%";
+ newdiv.style.height = "100%";
+ i++;
if ( document.getElementById( options.target ) ) {
document.getElementById( options.target ).appendChild( newdiv );
}
*/
start: function( event, options ){
newdiv.setAttribute( "style", "display:inline" );
-
// Default to vertical orientation if empty or incorrect input
if( !options.orientation || ( options.orientation.toLowerCase() != "vertical" &&
options.orientation.toLowerCase() != "horizontal" ) ) {
orientation : { elem:"input", type:"text", label:"orientation" }
}
});
+
})( Popcorn );
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Popcorn API</title>
+ <link rel="stylesheet" href="../../test/qunit/qunit.css" type="text/css" media="screen">
+ <script src="../../test/qunit/qunit.js"></script>
+ <!--
+ do not move - this must be called immediately prior to
+ popcorn-api-draft.js
+ -->
+
+ <script src="../../popcorn.js"></script>
+ <script src="popcorn.googlefeed.js"></script>
+
+ <script src="popcorn.googlefeed.unit.js"></script>
+</head>
+<body>
+ <h1 id="qunit-header">Popcorn Google Feed Plugin</h1>
+ <h2 id="qunit-banner"></h2>
+ <div id="qunit-testrunner-toolbar"></div>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture"> </div>
+
+ <video id='video'
+ controls preload='none'
+ width= '250px'
+ poster="../../test/poster.png">
+
+ <source id='mp4'
+ src="../../test/trailer.mp4"
+ type='video/mp4; codecs="avc1, mp4a"'>
+
+ <source id='ogv'
+ src="../../test/trailer.ogv"
+ type='video/ogg; codecs="theora, vorbis"'>
+
+ <p>Your user agent does not support the HTML5 Video element.</p>
+
+ </video>
+ <div id="feed" style="position:relative;float:left;width:400px;height:600px"></div>
+ <div id="feed1" style="position:relative;float:left;width:600px;height:200px"></div>
+</body>
+</html>
--- /dev/null
+test("Popcorn Google Feed Plugin", function () {
+
+ var popped = Popcorn("#video"),
+ expects = 10,
+ count = 0;
+
+ console.log(expects);
+
+ expect(expects);
+
+ function plus() {
+ if ( ++count===expects) {
+ start();
+ }
+ }
+
+ stop();
+
+ ok ('googlefeed' in popped, "googlefeed is a method of the popped instance");
+ plus();
+ ok ( document.getElementById('feed').innerHTML === "", "initially, there is nothing inside the feed" );
+ plus();
+ ok ( document.getElementById('feed1').innerHTML === "", "initially, there is nothing inside the feed1" );
+ plus();
+
+ popped.googlefeed({
+ start: 0, // seconds
+ end: 5, // seconds
+ target: "feed",
+ url: "http://zenit.senecac.on.ca/~chris.tyler/planet/rss20.xml",
+ title: "Planet Feed",
+ orientation: "Vertical"
+ } )
+ .googlefeed({
+ start: 0, // seconds
+ end: 5, // seconds
+ target: "feed1",
+ url: "http://blog.pikimal.com/geek/feed/",
+ title: "pikiGeek",
+ orientation: "Horizontal"
+ } )
+ .volume(0);
+
+ popped.exec( 1, function() {
+ ok(google.load, "Google Feed is available");
+ plus();
+ ok(GFdynamicFeedControl, "Dynamic Feed Control Available");
+ plus();
+ ok (document.getElementById('_feed1'), "First feed is on the page" );
+ plus();
+ equals (document.getElementById('_feed1').offsetParent.id, "feed", "First feed is inside the 'feed' div" );
+ plus();
+ });
+ popped.exec( 2, function() {
+ ok (document.getElementById('_feed2'), "Second feed is on the page" );
+ plus();
+ equals (document.getElementById('_feed2').offsetParent.id, "feed1", "Second feed is inside the 'feed2' div" );
+ plus();
+ });
+ popped.exec( 6, function() {
+ ok (document.getElementById('_feed2').style.display === "none" &&
+ document.getElementById('_feed1').style.display === "none", "Both feeds are no lnger visible" );
+ plus();
+ });
+
+ popped.play();
+
+});