var popped = Popcorn("#video"),
expects = 5,
count = 0,
- interval,
- interval2,
flickrdiv = document.getElementById('flickrdiv');
expect( expects );
popped.flickr({
start: 1, // seconds
- end: 3, // seconds
+ end: 3, // seconds
userid: '35034346917@N01',
numberofimages: '1',
target: 'flickrdiv'
} );
- interval = setInterval( function() {
- if( popped.currentTime() > 1 && popped.currentTime() < 3 ) {
- ok( /display: inline;/.test( flickrdiv.innerHTML ), "Div contents are displayed" );
- plus();
- ok( /img/.test( flickrdiv.innerHTML ), "An image exists" );
- plus();
- clearInterval( interval );
- }
- }, 500);
-
- interval2 = setInterval( function() {
- if( popped.currentTime() > 3 ) {
- ok( /display: none;/.test( flickrdiv.innerHTML ), "Div contents are hidden again" );
- plus();
- clearInterval( interval2 );
- }
- }, 500);
+ popped.exec( 2, function() {
+ ok( /display: inline;/.test( flickrdiv.innerHTML ), "Div contents are displayed" );
+ plus();
+ ok( /img/.test( flickrdiv.innerHTML ), "An image exists" );
+ plus();
+ });
+
+ popped.exec( 4, function() {
+ ok( /display: none;/.test( flickrdiv.innerHTML ), "Div contents are hidden again" );
+ plus();
+ });
popped.volume(0);
popped.play();
var popped = Popcorn("#video"),
expects = 7,
count = 0,
- interval,
- interval2,
- interval3,
footnotediv = document.getElementById('footnotediv');
expect(expects);
plus();
popped.footnote({
- start: 0, // seconds
- end: 5, // seconds
- text: 'This video made exclusively for drumbeat.org',
- target: 'footnotediv'
- } )
- .footnote({
- start: 7, // seconds
- end: 14, // seconds
- text: 'Visit webmademovies.org for more details',
- target: 'footnotediv'
- } )
- .volume(0)
- .play();
-
-
- interval = setInterval( function() {
- if( popped.currentTime() > 0 && popped.currentTime() <= 5 ) {
- equals ( footnotediv.childElementCount, 2, "footnotediv now has two inner elements" );
- plus();
- equals (footnotediv.children[0].innerHTML , "This video made exclusively for drumbeat.org", "footnote displaing correct information" );
- plus();
- equals (footnotediv.children[0].style.display , "inline", "footnote is visible on the page" );
- plus();
- clearInterval( interval );
- }
- }, 2000);
-
- interval2 = setInterval( function() {
- if( popped.currentTime() > 7 && popped.currentTime() < 14 ) {
- equals (footnotediv.children[1].style.display , "inline", "second footnote is visible on the page" );
- plus();
- clearInterval( interval2 );
- }
- }, 3000);
-
- interval3 = setInterval( function() {
- if( popped.currentTime() > 14) {
- ok (footnotediv.children[1].style.display === 'none' && footnotediv.children[0].style.display === 'none', "footnote are no longer vidible on the page" );
- plus();
- clearInterval( interval3 );
- }
- }, 15000);
+ start: 0, // seconds
+ end: 2, // seconds
+ text: 'This video made exclusively for drumbeat.org',
+ target: 'footnotediv'
+ } )
+ .footnote({
+ start: 2, // seconds
+ end: 4, // seconds
+ text: 'Visit webmademovies.org for more details',
+ target: 'footnotediv'
+ } )
+ .volume(0);
+
+ popped.exec( 1, function() {
+ equals ( footnotediv.childElementCount, 2, "footnotediv now has two inner elements" );
+ plus();
+ equals (footnotediv.children[0].innerHTML , "This video made exclusively for drumbeat.org", "footnote displaing correct information" );
+ plus();
+ equals (footnotediv.children[0].style.display , "inline", "footnote is visible on the page" );
+ plus();
+ });
+
+ popped.exec( 3, function() {
+ equals (footnotediv.children[1].style.display , "inline", "second footnote is visible on the page" );
+ plus();
+ });
+
+ popped.exec( 5, function() {
+ ok (footnotediv.children[1].style.display === 'none' && footnotediv.children[0].style.display === 'none', "footnote are no longer vidible on the page" );
+ plus();
+ });
+ popped.play();
});
var popped = Popcorn("#video"),
expects = 10,
- count = 0,
- mapInterval,
- mapInterval2,
- mapInterval3,
- mapInterval4;
+ count = 0;
expect(expects);
plus();
popped.googlemap({
- start: 0, // seconds
- end: 5, // seconds
- type: 'ROADMAP',
- target: 'map',
- lat: 43.665429,
- lng: -79.403323,
- zoom: 10
- } )
- .googlemap({
- start: 0, // seconds
- end: 5, // seconds
- type: 'SATELLITE',
- target: 'map2',
- location:'boston',
- zoom: 15
- } )
- .volume(0)
- .play();
-
-
- mapInterval = setInterval( function() {
- if( popped.currentTime() > 3 && popped.currentTime() <= 5 ) {
- ok(google.maps, "Google maps is available");
- plus();
- ok(google.maps.Geocoder, "Google maps Geocoder is available");
- plus();
- ok (document.getElementById('actualmap1'), "First map is on the page" );
- plus();
- equals (document.getElementById('actualmap1').offsetParent.id, "map", "First map is inside the 'map' div" );
- plus();
- clearInterval( mapInterval );
- }
- }, 1000);
- mapInterval2 = setInterval( function() {
- if( popped.currentTime() > 3 && popped.currentTime() <= 5 ) {
- ok (document.getElementById('actualmap2'), "Second map is on the page" );
- plus();
- equals (document.getElementById('actualmap2').offsetParent.id, "map2", "Second map is inside the 'map2' div" );
- plus();
- clearInterval( mapInterval2 );
- }
- }, 1000);
- mapInterval3 = setInterval( function() {
- if( popped.currentTime() > 5 ) {
- ok (document.getElementById('actualmap2').style.display === "none" &&
- document.getElementById('actualmap1').style.display === "none", "Both maps are no lnger visible" );
- plus();
- clearInterval( mapInterval3 );
- }
- }, 1000);
+ start: 0, // seconds
+ end: 5, // seconds
+ type: 'ROADMAP',
+ target: 'map',
+ lat: 43.665429,
+ lng: -79.403323,
+ zoom: 10
+ } )
+ .googlemap({
+ start: 0, // seconds
+ end: 5, // seconds
+ type: 'SATELLITE',
+ target: 'map2',
+ location:'boston',
+ zoom: 15
+ } )
+ .volume(0);
+
+ popped.exec( 4, function() {
+ ok(google.maps, "Google maps is available");
+ plus();
+ ok(google.maps.Geocoder, "Google maps Geocoder is available");
+ plus();
+ ok (document.getElementById('actualmap1'), "First map is on the page" );
+ plus();
+ equals (document.getElementById('actualmap1').offsetParent.id, "map", "First map is inside the 'map' div" );
+ plus();
+ });
+
+ popped.exec( 4, function() {
+ ok (document.getElementById('actualmap2'), "Second map is on the page" );
+ plus();
+ equals (document.getElementById('actualmap2').offsetParent.id, "map2", "Second map is inside the 'map2' div" );
+ plus();
+ });
+
+ popped.exec( 6, function() {
+ ok (document.getElementById('actualmap2').style.display === "none" &&
+ document.getElementById('actualmap1').style.display === "none", "Both maps are no lnger visible" );
+ plus();
+ });
+
+ popped.play();
});
var popped = Popcorn("#video"),
expects = 5,
count = 0,
- interval,
- interval2,
imagediv = document.getElementById('imagediv');
expect( expects );
target: 'imagediv'
} );
- interval = setInterval( function() {
- if( popped.currentTime() > 1 && popped.currentTime() < 3 ) {
- ok( /display: inline;/.test( imagediv.innerHTML ), "Div contents are displayed" );
- plus();
- ok( /img/.test( imagediv.innerHTML ), "An image exists" );
- plus();
- clearInterval( interval );
- }
- }, 500);
-
- interval2 = setInterval( function() {
- if( popped.currentTime() > 3 ) {
- ok( /display: none;/.test( imagediv.innerHTML ), "Div contents are hidden again" );
- plus();
- clearInterval( interval2 );
- }
- }, 500);
- popped.volume(0);
- popped.play();
+ popped.exec( 2, function() {
+ ok( /display: inline;/.test( imagediv.innerHTML ), "Div contents are displayed" );
+ plus();
+ ok( /img/.test( imagediv.innerHTML ), "An image exists" );
+ plus();
+ });
+
+ popped.exec( 4, function() {
+ ok( /display: none;/.test( imagediv.innerHTML ), "Div contents are hidden again" );
+ plus();
+ });
+ popped.volume(0).play();
});
var popped = Popcorn("#video"),
expects = 8,
count = 0,
- interval,
- interval2,
- interval3,
lastfmdiv = document.getElementById('lastfmdiv');
expect( expects );
plus();
popped.lastfm({
- start: 1, // seconds
- end: 4, // seconds
- artist: 'yacht',
- target: 'lastfmdiv',
- apikey: '30ac38340e8be75f9268727cb4526b3d'
- } )
- .lastfm({
- start: 2.5, // seconds
- end: 7, // seconds
- artist: 'the beatles',
- target: 'lastfmdiv',
- apikey: '30ac38340e8be75f9268727cb4526b3d'
- } )
- .lastfm({
- start: 4.5, // seconds
- end: 7, // seconds
- artist: '',
- target: 'lastfmdiv',
- apikey: '30ac38340e8be75f9268727cb4526b3d'
- } );
+ start: 1, // seconds
+ end: 4, // seconds
+ artist: 'yacht',
+ target: 'lastfmdiv',
+ apikey: '30ac38340e8be75f9268727cb4526b3d'
+ })
+ .lastfm({
+ start: 2, // seconds
+ end: 7, // seconds
+ artist: 'the beatles',
+ target: 'lastfmdiv',
+ apikey: '30ac38340e8be75f9268727cb4526b3d'
+ })
+ .lastfm({
+ start: 4, // seconds
+ end: 7, // seconds
+ artist: '',
+ target: 'lastfmdiv',
+ apikey: '30ac38340e8be75f9268727cb4526b3d'
+ });
- interval = setInterval( function() {
- if( popped.currentTime() > 1 && popped.currentTime() < 4 ) {
-
- equals ( lastfmdiv.childElementCount, 3, "lastfmdiv now has three inner elements" );
- plus();
- equals (lastfmdiv.children[0].style.display , "inline", "yachtdiv is visible on the page" );
- plus();
- clearInterval( interval );
- }
- }, 1000);
-
- interval2 = setInterval( function() {
- if( popped.currentTime() > 2.5 && popped.currentTime() < 3 ) {
- equals (lastfmdiv.children[0].style.display , "inline", "yachtdiv is visible on the page" );
- plus();
- equals (lastfmdiv.children[1].style.display , "inline", "beatlesdiv is visible on the page" );
- plus();
- equals (lastfmdiv.children[2].style.display , "none", "nulldiv is not visible on the page" );
- plus();
- clearInterval( interval2 );
- }
- }, 1000);
-
- interval3 = setInterval( function() {
- if( popped.currentTime() > 4.5 && popped.currentTime() < 7 ) {
- equals (lastfmdiv.children[2].innerHTML , "Unknown Artist", "Artist information could not be found" );
- plus();
- clearInterval( interval3 );
- }
- }, 1000);
+ popped.exec( 2, function() {
+ equals ( lastfmdiv.childElementCount, 3, "lastfmdiv now has three inner elements" );
+ plus();
+ equals (lastfmdiv.children[0].style.display , "inline", "yachtdiv is visible on the page" );
+ plus();
+ });
+
+ popped.exec( 3, function() {
+ equals (lastfmdiv.children[0].style.display , "inline", "yachtdiv is still visible on the page" );
+ plus();
+ equals (lastfmdiv.children[1].style.display , "inline", "beatlesdiv is visible on the page" );
+ plus();
+ equals (lastfmdiv.children[2].style.display , "none", "nulldiv is not visible on the page" );
+ plus();
+ });
+
+ popped.exec( 5, function() {
+ equals (lastfmdiv.children[2].innerHTML , "Unknown Artist", "Artist information could not be found" );
+ plus();
+ });
- popped.volume(0);
- popped.play();
+ popped.volume(0).play();
});
var popped = Popcorn( "#video" ),
expects = 8,
count = 0,
- interval,
- interval2,
- interval3,
tagdiv = document.getElementById( 'tagdiv' );
tagdiv2 = document.getElementById( 'tagdiv2' );
stop();
- ok ( 'tagthisperson' in popped, "tagthisperson is a method of the popped instance" );
+ ok( 'tagthisperson' in popped, "tagthisperson is a method of the popped instance" );
plus();
- equals ( tagdiv.innerHTML, "", "initially, there is nothing inside the tagdiv" );
+ equals( tagdiv.innerHTML, "", "initially, there is nothing inside the tagdiv" );
plus();
popped.tagthisperson({
- start: 0, // seconds
- end: 5, // seconds
- person: 'Anna Sob',
- image: 'http://newshour.s3.amazonaws.com/photos%2Fspeeches%2Fguests%2FRichardNSmith_thumbnail.jpg',
- href: 'http://annasob.wordpress.com',
- target: 'tagdiv'
- } )
- .tagthisperson({
- start: 3, // seconds
- end: 10, // seconds
- person: 'Scott',
- href: 'http://scottdowne.wordpress.com/',
- target: 'tagdiv'
- } )
- .tagthisperson({
- start: 6, // seconds
- end: 10, // seconds
- person: 'Mike',
- target: 'tagdiv2'
- } )
- .tagthisperson({
- start: 7, // seconds
- end: 12, // seconds
- person: 'Daniel',
- target: 'tagdiv2'
- } )
- .volume(0)
- .play();
-
-
- interval = setInterval( function() {
- if( popped.currentTime() > 0 && popped.currentTime() <= 5 ) {
- equals ( tagdiv.childElementCount, 2, "tagdiv now contains two child elements" );
- plus();
- equals ( tagdiv.textContent.trim() , "Anna Sob" ,"tagdiv shows the first tag" );
- plus();
- clearInterval( interval );
- }
- }, 2000);
-
- interval2 = setInterval( function() {
- if( popped.currentTime() > 5 ) {
- equals ( tagdiv.innerHTML.search( "<a href" ) , 1 ,"second tag in tagdiv has a url" );
- plus();
- equals ( tagdiv2.textContent.trim(), "Mike, Daniel" ,"tagdiv2 shows the first & second tag" );
- plus();
- clearInterval( interval2 );
- }
- }, 4000);
-
- interval3 = setInterval( function() {
- if( popped.currentTime() > 12 ) {
- equals ( tagdiv.innerHTML , "" ,"tagdiv is now cleared" );
- plus();
- equals ( tagdiv2.innerHTML , "" ,"tagdiv2 is now cleared" );
- plus();
- clearInterval( interval3 );
- }
- }, 4000);
+ start: 0, // seconds
+ end: 1, // seconds
+ person: 'Anna Sob',
+ image: 'http://newshour.s3.amazonaws.com/photos%2Fspeeches%2Fguests%2FRichardNSmith_thumbnail.jpg',
+ href: 'http://annasob.wordpress.com',
+ target: 'tagdiv'
+ })
+ .tagthisperson({
+ start: 1, // seconds
+ end: 2, // seconds
+ person: 'Scott',
+ href: 'http://scottdowne.wordpress.com/',
+ target: 'tagdiv'
+ })
+ .tagthisperson({
+ start: 1, // seconds
+ end: 2, // seconds
+ person: 'Mike',
+ target: 'tagdiv2'
+ })
+ .tagthisperson({
+ start: 1, // seconds
+ end: 2, // seconds
+ person: 'Daniel',
+ target: 'tagdiv2'
+ })
+ .volume(0);
+
+ popped.exec( 0, function() {
+ equals( tagdiv.childElementCount, 2, "tagdiv now contains two child elements" );
+ plus();
+ equals( tagdiv.textContent.trim() , "Anna Sob" ,"tagdiv shows the first tag" );
+ plus();
+ });
+
+ popped.exec( 1, function() {
+ equals( tagdiv.innerHTML.search( "<a href" ) , 1 ,"second tag in tagdiv has a url" );
+ plus();
+ equals( tagdiv2.textContent.trim(), "Mike, Daniel" ,"tagdiv2 shows the first & second tag" );
+ plus();
+ });
+
+ popped.exec( 2, function() {
+ equals( tagdiv.innerHTML , "" ,"tagdiv is now cleared" );
+ plus();
+ equals( tagdiv2.innerHTML , "" ,"tagdiv2 is now cleared" );
+ plus();
+ });
+
+ popped.play();
});
var popped = Popcorn("#video"),
expects = 6,
count = 0,
- interval,
- interval2,
twitterdiv = document.getElementById('twitterdiv');
expect( expects );
popped.twitter({
start: 1, // seconds
- end: 3, // seconds
+ end: 2, // seconds
title: 'Steve Song',
src: '@stevesong',
target: 'twitterdiv',
} );
- interval = setInterval( function() {
- if( popped.currentTime() > 1 && popped.currentTime() < 3 ) {
- ok( /display: inline;/.test( twitterdiv.innerHTML ), "Div contents are displayed" );
- plus();
- ok( /twtr-widget/.test( twitterdiv.innerHTML ), "A Twitter widget exists" );
- plus();
- clearInterval( interval );
- }
- }, 500);
-
- interval2 = setInterval( function() {
- if( popped.currentTime() > 3 ) {
- ok( /display: none;/.test( twitterdiv.innerHTML ), "Div contents are hidden again" );
- plus();
- clearInterval( interval2 );
- }
- }, 500);
+ popped.exec( 1, function() {
+ ok( /display: inline;/.test( twitterdiv.innerHTML ), "Div contents are displayed" );
+ plus();
+ ok( /twtr-widget/.test( twitterdiv.innerHTML ), "A Twitter widget exists" );
+ plus();
+ });
+
+ popped.exec( 2, function() {
+ ok( /display: none;/.test( twitterdiv.innerHTML ), "Div contents are hidden again" );
+ plus();
+ });
popped.play();
var popped = Popcorn("#video"),
expects = 10,
count = 0,
- iframeInterval,
- iframeInterval2,
- iframeInterval3,
- iframeInterval4;
theiFrame = document.getElementsByTagName('iframe');
+
expect(expects);
function plus() {
plus();
popped.webpage({
- id: "webpages-a",
- start: 0, // seconds
- end: 5, // seconds
- src: 'http://webmademovies.org',
- target: 'webpagediv'
- })
- .webpage({
- id: "webpages-b",
- start: 7, // seconds
- end: 10, // seconds
- src: 'http://zenit.senecac.on.ca/wiki/index.php/Processing.js',
- target: 'webpagediv'
- })
- .volume(0)
- .play();
-
-
- iframeInterval = setInterval( function() {
- if( popped.currentTime() > 1 && popped.currentTime() <= 5 ) {
- ok (!!theiFrame[0], "iframe was created" );
- plus();
- equals (theiFrame.length, 2, "there is only two iframes on the page" );
- plus();
- equals (theiFrame[0].id, "webpages-a", "the first iframe has the id 'webpages-a'" );
- plus();
- equals (theiFrame[0].src, "http://webmademovies.org/", "iframe has the src 'http://webmademovies.org/'" );
- plus();
- clearInterval( iframeInterval );
- }
- }, 5000);
-
- iframeInterval2 = setInterval( function() {
- if( popped.currentTime() > 10 ) {
- ok (theiFrame[0].style.display === 'none' && theiFrame[1].style.display === 'none', "both iframes are hidden" );
- plus();
- clearInterval( iframeInterval2 );
- }
- }, 15000);
-
- iframeInterval3 = setInterval( function() {
- if( popped.currentTime() > 8 && popped.currentTime() <= 10 ) {
- ok (!!theiFrame[1], "iframe was created" );
- plus();
- equals (theiFrame[1].id, "webpages-b", "iframe second has the id 'webpages-b'" );
- plus();
- equals (theiFrame[1].src,"http://zenit.senecac.on.ca/wiki/index.php/Processing.js", "iframe has the src 'http://zenit.senecac.on.ca/wiki/index.php/Processing.js'" );
- plus();
- clearInterval( iframeInterval3 );
- }
- }, 5000);
-
+ id: "webpages-a",
+ start: 0, // seconds
+ end: 1, // seconds
+ src: 'http://webmademovies.org',
+ target: 'webpagediv'
+ })
+ .webpage({
+ id: "webpages-b",
+ start: 1, // seconds
+ end: 2, // seconds
+ src: 'http://zenit.senecac.on.ca/wiki/index.php/Processing.js',
+ target: 'webpagediv'
+ })
+ .volume(0);
+
+ popped.exec( 0, function() {
+ ok (!!theiFrame[0], "iframe was created" );
+ plus();
+ equals (theiFrame.length, 2, "there is only two iframes on the page" );
+ plus();
+ equals (theiFrame[0].id, "webpages-a", "the first iframe has the id 'webpages-a'" );
+ plus();
+ equals (theiFrame[0].src, "http://webmademovies.org/", "iframe has the src 'http://webmademovies.org/'" );
+ plus();
+ });
+
+ popped.exec( 2, function() {
+ ok (theiFrame[0].style.display === 'none' && theiFrame[1].style.display === 'none', "both iframes are hidden" );
+ plus();
+ });
+
+ popped.exec( 1, function() {
+ ok (!!theiFrame[1], "iframe was created" );
+ plus();
+ equals (theiFrame[1].id, "webpages-b", "iframe second has the id 'webpages-b'" );
+ plus();
+ equals (theiFrame[1].src,"http://zenit.senecac.on.ca/wiki/index.php/Processing.js", "iframe has the src 'http://zenit.senecac.on.ca/wiki/index.php/Processing.js'" );
+ plus();
+ });
+
+ popped.play();
+
});