<script src="../../popcorn.js"></script>
<script src="popcorn.attribution.js"></script>
<script>
- document.addEventListener("DOMContentLoaded", function () {
- var p = Popcorn("#video")
+ document.addEventListener( "DOMContentLoaded", function () {
+ var p = Popcorn( "#video" )
.play()
- .volume(0)
+ .volume( 0 )
.attribution({
- start: 0, // seconds
- end: 10, // seconds
+ start: 0,
+ end: 10,
nameofwork: "A Shared Culture",
copyrightholder:"Jesse Dylan",
license: "CC-BY-N6",
target: "attribdiv"
})
.attribution({
- start: 5, // seconds
- end: 15, // seconds
+ start: 5,
+ end: 15,
nameofwork: "Internet",
nameofworkurl:"http://www.archive.org/details/CC1232_internet",
copyrightholder:"The Computer Chronicles",
<source id="mp4"
src="../../test/trailer.mp4"
- type="viden/mp4; codecs='avc1, mp4a'">
+ type='viden/mp4; codecs="avc1, mp4a"'>
<source id="ogv"
src="../../test/trailer.ogv"
- type="video/ogg; codecs='theora, vorbis'">
+ type='video/ogg; codecs="theora, vorbis"'>
<p>Your user agent does not support the HTML5 Video element.</p>
<source id="mp4"
src="../../test/trailer.mp4"
- type="video/mp4; codecs='avc1, mp4a'">
+ type='video/mp4; codecs="avc1, mp4a"'>
<source id="ogv"
src="../../test/trailer.ogv"
- type="video/ogg; codecs='theora, vorbis'">
+ type='video/ogg; codecs="theora, vorbis"'>
<p>Your user agent does not support the HTML5 Video element.</p>
<script>
var output;
- document.addEventListener('DOMContentLoaded', function () {
- output = document.getElementById('output');
+ document.addEventListener( "DOMContentLoaded", function () {
+ output = document.getElementById( "output" );
var $ = function( id ) {
return document.getElementById( id.substring( 1 ) );
};
- var p = Popcorn('#video')
+ var p = Popcorn( "#video" )
.code({
start: 1,
end: 3,
onStart: function( options ) {
- $('#test1').innerHTML = 'Yes';
+ $( "#test1" ).innerHTML = "Yes";
}
})
start: 5,
end: 8,
onStart: function( options ) {
- $('#test2a').innerHTML = 'Yes';
+ $( "#test2a" ).innerHTML = "Yes";
},
onEnd: function ( options ) {
- $('#test2b').innerHTML = 'Yes';
+ $( "#test2b" ).innerHTML = "Yes";
}
})
start: 10,
end: 14,
onStart: function( options ) {
- $('#test3a').innerHTML = 'Yes';
+ $( "#test3a" ).innerHTML = "Yes";
},
onFrame: (function() {
var count = 0;
return function ( options ) {
- $('#test3b').innerHTML = 'Yes (count = ' + ++count + ')';
+ $( "#test3b" ).innerHTML = "Yes (count = " + ++count + ")";
}
})(),
onEnd: function ( options ) {
- $('#test3c').innerHTML = 'Yes';
+ $( "#test3c" ).innerHTML = "Yes";
}
})
- .volume(0)
+ .volume( 0 )
.play();
}, false);
</script>
<h1 id="qunit-header">Popcorn Code Plugin Demo</h1>
<p>Arbitrary JavaScript functions are run.</p>
<div>
- <video id='video'
+ <video id="video"
autobuffer
preload="auto"
controls
- width= '250px'
+ width= "250px"
poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
type='video/ogg; codecs="theora, vorbis"'>
// PLUGIN: Code
-(function (Popcorn) {
+(function ( Popcorn ) {
/**
* Code Popcorn Plug-in
*
*/
- Popcorn.plugin( 'code' , function(options) {
+ Popcorn.plugin( "code" , function( options ) {
var running = false;
-
+
// Setup a proper frame interval function (60fps), favouring paint events.
- var step = ( function() {
-
+ var step = (function() {
+
var buildFrameRunner = function( runner ) {
return function( f, options ) {
-
+
var _f = function() {
f();
if ( running ) {
runner( _f );
}
};
-
+
_f();
};
};
-
+
// Figure out which level of browser support we have for this
if ( window.webkitRequestAnimationFrame ) {
return buildFrameRunner( window.webkitRequestAnimationFrame );
} else {
return buildFrameRunner( function( f ) {
window.setTimeout( f, 16 );
- } );
+ });
}
-
- } )();
- if ( !options.onStart || typeof options.onStart !== 'function' ) {
+ })();
+
+ if ( !options.onStart || typeof options.onStart !== "function" ) {
if ( Popcorn.plugin.debug ) {
- throw new Error( 'Popcorn Code Plugin Error: onStart must be a function.' );
+ throw new Error( "Popcorn Code Plugin Error: onStart must be a function." );
}
options.onStart = Popcorn.nop;
}
- if ( options.onEnd && typeof options.onEnd !== 'function' ) {
+ if ( options.onEnd && typeof options.onEnd !== "function" ) {
if ( Popcorn.plugin.debug ) {
- throw new Error( 'Popcorn Code Plugin Error: onEnd must be a function.' );
+ throw new Error( "Popcorn Code Plugin Error: onEnd must be a function." );
}
options.onEnd = undefined;
}
- if ( options.onFrame && typeof options.onFrame !== 'function' ) {
+ if ( options.onFrame && typeof options.onFrame !== "function" ) {
if ( Popcorn.plugin.debug ) {
- throw new Error( 'Popcorn Code Plugin Error: onFrame must be a function.' );
+ throw new Error( "Popcorn Code Plugin Error: onFrame must be a function." );
}
options.onFrame = undefined;
}
}
}
};
- },
- {
+ },
+ {
about: {
- name: 'Popcorn Code Plugin',
- version: '0.1',
- author: 'David Humphrey (@humphd)',
- website: 'http://vocamus.net/dave'
+ name: "Popcorn Code Plugin",
+ version: "0.1",
+ author: "David Humphrey (@humphd)",
+ website: "http://vocamus.net/dave"
},
options: {
- start: {elem:'input', type:'text', label:'In'},
- end: {elem:'input', type:'text', label:'Out'},
- onStart: {elem:'input', type:'function', label:'onStart'},
- onFrame: {elem:'input', type:'function', label:'onFrame'},
- onEnd: {elem:'input', type:'function', label:'onEnd'}
+ start: {
+ elem: "input",
+ type: "text",
+ label: "In"
+ },
+ end: {
+ elem: "input",
+ type: "text",
+ label: "Out"
+ },
+ onStart: {
+ elem: "input",
+ type: "function",
+ label: "onStart"
+ },
+ onFrame: {
+ elem: "input",
+ type: "function",
+ label: "onFrame"
+ },
+ onEnd: {
+ elem: "input",
+ type: "function",
+ label: "onEnd"
+ }
}
});
})( Popcorn );
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"> </div>
- <video id='video'
+ <video id="video"
autobuffer
preload="auto"
controls
- width= '250px'
+ width= "250px"
poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
type='video/ogg; codecs="theora, vorbis"'>
-test('Popcorn Code Plugin', function () {
+test( "Popcorn Code Plugin", function () {
- var popped = Popcorn('#video'),
+ var popped = Popcorn( "#video" ),
expects = 9,
count = 0,
frames = 0,
- codeDiv = document.getElementById('code-div');
+ codeDiv = document.getElementById( "code-div" );
expect( expects );
stop();
- ok('code' in popped, 'code is a method of the popped instance');
+ ok( "code" in popped, "code is a method of the popped instance" );
plus();
- equals ( codeDiv.innerHTML, '', 'initially, there is nothing inside the code-div' );
+ equals ( codeDiv.innerHTML, "", "initially, there is nothing inside the code-div" );
plus();
popped.code({
start: 0,
end: 2,
onStart: function( options ) {
- codeDiv.innerHTML = 'Test 1 - onStart (no onEnd)';
- ok(true, 'Test 1 onStart was run.');
+ codeDiv.innerHTML = "Test 1 - onStart (no onEnd)";
+ ok( true, "Test 1 onStart was run." );
plus();
}
});
start: 2,
end: 4,
onStart: function( options ) {
- codeDiv.innerHTML = 'Test 2 - onStart';
- ok(true, 'Test 2 onStart was run.');
+ codeDiv.innerHTML = "Test 2 - onStart";
+ ok( true, "Test 2 onStart was run." );
plus();
},
onEnd: function ( options ) {
- codeDiv.innerHTML = 'Test 2 - onEnd';
- ok(true, 'Test 2 onEnd was run.');
+ codeDiv.innerHTML = "Test 2 - onEnd";
+ ok( true, "Test 2 onEnd was run." );
plus();
}
});
start: 4,
end: 6,
onStart: function( options ) {
- codeDiv.innerHTML = 'Test 3 - onStart [Frames: ';
- ok(true, 'Test 3 onStart was run.');
+ codeDiv.innerHTML = "Test 3 - onStart [Frames: ";
+ ok( true, "Test 3 onStart was run." );
plus();
},
onFrame: function ( options ) {
- codeDiv.innerHTML += '.';
+ codeDiv.innerHTML += ".";
frames++;
},
onEnd: function ( options ) {
- codeDiv.innerHTML += '] Test 3 - onEnd';
- ok(true, 'Test 3 onEnd was run.');
+ codeDiv.innerHTML += "] Test 3 - onEnd";
+ ok( true, "Test 3 onEnd was run." );
plus();
- ok(frames > 1, 'Test 3 onFrames was run.');
+ ok( frames > 1, "Test 3 onFrames was run." );
plus();
popped.pause();
}
try {
popped.code({});
} catch( e ) {
- ok(true, 'empty event was caught by debug');
+ ok( true, "empty event was caught by debug" );
plus();
}
- popped.volume(0);
+ popped.volume( 0 );
popped.play();
});
<html>
<head>
<title>Popcorn Facebook Plug-in Demo</title>
-
+
<script src="../../popcorn.js"></script>
<script src="popcorn.facebook.js"></script>
<script>
- document.addEventListener('DOMContentLoaded', function () {
- var p = Popcorn('#video')
- .volume(0)
+ document.addEventListener( "DOMContentLoaded", function () {
+ var p = Popcorn( "#video" )
+ .volume( 0 )
.play()
.facebook({
- type : "live-stream",
- target : "activitydiv",
- start : 1,
- end : 10,
- event_app_id: 174243249296725 // id is from example http://developers.facebook.com/docs/reference/plugins/live-stream/
- } )
+ type: "live-stream",
+ target: "activitydiv",
+ start: 1,
+ end: 10,
+ // id is from example http://developers.facebook.com/docs/reference/plugins/live-stream/
+ event_app_id: 174243249296725
+ })
.facebook({
- type : "LIKE",
+ type: "LIKE",
target: "likediv",
layout: "box_count",
- start : 5,
- end : 10
- } )
+ start: 5,
+ end: 10
+ })
.facebook({
- type : "send",
- target : "likediv",
- start : 1,
- end : 5
- } )
+ type: "send",
+ target: "likediv",
+ start: 1,
+ end: 5
+ })
.facebook({
- href : "http://www.facebook.com/senecacollege",
- type : "LIKE-BOX",
- show_faces : "true",
+ href: "http://www.facebook.com/senecacollege",
+ type: "LIKE-BOX",
+ show_faces: "true",
header: "false",
target: "likeboxdiv",
- start : 6,
- end : 10
- } )
+ start: 6,
+ end: 10
+ })
.facebook({
- site : "http://popcornjs.org/",
- type : "ACTIVITY",
+ site: "http://popcornjs.org/",
+ type: "ACTIVITY",
target: "activitydiv",
header: true,
- start : 11,
- end : 15
- } )
+ start: 11,
+ end: 15
+ })
.facebook({
- href : "http://www.facebook.com/senecacollege",
- type : "FACEPILE",
+ href: "http://www.facebook.com/senecacollege",
+ type: "FACEPILE",
target: "facepilediv",
- width : 300,
- start : 10,
- end : 15
- } );
+ width: 300,
+ start: 10,
+ end: 15
+ });
}, false);
</script>
<p>"Like" plugin directly below video. href is the page it's on. "Like box" is below "like". href is set to Seneca College's Facebook page<br/>
"Facepile" is to the right of the video (must be logged into facebook). href is also set to Seneca College's Facebook page. <br/>
"Activity feed" is below "Facepile". href is set to popcornjs.org.</p>
-
+
<div>
- <video id='video'
- controls preload='none'
- width= '350px'
- poster="../../test/poster.png">
+ <video id="video"
+ controls preload="none"
+ width= "350px"
+ poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
- type='video/mp4; codecs="avc1, mp4a"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
+ </video>
</div>
<div>
<div id="likediv"></div>
(function(Popcorn, global ) {
/**
- * Facebook Popcorn plug-in
+ * Facebook Popcorn plug-in
* Places Facebook's "social plugins" inside a div ( http://developers.facebook.com/docs/plugins/ )
* Sets options according to user input or default values
* Options parameter will need a target, type, start and end time
* Xid - unique identifier if more than one live-streams are on one page
*
* @param {Object} options
- *
+ *
* Example:
var p = Popcorn('#video')
.facebook({
}
Popcorn.plugin( "facebook" , {
- manifest:{
- about:{
- name : "Popcorn Facebook Plugin",
+ manifest: {
+ about: {
+ name: "Popcorn Facebook Plugin",
version: "0.1",
- author : "Dan Ventura",
+ author: "Dan Ventura",
website: "dsventura.blogspot.com"
},
- options:{
- type : {elem:"select", options:["LIKE", "LIKE-BOX", "ACTIVITY", "FACEPILE", "LIVE-STREAM", "SEND"], label:"Type"},
- target : "facebook-container",
- start : {elem:'input', type:'number', label:'In'},
- end : {elem:'input', type:'number', label:'Out'},
+ options: {
+ type: {
+ elem: "select",
+ options: [ "LIKE", "LIKE-BOX", "ACTIVITY", "FACEPILE", "LIVE-STREAM", "SEND" ],
+ label: "Type"
+ },
+ target: "facebook-container",
+ start: {
+ elem: "input",
+ type: "number",
+ label: "In"
+ },
+ end: {
+ elem: "input",
+ type: "number",
+ label: "Out"
+ },
// optional parameters:
- font : {elem:"input", type:"text", label:"font"},
- xid : {elem:"input", type:"text", label:"Xid"},
- href : {elem:"input", type:"text", label:"Href"},
- site : {elem:"input", type:"text", label:"Site"},
- height : {elem:"input", type:"text", label:"Height"},
- width : {elem:"input", type:"text", label:"Width"},
- action : {elem:"select", options:["like", "recommend"], label:"Action"},
- stream : {elem:"select", options:["false", "true"], label:"Stream"},
- header : {elem:"select", options:["false", "true"], label:"Header"},
- layout : {elem:"select", options:["standard", "button_count", "box_count"], label:"Layout"},
- max_rows : {elem:"input", type:"text", label:"Max_rows"},
- border_color : {elem:"input", type:"text", label:"Border_color"},
- event_app_id : {elem:"input", type:"text", label:"Event_app_id"},
- colorscheme : {elem:"select", options:["light", "dark"], label:"Colorscheme"},
- show_faces : {elem:"select", options:["false", "true"], label:"Showfaces"},
- recommendations : {elem:"select", options:["false", "true"], label:"Recommendations"},
- always_post_to_friends : {elem:"input", options:["false", "true"], label:"Always_post_to_friends"}
+ font: {
+ elem: "input",
+ type: "text",
+ label: "font"
+ },
+ xid: {
+ elem: "input",
+ type: "text",
+ label: "Xid"
+ },
+ href: {
+ elem: "input",
+ type: "text",
+ label: "Href"
+ },
+ site: {
+ elem: "input",
+ type: "text",
+ label:"Site"
+ },
+ height: {
+ elem: "input",
+ type: "text",
+ label: "Height"
+ },
+ width: {
+ elem: "input",
+ type: "text",
+ label: "Width"
+ },
+ action: {
+ elem: "select",
+ options: [ "like", "recommend" ],
+ label: "Action"
+ },
+ stream: {
+ elem: "select",
+ options: [ "false", "true" ],
+ label: "Stream"
+ },
+ header: {
+ elem: "select",
+ options: [ "false", "true" ],
+ label: "Header"
+ },
+ layout: {
+ elem: "select",
+ options: [ "standard", "button_count", "box_count" ],
+ label: "Layout"
+ },
+ max_rows: {
+ elem: "input",
+ type: "text",
+ label: "Max_rows"
+ },
+ border_color: {
+ elem: "input",
+ type: "text",
+ label: "Border_color"
+ },
+ event_app_id: {
+ elem: "input",
+ type: "text",
+ label: "Event_app_id"
+ },
+ colorscheme: {
+ elem: "select",
+ options: [ "light", "dark" ],
+ label: "Colorscheme"
+ },
+ show_faces: {
+ elem: "select",
+ options: [ "false", "true" ],
+ label: "Showfaces"
+ },
+ recommendations: {
+ elem: "select",
+ options: [ "false", "true" ],
+ label: "Recommendations"
+ },
+ always_post_to_friends: {
+ elem: "input",
+ options: [ "false", "true" ],
+ label: "Always_post_to_friends"
+ }
}
},
-
+
_setup: function( options ) {
var target = document.getElementById( options.target );
fbRoot.setAttribute( "id", "fb-root" );
document.body.appendChild( fbRoot );
}
-
+
if ( !ranOnce || options.event_app_id ) {
ranOnce = true;
// initialize facebook JS SDK
- Popcorn.getScript("http://connect.facebook.net/en_US/all.js");
+ Popcorn.getScript( "http://connect.facebook.net/en_US/all.js" );
global.fbAsyncInit = function() {
FB.init({
- appId : ( options.event_app_id || "" ),
- status : true,
- cookie : true,
- xfbml : true
+ appId: ( options.event_app_id || "" ),
+ status: true,
+ cookie: true,
+ xfbml: true
});
};
}
options._container = document.createElement( "fb:" + options.type );
-
var setOptions = (function( options ) {
options._container.style.display = "none";
});
})( Popcorn, this );
-
<title>Popcorn Facebook Plug-in Test</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
+ <!--
+ do not move - this must be called immediately prior to
popcorn-api-draft.js
-->
-
<script src="../../popcorn.js"></script>
-
<script src="popcorn.facebook.js"></script>
<script src="popcorn.facebook.unit.js"></script>
</head>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"> </div>
-
+
<div style="position:absolute;left:300px;">
<div id="facepilediv"></div>
<div id="activitydiv"></div>
</div>
- <video id='video'
- controls preload='none'
- width= '250px'
- poster="../../test/poster.png">
+ <video id="video"
+ controls preload="none"
+ width= "250px"
+ poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
- type='video/mp4; codecs="avc1, mp4a"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
+ <p>Your user agent does not support the HTML5 Video element.</p>
+ </video>
<div>
<div id="likediv"></div>
<div id="likeboxdiv"></div>
</div>
</body>
</html>
-
-test("Popcorn Facebook Plugin", function () {
-
- var popped = Popcorn("#video"),
+test( "Popcorn Facebook Plugin", function () {
+
+ var popped = Popcorn( "#video" ),
expects = 9,
count = 0,
interval,
interval3,
interval4,
subtitlediv;
-
- expect(expects);
-
+
+ expect( expects );
+
function plus() {
- if ( ++count===expects) {
+ if ( ++count===expects ) {
start();
}
}
-
+
stop();
-
- ok ('facebook' in popped, "facebook is a method of the popped instance");
+
+ ok ( "facebook" in popped, "facebook is a method of the popped instance" );
plus();
popped.facebook({
target: "likediv",
- start : 1,
- end : 6
- } )
+ start: 1,
+ end: 6
+ })
.facebook({
- href : "http://www.facebook.com/senecacollege",
- type : "LIKE_BOX",
+ href: "http://www.facebook.com/senecacollege",
+ type: "LIKE_BOX",
target: "likeboxdiv",
- start : 2,
- end : 6
- } )
+ start: 2,
+ end: 6
+ })
.facebook({
- site : "http://popcornjs.org/",
- type : "ACTIVITY",
- target : "activitydiv",
- start : 3,
- end : 6
- } )
+ site: "http://popcornjs.org/",
+ type: "ACTIVITY",
+ target: "activitydiv",
+ start: 3,
+ end: 6
+ })
.facebook({
- href : "http://www.facebook.com/senecacollege",
- type : "FACEPILE",
- target : "facepilediv",
- start : 4,
- end : 6,
- width : 300
- } )
- .volume(0)
+ href: "http://www.facebook.com/senecacollege",
+ type: "FACEPILE",
+ target: "facepilediv",
+ start: 4,
+ end: 6,
+ width: 300
+ })
+ .volume( 0 )
.play();
-
- ok (document.getElementById('likediv'), "likediv exists on the page" );
+
+ ok ( document.getElementById( "likediv" ), "likediv exists on the page" );
plus();
- ok (document.getElementById('likeboxdiv'), "likeboxdiv exists on the page" );
+ ok ( document.getElementById( "likeboxdiv" ), "likeboxdiv exists on the page" );
plus();
- ok (document.getElementById('activitydiv'), "activitydiv exists on the page" );
+ ok ( document.getElementById( "activitydiv" ), "activitydiv exists on the page" );
plus();
- ok (document.getElementById('facepilediv'), "facepilediv exists on the page" );
+ ok ( document.getElementById( "facepilediv" ), "facepilediv exists on the page" );
plus();
-
+
// I inspected the html genterated by facebook, and found that there are no uniquely identifying attributes between plug-in types
// so right now, we just check ot make sure that facebook is returning a plugin and displaying it at the correct time.
-
+
popped.exec( 2, function() {
ok ( document.getElementById( "likediv" ).innerHTML, "likediv is not empty at 0:02 (expected)" );
plus();
});
-
+
popped.exec( 3, function() {
ok ( document.getElementById( "likeboxdiv" ).innerHTML, "likeboxdiv is not empty at 0:03 (expected)" );
plus();
});
-
+
popped.exec( 4, function() {
ok ( document.getElementById( "activitydiv" ).innerHTML, "Activitydiv is not empty at 0:04 (expected)" );
plus();
});
-
+
popped.exec( 5, function() {
ok ( document.getElementById( "facepilediv" ).innerHTML, "Facepilediv is not empty at 0:05 (expected)" );
plus();
});
});
-
<source id="mp4"
src="../../test/trailer.mp4"
- type="video/mp4; codecs='avc1, mp4a'">
+ type='video/mp4; codecs="avc1, mp4a"'>
<source id="ogv"
src="../../test/trailer.ogv"
- type="video/ogg; codecs='theora, vorbis'">
+ type='video/ogg; codecs="theora, vorbis"'>
<p>Your user agent does not support the HTML5 Video element.</p>
<source id="mp4"
src="../../test/trailer.mp4"
- type="video/mp4; codecs='avc1, mp4a'">
+ type='video/mp4; codecs="avc1, mp4a"'>
<source id="ogv"
src="../../test/trailer.ogv"
- type="video/ogg; codecs='theora, vorbis'">
+ type='video/ogg; codecs="theora, vorbis"'>
<p>Your user agent does not support the HTML5 Video element.</p>
<html>
<head>
<title>Popcorn footnote Plug-in Demo</title>
-
+
<script src="../../popcorn.js"></script>
<script src="popcorn.footnote.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
- var p = Popcorn('#video')
- .play()
+ var p = Popcorn( "#video" )
+ .play()
.footnote({
- start: 5, // seconds
- end: 15, // seconds
- text: 'This video made exclusively for drumbeat.org',
- target: 'footnotediv'
- } )
+ start: 5,
+ end: 15,
+ text: "This video made exclusively for drumbeat.org",
+ target: "footnotediv"
+ })
.footnote({
- start: 20, // seconds
- end: 45, // seconds
- text: 'Visit webmademovies.org for more details',
- target: 'footnotediv'
- } )
+ start: 20,
+ end: 45,
+ text: "Visit webmademovies.org for more details",
+ target: "footnotediv"
+ })
}, false);
<p> A footnote displaying This video made exclusively for drumbeat.org' will appear at 5 seconds and disappear at 15 seconds.</p>
<p> A footnote displaying 'Visit webmademovies.org for more details' will appear at 20 seconds and disappear at 45 seconds.</p>
<div>
- <video id='video'
- controls preload='none'
- width= '250px'
- poster="../../test/poster.png">
+ <video id="video"
+ controls preload="none"
+ width="250px"
+ poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
- type='video/mp4; codecs="avc1, mp4a"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
+ </video>
</div>
<div id="footnotediv" width="50%" height="50%">
</div>
// PLUGIN: Footnote/Text
-(function (Popcorn) {
+(function ( Popcorn ) {
/**
* Footnote popcorn plug-in
website: "annasob.wordpress.com"
},
options: {
- start: { elem: "input", type: "text", label: "In" },
- end: { elem: "input", type: "text", label: "Out" },
- text: { elem: "input", type: "text", label: "Text" },
+ start: {
+ elem: "input",
+ type: "text",
+ label: "In"
+ },
+ end: {
+ elem: "input",
+ type: "text",
+ label: "Out"
+ },
+ text: {
+ elem: "input",
+ type: "text",
+ label: "Text"
+ },
target: name + "-container"
}
},
- _setup: function(options) {
+ _setup: function( options ) {
var target = document.getElementById( options.target );
- options._container = document.createElement( 'div' );
+ options._container = document.createElement( "div" );
options._container.style.display = "none";
options._container.innerHTML = options.text;
target && target.appendChild( options._container );
},
/**
- * @member footnote
- * The start function will be executed when the currentTime
- * of the video reaches the start time provided by the
+ * @member footnote
+ * The start function will be executed when the currentTime
+ * of the video reaches the start time provided by the
* options variable
*/
- start: function(event, options){
+ start: function( event, options ){
options._container.style.display = "inline";
},
/**
- * @member footnote
- * The end function will be executed when the currentTime
- * of the video reaches the end time provided by the
+ * @member footnote
+ * The end function will be executed when the currentTime
+ * of the video reaches the end time provided by the
* options variable
*/
- end: function(event, options){
+ end: function( event, options ){
options._container.style.display = "none";
},
_teardown: function( options ) {
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"> </div>
- <video id='video'
- controls preload='none'
- width= '250px'
+ <video id="video"
+ controls preload="none"
+ width="250px"
poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
type='video/ogg; codecs="theora, vorbis"'>
-test("Popcorn Footnote Plugin", function () {
+test( "Popcorn Footnote Plugin", function () {
- var popped = Popcorn("#video"),
+ var popped = Popcorn( "#video" ),
expects = 8,
count = 0,
setupId,
- footnotediv = document.getElementById("footnotediv");
+ footnotediv = document.getElementById( "footnotediv" );
- expect(expects);
+ expect( expects );
function plus() {
if ( ++count===expects) {
stop();
- ok ("footnote" in popped, "footnote is a mehtod of the popped instance");
+ ok ( "footnote" in popped, "footnote is a mehtod of the popped instance" );
plus();
equals ( footnotediv.childElementCount, 0, "initially, there is nothing inside the footnotediv" );
plus();
popped.footnote({
- start: 0, // seconds
- end: 2, // seconds
+ start: 0,
+ end: 2,
text: "This video made exclusively for drumbeat.org",
target: "footnotediv"
})
.footnote({
- start: 2, // seconds
- end: 4, // seconds
+ start: 2,
+ end: 4,
text: "Visit webmademovies.org for more details",
target: "footnotediv"
});
popped.exec( 0, 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" );
+ 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" );
+ 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" );
+ equals ( footnotediv.children[ 1 ].style.display , "inline", "second footnote is visible on the page" );
plus();
});
popped.exec( 4, function() {
- ok (footnotediv.children[1].style.display === 'none' && footnotediv.children[0].style.display === 'none', "footnote are no longer vidible on the page" );
+ ok ( footnotediv.children[ 1 ].style.display === "none" && footnotediv.children[0].style.display === 'none', "footnote are no longer vidible on the page" );
plus();
popped.pause().removeTrackEvent( setupId );
- ok( !footnotediv.children[1], "removed footnote was properly destroyed" );
+ ok( !footnotediv.children[ 1 ], "removed footnote was properly destroyed" );
plus();
});
- popped.play().volume(0);
+ popped.play().volume( 0 );
});
-test("Popcorn Text Plugin", function () {
+test( "Popcorn Text Plugin", function () {
- var popped = Popcorn("#video"),
+ var popped = Popcorn( "#video" ),
expects = 2,
count = 0,
setupId,
textdiv = document.getElementById( "textdiv" );
- expect(expects);
+ expect( expects );
function plus() {
- if ( ++count===expects) {
+ if ( ++count===expects ) {
start();
}
}
plus();
popped.text({
- start: 0, // seconds
- end: 3, // seconds
+ start: 0,
+ end: 3,
text: "I am an alias",
target: "textdiv"
});
popped.exec( 2, function() {
- equal( textdiv.children[0].innerHTML , "I am an alias", "I am an alias set by Popcorn.p.text" );
+ equal( textdiv.children[ 0 ].innerHTML , "I am an alias", "I am an alias set by Popcorn.p.text" );
plus();
- }).currentTime(1).play();
+ }).currentTime( 1 ).play();
});
<html>
<head>
<title>Popcorn Grafiti Markup Language Plug-in Demo</title>
-
<script src="../../popcorn.js"></script>
<script src="popcorn.gml.js"></script>
<script>
- document.addEventListener('DOMContentLoaded', function () {
- var p = Popcorn('#video')
- .play()
- .volume(0)
+ document.addEventListener( "DOMContentLoaded", function () {
+ var p = Popcorn( "#video" )
+ .play()
+ .volume( 0 )
.gml({
- start: 0, // seconds
- end: 5, // seconds
- gmltag: '29582',
- target: 'gmldiv'
+ start: 0,
+ end: 5,
+ gmltag: "29582",
+ target: "gmldiv"
})
.gml({
- start: 10, // seconds
- end: 20, // seconds
- gmltag: '155',
- target: 'gmldiv'
+ start: 10,
+ end: 20,
+ gmltag: "155",
+ target: "gmldiv"
})
.gml({
- start: 20, // seconds
- end: 40, // seconds
- gmltag: '161',
- target: 'gmldiv'
+ start: 20,
+ end: 40,
+ gmltag: "161",
+ target: "gmldiv"
});
-
}, false);
-
+
</script>
</head>
<body>
<p> A Processing canvas displaying the GML tag <a href="http://000000book.com/data/155">155</a> will appear at 10-20 seconds.</p>
<p> A Processing canvas displaying the GML tag <a href="http://000000book.com/data/161">161</a> will appear at 20-40 seconds.</p>
<div>
- <video id='video'
- controls preload='none'
- width= '250px'
- poster="../../test/poster.png">
+ <video id="video"
+ controls preload="none"
+ width= "250px"
+ poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
- type='video/mp4; codecs="avc1, mp4a"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
+ </video>
</div>
<div id="gmldiv"></div>
</body>
// PLUGIN: GML
-(function (Popcorn) {
+(function ( Popcorn ) {
var gmlPlayer = function( $p ) {
var _stroke = 0,
- onPt = 0,
+ onPt = 0,
onStroke = 0,
x = null,
y = null,
var tag = data.gml.tag,
app_name = tag.header && tag.header.client && tag.header.client.name;
- rotation = app_name === 'Graffiti Analysis 2.0: DustTag' ||
- app_name === 'DustTag: Graffiti Analysis 2.0' ||
- app_name === 'Fat Tag - Katsu Edition';
+ rotation = app_name === "Graffiti Analysis 2.0: DustTag" ||
+ app_name === "DustTag: Graffiti Analysis 2.0" ||
+ app_name === "Fat Tag - Katsu Edition";
play = function() {
dataReady();
};
};
-
+
/**
- * Grafiti markup Language (GML) popcorn plug-in
+ * Grafiti markup Language (GML) popcorn plug-in
* Renders a GML tag inside an HTML element
* Options parameter will need a mandatory start, end, target, gmltag.
* Optional parameters: none.
* Start is the time that you want this plug-in to execute
- * End is the time that you want this plug-in to stop executing
+ * End is the time that you want this plug-in to stop executing
* Target is the id of the document element that you wish to render the grafiti in
* gmltag is the numerical reference to a gml tag via 000000book.com
* @param {Object} options
- *
+ *
* Example:
var p = Popcorn('#video')
.gml({
var self = this,
target = document.getElementById( options.target );
-
+
options.endDrawing = options.endDrawing || options.end;
// create a canvas to put in the target div
readyCheck();
},
/**
- * @member gml
- * The start function will be executed when the currentTime
- * of the video reaches the start time provided by the
+ * @member gml
+ * The start function will be executed when the currentTime
+ * of the video reaches the start time provided by the
* options variable
*/
start: function( event, options ) {
options.container.style.display = "block";
},
/**
- * @member gml
- * The end function will be executed when the currentTime
- * of the video reaches the end time provided by the
+ * @member gml
+ * The end function will be executed when the currentTime
+ * of the video reaches the end time provided by the
* options variable
*/
end: function( event, options ) {
<title>Popcorn GML Plugin</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
+ <!--
+ do not move - this must be called immediately prior to
popcorn-api-draft.js
-->
-
<script src="../../popcorn.js"></script>
<script src="popcorn.gml.js"></script>
-
<script src="popcorn.gml.unit.js"></script>
</head>
<body>
<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'
+ <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"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
- <div id="gmldiv"></div>
+ </video>
+ <div id="gmldiv"></div>
</body>
</html>
-test("Popcorn GML Plugin", function () {
-
- var popped = Popcorn("#video"),
- expects = 8,
+test( "Popcorn GML Plugin", function () {
+
+ var popped = Popcorn( "#video" ),
+ expects = 8,
count = 0,
setupId,
- gmldiv = document.getElementById('gmldiv');
+ gmldiv = document.getElementById( "gmldiv" );
+
+ expect( expects );
- expect(expects);
-
function plus() {
- if ( ++count===expects) {
+ if ( ++count===expects ) {
start();
}
}
-
+
stop( 10000 );
-
- ok ('gml' in popped, "gml is a method of the popped instance");
+
+ ok ( "gml" in popped, "gml is a method of the popped instance" );
plus();
-
+
equals ( gmldiv.childElementCount, 0, "initially, there is nothing inside the gmldiv" );
plus();
-
+
popped.gml({
- start: 0, // seconds
- end: 2, // seconds
- gmltag: '29582',
- target: 'gmldiv'
+ start: 0,
+ end: 2,
+ gmltag: "29582",
+ target: "gmldiv"
})
.gml({
- start: 2, // seconds
- end: 4, // seconds
- gmltag: '155',
- target: 'gmldiv'
+ start: 2,
+ end: 4,
+ gmltag: "155",
+ target: "gmldiv"
}).volume( 0 );
setupId = popped.getLastTrackEventId();
popped.exec( 0, function() {
- equals( gmldiv.children[0].style.display , "block", "first GML is visible on the page" );
+ equals( gmldiv.children[ 0 ].style.display , "block", "first GML is visible on the page" );
plus();
});
-
+
popped.exec( 3, function() {
- equals( gmldiv.children[1].style.display , "block", "second GML is visible on the page" );
+ equals( gmldiv.children[ 1 ].style.display , "block", "second GML is visible on the page" );
plus();
});
-
+
popped.exec( 4, function() {
- equals( gmldiv.children[1].style.display , "none", "second GML is no longer visible on the page" );
+ equals( gmldiv.children[ 1 ].style.display , "none", "second GML is no longer visible on the page" );
plus();
- equals( gmldiv.children[0].style.display , "none", "first GML is no longer visible on the page" );
+ equals( gmldiv.children[ 0 ].style.display , "none", "first GML is no longer visible on the page" );
plus();
popped.pause().removeTrackEvent( setupId );
ok( !Processing.getInstanceById( "canvas155" ), "Processing insteance was properly destroyed" );
plus();
- ok( !gmldiv.children[1], "canvas element was properly removed" );
+ ok( !gmldiv.children[ 1 ], "canvas element was properly removed" );
plus();
});
-
+
popped.play();
});
<source id="mp4"
src="../../test/trailer.mp4"
- type="video/mp4; codecs='avc1, mp4a'">
+ type='video/mp4; codecs="avc1, mp4a"'>
<source id="ogv"
src="../../test/trailer.ogv"
- type="video/ogg; codecs='theora, vorbis'">
+ type='video/ogg; codecs="theora, vorbis"'>
<p>Your user agent does not support the HTML5 Video element.</p>
<source id="mp4"
src="../../test/trailer.mp4"
- type="video/mp4; codecs='avc1, mp4a'">
+ type='video/mp4; codecs="avc1, mp4a"'>
<source id="ogv"
src="../../test/trailer.ogv"
- type="video/ogg; codecs='theora, vorbis'">
+ type='video/ogg; codecs="theora, vorbis"'>
<p>Your user agent does not support the HTML5 Video element.</p>
<script src="../../popcorn.js"></script>
<script src="popcorn.googlemap.js"></script>
<script type="text/javascript">
- document.addEventListener('DOMContentLoaded', function () {
- var p = Popcorn('#video')
- .volume(0)
+ document.addEventListener( "DOMContentLoaded", function () {
+ var p = Popcorn( "#video" )
+ .volume( 0 )
.play()
.googlemap({
- start: 0, // seconds
- end: 20, // seconds
+ start: 0,
+ end: 20,
type: "ROADMAP",
target: "map",
lat: 43.665429,
lng: -79.403323,
zoom: "10"
- } )
+ })
.googlemap({
- start: 0, // seconds
- end: 40, // seconds
+ start: 0,
+ end: 40,
type: "STREETVIEW",
target: "map3",
location: "6th Line, Oakville, Ontario",
tween: "York university"
})
.googlemap({
- start: 0, // seconds
- end: 40, // seconds
+ start: 0,
+ end: 40,
type: "STREETVIEW",
target: "map5",
location: "Buffallo",
tween: "Ottawa"
})
.googlemap({
- start: 0, // seconds
- end: 20, // seconds
+ start: 0,
+ end: 20,
type: "STREETVIEW",
target: "map4",
lat: 35.7795324,
zoom: "1",
heading: "180",
pitch: "1",
- tween:[
+ tween: [
+ {
+ position: {
+ lat: 35.778056,
+ lng: -78.63903579999999
+ },
+ pov: {
+ heading: 183.5,
+ zoom: 1,
+ pitch: 1
+ },
+ interval: 2000
+ },
{
- position: {lat: 35.778056, lng: -78.63903579999999},
- pov: {heading: 183.5, zoom: 1, pitch:1},
- interval:2000
+ position: {
+ lat: 35.7770258,
+ lng: -78.63929150000001
+ },
+ pov: {
+ heading: 180,
+ zoom: 1,
+ pitch: 1
+ },
+ interval: 2000
},
- {
- position: {lat: 35.7770258, lng: -78.63929150000001},
- pov: {heading: 180, zoom: 1, pitch:1},
- interval:2000
+ {
+ position: {
+ lat: 35.775581,
+ lng: -78.639395
+ },
+ pov: {
+ heading: 180,
+ zoom: 1,
+ pitch: 1
+ },
+ interval: 2000
},
- {
- position: {lat: 35.775581, lng: -78.639395},
- pov: {heading: 180, zoom: 1, pitch:1},
- interval:2000
- },
- {
- position: {lat: 35.775581, lng: -78.639395},
- pov: {heading: 105, zoom: 1, pitch:1},
- interval:2000
+ {
+ position: {
+ lat: 35.775581,
+ lng: -78.639395
+ },
+ pov: {
+ heading: 105,
+ zoom: 1,
+ pitch: 1
+ },
+ interval: 2000
},
- {
- position: {lat: 35.775581, lng: -78.639395},
- pov: {heading: 0, zoom: 1, pitch:1},
- interval:2000
- }
+ {
+ position: {
+ lat: 35.775581,
+ lng: -78.639395
+ },
+ pov: {
+ heading: 0,
+ zoom: 1,
+ pitch: 1
+ },
+ interval: 2000
+ }
]
- } )
+ })
.googlemap({
- start: 0, // seconds
- end: 30, // seconds
+ start: 0,
+ end: 30,
type: "ROADMAP",
target: "map2",
location:"boston",
zoom: 15
- } )
+ })
.googlemap({
- start: 0, // seconds
- end: 20, // seconds
+ start: 0,
+ end: 20,
type: "STREETVIEW",
target: "map1",
lat: 43.665429,
zoom: "1",
heading: "0",
pitch: "1"
- } );
+ });
}, false);
</script>
</head>
<p> A Google Map Streetview tweening from Buffallo to Ottawa will appear at 0 seconds and disaapear at 40 seconds</p>
<div>
- <video id='video'
+ <video id="video"
controls
- width= '250px'
+ width= "250px"
poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
type='video/ogg; codecs="theora, vorbis"'>
// PLUGIN: Google Maps
var googleCallback;
-(function (Popcorn) {
+(function ( Popcorn ) {
var i = 1,
_mapFired = false,
_mapLoaded = false,
geocoder, loadMaps;
- //google api callback
- googleCallback = function (data) {
- // ensure all of the maps functions needed are loaded
+ //google api callback
+ googleCallback = function ( data ) {
+ // ensure all of the maps functions needed are loaded
// before setting _maploaded to true
- if (typeof google !== "undefined" && google.maps && google.maps.Geocoder && google.maps.LatLng) {
+ if ( typeof google !== "undefined" && google.maps && google.maps.Geocoder && google.maps.LatLng ) {
geocoder = new google.maps.Geocoder();
_mapLoaded = true;
} else {
setTimeout(function () {
- googleCallback(data);
+ googleCallback( data );
}, 1);
}
};
// function that loads the google api
loadMaps = function () {
// for some reason the Google Map API adds content to the body
- if (document.body) {
+ if ( document.body ) {
_mapFired = true;
- Popcorn.getScript("http://maps.google.com/maps/api/js?sensor=false&callback=googleCallback");
+ Popcorn.getScript( "http://maps.google.com/maps/api/js?sensor=false&callback=googleCallback" );
} else {
setTimeout(function () {
loadMaps();
} )
*
*/
- Popcorn.plugin("googlemap", function (options) {
+ Popcorn.plugin( "googlemap", function ( options ) {
var newdiv, map, location,
target = document.getElementById( options.target );
// if this is the firest time running the plugins
// call the function that gets the sctipt
- if (!_mapFired) {
+ if ( !_mapFired ) {
loadMaps();
}
// create a new div this way anything in the target div is left intact
// this is later passed on to the maps api
- newdiv = document.createElement("div");
+ newdiv = document.createElement( "div" );
newdiv.id = "actualmap" + i;
newdiv.style.width = "100%";
newdiv.style.height = "100%";
// ensure that google maps and its functions are loaded
// before setting up the map parameters
var isMapReady = function () {
- if (_mapLoaded) {
- if (options.location) {
+ if ( _mapLoaded ) {
+ if ( options.location ) {
// calls an anonymous google function called on separate thread
geocoder.geocode({
"address": options.location
- }, function (results, status) {
- if (status === google.maps.GeocoderStatus.OK) {
- options.lat = results[0].geometry.location.lat();
- options.lng = results[0].geometry.location.lng();
- location = new google.maps.LatLng(options.lat, options.lng);
- map = new google.maps.Map(newdiv, {
- mapTypeId: google.maps.MapTypeId[options.type] || google.maps.MapTypeId.HYBRID
+ }, function ( results, status ) {
+ if ( status === google.maps.GeocoderStatus.OK ) {
+ options.lat = results[ 0 ].geometry.location.lat();
+ options.lng = results[ 0 ].geometry.location.lng();
+ location = new google.maps.LatLng( options.lat, options.lng );
+ map = new google.maps.Map( newdiv, {
+ mapTypeId: google.maps.MapTypeId[ options.type ] || google.maps.MapTypeId.HYBRID
});
map.getDiv().style.display = "none";
}
});
} else {
- location = new google.maps.LatLng(options.lat, options.lng);
- map = new google.maps.Map(newdiv, {
- mapTypeId: google.maps.MapTypeId[options.type] || google.maps.MapTypeId.HYBRID
+ location = new google.maps.LatLng( options.lat, options.lng );
+ map = new google.maps.Map( newdiv, {
+ mapTypeId: google.maps.MapTypeId[ options.type ] || google.maps.MapTypeId.HYBRID
});
map.getDiv().style.display = "none";
}
if ( map ) {
map.getDiv().style.display = "block";
// reset the location and zoom just in case the user plaid with the map
- google.maps.event.trigger(map, 'resize');
+ google.maps.event.trigger( map, "resize" );
map.setCenter( location );
// make sure options.zoom is a number
options.pitch = +options.pitch;
}
-
-
if ( options.type === "STREETVIEW" ) {
// Switch this map into streeview mode
map.setStreetView(
}
})
);
-
+
// Function to handle tweening using a set timeout
var tween = function( rM, t ) {
setTimeout(function() {
var current_time = that.media.currentTime;
-
+
// Checks whether this is a generated route or not
if ( typeof options.tween === "object" ) {
heading: computeHeading( rM[ k ], rM[ k + 1 ] ) || 0,
zoom: options.zoom,
pitch: options.pitch || 0
- });
+ });
sView2.setPosition( checkpoints[ k ] );
}
}
tween( checkpoints, options.interval );
- }
+ }
}, t );
};
-
+
// Determines if we should use hardcoded values ( using options.tween ),
// or if we should use a start and end location and let google generate
// the route for us
// Creating another variable to hold the streetview map for tweening,
// Doing this because if there was more then one streetview map, the tweening would sometimes appear in other maps
var sView2 = sView;
-
+
// Create an array to store all the lat/lang values along our route
var checkpoints = [];
});
var showSteps = function ( directionResult, that ) {
-
+
// Push new google map lat and lng values into an array from our list of lat and lng values
var routes = directionResult.routes[ 0 ].overview_path;
for ( var j = 0, k = routes.length; j < k; j++ ) {
checkpoints.push( new google.maps.LatLng( routes[ j ].lat(), routes[ j ].lng() ) );
- }
-
+ }
+
// Check to make sure the interval exists, if not, set to a default of 1000
options.interval = options.interval || 1000;
tween( checkpoints, 10 );
var sView3 = sView;
for ( var i = 0, l = options.tween.length; i < l; i++ ) {
-
+
// Make sure interval exists, if not, set to 1000
options.tween[ i ].interval = options.tween[ i ].interval || 1000;
tween( options.tween, 10 );
* of the video reaches the end time provided by the
* options variable
*/
- end: function (event, options) {
+ end: function ( event, options ) {
// if the map exists hide it do not delete the map just in
// case the user seeks back to time b/w start and end
- if (map) {
+ if ( map ) {
map.getDiv().style.display = "none";
}
},
- _teardown: function (options) {
+ _teardown: function ( options ) {
- var target = document.getElementById(options.target);
+ var target = document.getElementById( options.target );
// the map must be manually removed
- target && target.removeChild(newdiv);
+ target && target.removeChild( newdiv );
newdiv = map = location = null;
}
};
target: "map-container",
type: {
elem: "select",
- options: ["ROADMAP", "SATELLITE", "STREETVIEW", "HYBRID", "TERRAIN"],
+ options: [ "ROADMAP", "SATELLITE", "STREETVIEW", "HYBRID", "TERRAIN" ],
label: "Type"
},
zoom: {
}
}
});
-})(Popcorn);
+})( Popcorn );
<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
+ <!--
+ do not move - this must be called immediately prior to
popcorn-api-draft.js
-->
-
+
<script src="../../popcorn.js"></script>
<script src="popcorn.googlemap.js"></script>
<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'
+ <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"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
- <div id="map" style="position:relative;float:left;width:300px;height:400px"></div>
+ </video>
+ <div id="map" style="position:relative;float:left;width:300px;height:400px"></div>
<div id="map2" style="position:relative;float:left;width:300px;height:400px"></div>
- <div id="map3" style="position:relative;float:left;width:300px;height:400px"></div>
+ <div id="map3" style="position:relative;float:left;width:300px;height:400px"></div>
</body>
</html>
-test("Popcorn Google Map Plugin", function () {
-
+test( "Popcorn Google Map Plugin", function () {
+
var popped = Popcorn( "#video" ),
- expects = 15,
+ expects = 15,
count = 0,
setupId;
-
+
expect( expects );
-
+
function plus() {
if ( ++count === expects ) {
start();
}
}
-
+
stop();
- ok ( 'googlemap' in popped, "googlemap is a mehtod of the popped instance" );
+ ok ( "googlemap" in popped, "googlemap is a mehtod of the popped instance" );
plus();
-
- ok ( document.getElementById( 'map' ).innerHTML === "", "initially, there is nothing inside the map" );
+
+ ok ( document.getElementById( "map" ).innerHTML === "", "initially, there is nothing inside the map" );
plus();
-
- ok ( document.getElementById( 'map2' ).innerHTML === "", "initially, there is nothing inside the map2" );
+
+ ok ( document.getElementById( "map2" ).innerHTML === "", "initially, there is nothing inside the map2" );
plus();
-
- ok ( document.getElementById( 'map3' ).innerHTML === "", "initially, there is nothing inside the map3" );
+
+ ok ( document.getElementById( "map3" ).innerHTML === "", "initially, there is nothing inside the map3" );
plus();
-
+
popped.googlemap({
- start: 0, // seconds
- end: 2, // seconds
- type: 'ROADMAP',
- target: 'map',
+ start: 0,
+ end: 2,
+ type: "ROADMAP",
+ target: "map",
lat: 43.665429,
lng: -79.403323
})
.googlemap({
- start: 0, // seconds
- end: 2, // seconds
- type: 'SATELLITE',
- target: 'map2',
- location:'toronto',
+ start: 0,
+ end: 2,
+ type: "SATELLITE",
+ target: "map2",
+ location: "toronto",
zoom: 15
});
var mapz = popped.googlemap({
- start: 2, // seconds
- end: 4, // seconds
+ start: 2,
+ end: 4,
type: "STREETVIEW",
target: "map3",
location: "6th Line, Oakville, Ontario",
interval: 1000,
tween: "York university"
})
- .volume(0);
+ .volume( 0 );
setupId = popped.getLastTrackEventId();
plus();
ok( google.maps.Geocoder, "Google maps Geocoder is available" );
plus();
- ok ( document.getElementById( 'actualmap1' ), "First map is on the page" );
+ 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" );
+ equals ( document.getElementById( "actualmap1" ).offsetParent.id, "map", "First map is inside the 'map' div" );
plus();
- equals( popped.data.trackEvents.byStart[1].zoom, 8, "Defaulting to zoom of 8" );
+ equals( popped.data.trackEvents.byStart[ 1 ].zoom, 8, "Defaulting to zoom of 8" );
plus();
});
popped.exec( 1, function() {
- ok (document.getElementById('actualmap2'), "Second map is on the page" );
+ 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" );
+ equals ( document.getElementById( "actualmap2" ).offsetParent.id, "map2", "Second map is inside the 'map2' div" );
plus();
});
popped.exec( 3, function() {
- equals (document.getElementById('actualmap3').offsetParent.id, "map3", "Tweening map is inside the 'map3' div" );
+ equals ( document.getElementById( "actualmap3" ).offsetParent.id, "map3", "Tweening map is inside the 'map3' div" );
plus();
});
popped.exec( 5, function() {
- ok ( document.getElementById( 'actualmap2' ).style.display === "none" &&
- document.getElementById( 'actualmap1' ).style.display === "none" &&
- document.getElementById( 'actualmap3' ).style.display === "none", "All maps are no longer visible" );
+ ok ( document.getElementById( "actualmap2" ).style.display === "none" &&
+ document.getElementById( "actualmap1" ).style.display === "none" &&
+ document.getElementById( "actualmap3" ).style.display === "none", "All maps are no longer visible" );
plus();
popped.pause().removeTrackEvent( setupId );
- ok( !document.getElementById( 'actualmap4' ), "removed map was properly destroyed" );
+ ok( !document.getElementById( "actualmap4" ), "removed map was properly destroyed" );
plus();
});
try {
popped.googlemap({});
} catch( e ) {
- ok(true, 'empty event was caught by debug');
+ ok( true, "empty event was caught by debug" );
plus();
}
popped.play();
-
-});
+});
<html>
<head>
<title>Popcorn Image Plug-in Demo</title>
-
<script src="../../popcorn.js"></script>
<script src="popcorn.image.js"></script>
<script>
var p = Popcorn( "#video" )
.volume( 0 )
- .play()
+ .play()
.image({
// seconds
start: 5,
<p> First one (with an overlayed text) will disappear at 15 seconds.</p>
<p> Second one (without an overlayed text) will disappear at 45 seconds.</p>
<div>
- <video id="video"
+ <video id="video"
controls
width="250px"
- poster="../../test/poster.png">
+ poster="../../test/poster.png">
<source id="mp4"
src="../../test/trailer.mp4"
- type='video/mp4; codecs="avc1, mp4a"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
<source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
+ </video>
</div>
<div style="width:400px; height:400px" id="imagediv">
- </div>
+ </div>
</body>
</html>
// PLUGIN: IMAGE
-(function (Popcorn) {
+(function ( Popcorn ) {
/**
- * Images popcorn plug-in
+ * Images popcorn plug-in
* Shows an image element
* Options parameter will need a start, end, href, target and src.
* Start is the time that you want this plug-in to execute
- * End is the time that you want this plug-in to stop executing
- * href is the url of the destination of a link - optional
- * Target is the id of the document element that the iframe needs to be attached to,
+ * End is the time that you want this plug-in to stop executing
+ * href is the url of the destination of a link - optional
+ * Target is the id of the document element that the iframe needs to be attached to,
* this target element must exist on the DOM
* Src is the url of the image that you want to display
- * text is the overlayed text on the image - optional
+ * text is the overlayed text on the image - optional
*
* @param {Object} options
- *
+ *
* Example:
var p = Popcorn('#video')
.image({
*/
Popcorn.plugin( "image", {
manifest: {
- about:{
+ about: {
name: "Popcorn image Plugin",
version: "0.1",
author: "Scott Downe",
},
target: "image-container",
src: {
- elem: "input",
- type: "text",
+ elem: "input",
+ type: "text",
label: "Source URL"
},
text: {
// borders look really bad, if someone wants it they can put it on their div target
img.style.borderStyle = "none";
-
+
if ( options.href ) {
options.link.href = options.href;
}
options.link.target = "_blank";
- var fontHeight = ( img.height / 12 ) + "px",
+ var fontHeight = ( img.height / 12 ) + "px",
divText = document.createElement( "div" );
-
+
Popcorn.extend( divText.style, {
color: "black",
divText.innerHTML = options.text || "";
options.link.appendChild( divText );
options.link.appendChild( img );
- divText.style.top = ( img.height / 2 ) - ( divText.offsetHeight / 2 ) + "px";
+ divText.style.top = ( img.height / 2 ) - ( divText.offsetHeight / 2 ) + "px";
options.link.style.display = "none";
}, false );
},
/**
- * @member image
- * The start function will be executed when the currentTime
- * of the video reaches the start time provided by the
+ * @member image
+ * The start function will be executed when the currentTime
+ * of the video reaches the start time provided by the
* options variable
*/
start: function( event, options ) {
options.link.style.display = "block";
},
/**
- * @member image
- * The end function will be executed when the currentTime
- * of the video reaches the end time provided by the
+ * @member image
+ * The end function will be executed when the currentTime
+ * of the video reaches the end time provided by the
* options variable
*/
end: function( event, options ) {
<title>Popcorn Image Plug-in Test</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
+ <!--
+ do not move - this must be called immediately prior to
popcorn-api-draft.js
-->
-
<script src="../../popcorn.js"></script>
<script src="popcorn.image.js"></script>
-
<script src="popcorn.image.unit.js"></script>
</head>
<body>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"> </div>
-
- <video id="video"
+
+ <video id="video"
controls
width="250px"
- poster="../../test/poster.png">
+ poster="../../test/poster.png">
<source id="mp4"
src="../../test/trailer.mp4"
- type='video/mp4; codecs="avc1, mp4a"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
<source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
- <div id="imagediv"></div>
+ </video>
+ <div id="imagediv"></div>
</body>
</html>
-test("Popcorn Image Plugin", function () {
+test( "Popcorn Image Plugin", function () {
var popped = Popcorn( "#video" ),
expects = 9,
imagediv = document.getElementById( "imagediv" ),
sources = [
"https://www.drumbeat.org/media//images/drumbeat-logo-splash.png",
- "http://www.petmountain.com/category/mini/organic-dog-supplies/520/organic-dog-supplies.jpg",
+ "http://www.petmountain.com/category/mini/organic-dog-supplies/520/organic-dog-supplies.jpg",
"http://www.botskool.com/sites/default/files/images/javascript.png"
];
-
+
expect( expects );
-
+
function plus() {
- if ( ++count === expects) {
+ if ( ++count === expects ) {
start();
}
}
stop();
-
+
ok( "image" in popped, "image is a method of the popped instance" );
plus();
equals( imagediv.innerHTML, "", "initially, there is nothing inside the imagediv" );
plus();
-
+
popped.image({
// seconds
start: 1,
// seconds
end: 3,
href: "http://www.drumbeat.org/",
- src: sources[0],
+ src: sources[ 0 ],
text: "DRUMBEAT",
target: "imagediv"
})
// seconds
end: 6,
// no href
- src: sources[1],
+ src: sources[ 1 ],
target: "imagediv"
})
.image({
// seconds
end: 6,
// no href
- src: sources[2],
- target: "imagediv"
+ src: sources[ 2 ],
+ target: "imagediv"
});
setupId = popped.getLastTrackEventId();
ok( /img/.test( imagediv.innerHTML ), "An image exists" );
plus();
});
-
+
popped.exec( 3, function() {
ok( /display: none;/.test( imagediv.innerHTML ), "Div contents are hidden again" );
plus();
});
-
+
popped.exec( 5, function() {
[].forEach.call( document.querySelectorAll( "#imagediv a img" ), function( img, idx ) {
ok( img.src === sources[ idx ], "Image " + idx + " is in the right order" );
plus();
});
});
-
+
popped.exec( 7, function() {
popped.pause().removeTrackEvent( setupId );
- ok( !imagediv.children[2], "removed image was properly destroyed" );
+ ok( !imagediv.children[ 2 ], "removed image was properly destroyed" );
plus();
});
- popped.volume( 0 ).play();
+ popped.volume( 0 ).play();
});
<html>
<head>
<title>Popcorn LastFM Plug-in Demo</title>
-
+
<!--
ATTENTION
-
+
This demo uses an API key obtained for testing the LastFM Popcorn.js
plugin. Please do not use it for other purposes.
-->
-
+
<script src="../../popcorn.js"></script>
<script src="popcorn.lastfm.js"></script>
- <script>
- document.addEventListener('DOMContentLoaded', function () {
- var p = Popcorn('#video')
- .volume(0)
+ <script>
+ document.addEventListener( "DOMContentLoaded", function () {
+ var p = Popcorn( "#video" )
+ .volume( 0 )
.play()
.lastfm({
- start: 5, // seconds
- end: 15, // seconds
- artist: 'yacht',
- target: 'lastfmdiv',
- apikey: '30ac38340e8be75f9268727cb4526b3d'
- } )
+ start: 5,
+ end: 15,
+ artist: "yacht",
+ target: "lastfmdiv",
+ apikey: "30ac38340e8be75f9268727cb4526b3d"
+ })
.lastfm({
- start: 10, // seconds
- end: 20, // seconds
- artist: 'the beatles',
- target: 'lastfmdiv',
- apikey: '30ac38340e8be75f9268727cb4526b3d'
- } )
+ start: 10,
+ end: 20,
+ artist: "the beatles",
+ target: "lastfmdiv",
+ apikey: "30ac38340e8be75f9268727cb4526b3d"
+ })
.lastfm({
- start: 15, // seconds
- end: 30, // seconds
- artist: 'sdfsdfsdfdsddfsdfsdfsddfsf',
- target: 'lastfmdiv',
- apikey: '30ac38340e8be75f9268727cb4526b3d'
- } )
+ start: 15,
+ end: 30,
+ artist: "sdfsdfsdfdsddfsdfsdfsddfsf",
+ target: "lastfmdiv",
+ apikey: "30ac38340e8be75f9268727cb4526b3d"
+ })
.lastfm({
- start: 20, // seconds
- end: 45, // seconds
- artist: 'Coldplay',
- target: 'lastfmdiv',
- apikey: '30ac38340e8be75f9268727cb4526b3d'
- } )
+ start: 20,
+ end: 45,
+ artist: "Coldplay",
+ target: "lastfmdiv",
+ apikey: "30ac38340e8be75f9268727cb4526b3d"
+ })
.lastfm({
- start: 25, // seconds
- end: 40, // seconds
- artist: 'yacht',
- target: 'lastfmdiv',
- apikey: '30ac38340e8be75f9268727cb4526b3d'
- } )
+ start: 25,
+ end: 40,
+ artist: "yacht",
+ target: "lastfmdiv",
+ apikey: "30ac38340e8be75f9268727cb4526b3d"
+ })
}, false);
</script>
</head>
<p> Artist information for 'Coldplay' will appear at 20 seconds and disappear at 45 seconds.</p>
<p> Artist information for 'yacht' will appear at 25 seconds and disappear at 40 seconds.</p>
<div>
- <video id='video'
- controls preload='none'
- width= '250px'
- poster="../../test/poster.png">
+ <video id="video"
+ controls preload="none"
+ width= "250px"
+ poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
- type='video/mp4; codecs="avc1, mp4a"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
+ </video>
</div>
<div id="lastfmdiv" width="50%" height="50%">
</div>
// PLUGIN: LASTFM
-(function (Popcorn) {
+(function ( Popcorn ) {
var _artists = {},
- lastFMcallback = function(data){
- if (data.artist) {
+ lastFMcallback = function( data ) {
+ if ( data.artist ) {
var htmlString = "";
- htmlString = '<h3>'+data.artist.name+'</h3>';
- htmlString += '<a href="'+data.artist.url+'" target="_blank" style="float:left;margin:0 10px 0 0;"><img src="'+ data.artist.image[2]['#text'] +'" alt=""></a>';
- htmlString += '<p>'+ data.artist.bio.summary +'</p>';
- htmlString += '<hr /><p><h4>Tags</h4><ul>';
+ htmlString = "<h3>"+data.artist.name+"</h3>";
+ htmlString += "<a href='" + data.artist.url + "' target='_blank' style='float:left;margin:0 10px 0 0;'><img src='" + data.artist.image[ 2 ][ "#text"] + "' alt=''></a>";
+ htmlString += "<p>" + data.artist.bio.summary + "</p>";
+ htmlString += "<hr /><p><h4>Tags</h4><ul>";
Popcorn.forEach( data.artist.tags.tag, function( val, i) {
- htmlString += '<li><a href="'+ val.url +'">'+ val.name +'</a></li>';
+ htmlString += "<li><a href='" + val.url + "'>" + val.name + "</a></li>";
});
- htmlString += '</ul></p>';
- htmlString += '<hr /><p><h4>Similar</h4><ul>';
+ htmlString += "</ul></p>";
+ htmlString += "<hr /><p><h4>Similar</h4><ul>";
Popcorn.forEach( data.artist.similar.artist, function( val, i) {
- htmlString += '<li><a href="'+ val.url +'">'+ val.name +'</a></li>';
+ htmlString += "<li><a href='" + val.url + "'>" + val.name + "</a></li>";
});
- htmlString += '</ul></p>';
+ htmlString += "</ul></p>";
- _artists[data.artist.name.toLowerCase()].htmlString = htmlString;
+ _artists[ data.artist.name.toLowerCase() ].htmlString = htmlString;
}
};
* Target is the id of the document element that the images are
* appended to, this target element must exist on the DOM
* ApiKey is the API key registered with LastFM for use with their API
- *
+ *
* @param {Object} options
- *
+ *
* Example:
var p = Popcorn('#video')
.lastfm({
*
*/
Popcorn.plugin( "lastfm" , (function(){
-
-
+
+
return {
_setup: function( options ) {
- options._container = document.createElement( 'div' );
+ options._container = document.createElement( "div" );
options._container.style.display = "none";
options._container.innerHTML = "";
options.artist = options.artist && options.artist.toLowerCase() || "";
throw new Error( "target container doesn't exist" );
}
target && target.appendChild( options._container );
-
- if(!_artists[options.artist]) {
- _artists[options.artist] = {
+ if ( !_artists[ options.artist ] ) {
+
+ _artists[ options.artist ] = {
count: 0,
htmlString: "Unknown Artist"
};
- Popcorn.getJSONP("http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist="+ options.artist +"&api_key="+options.apikey+"&format=json&callback=lastFMcallback", lastFMcallback, false );
+ Popcorn.getJSONP( "http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=" + options.artist + "&api_key=" + options.apikey + "&format=json&callback=lastFMcallback", lastFMcallback, false );
}
- _artists[options.artist].count++;
-
+ _artists[ options.artist ].count++;
+
},
/**
- * @member LastFM
- * The start function will be executed when the currentTime
- * of the video reaches the start time provided by the
+ * @member LastFM
+ * The start function will be executed when the currentTime
+ * of the video reaches the start time provided by the
* options variable
*/
start: function( event, options ) {
- options._container.innerHTML = _artists[options.artist].htmlString;
+ options._container.innerHTML = _artists[ options.artist ].htmlString;
options._container.style.display = "inline";
},
/**
- * @member LastFM
- * The end function will be executed when the currentTime
- * of the video reaches the end time provided by the
+ * @member LastFM
+ * The end function will be executed when the currentTime
+ * of the video reaches the end time provided by the
* options variable
*/
end: function( event, options ) {
})(),
{
about:{
- name: "Popcorn LastFM Plugin",
+ name: "Popcorn LastFM Plugin",
version: "0.1",
- author: "Steven Weerdenburg",
+ author: "Steven Weerdenburg",
website: "http://sweerdenburg.wordpress.com/"
},
- options:{
- start : {elem:'input', type:'text', label:'In'},
- end : {elem:'input', type:'text', label:'Out'},
- target : 'lastfm-container',
- artist : {elem:'input', type:'text', label:'Artist'}
+ options: {
+ start: {
+ elem: "input",
+ type: "text",
+ label: "In"
+ },
+ end: {
+ elem: "input",
+ type: "text",
+ label: "Out"
+ },
+ target: "lastfm-container",
+ artist: {
+ elem: "input",
+ type: "text",
+ label: "Artist"
+ }
}
});
<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
+ <!--
+ do not move - this must be called immediately prior to
popcorn-api-draft.js
-->
-
+
<script src="../../popcorn.js"></script>
<script src="../../test/jquery.js"></script>
<script src="popcorn.lastfm.js"></script>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"> </div>
-
- <video id='video'
- controls
- width= '250px'
- poster="../../test/poster.png">
- <source id='mp4'
+ <video id="video"
+ controls
+ width= "250px"
+ poster="../../test/poster.png">
+
+ <source id="mp4"
src="../../test/trailer.mp4"
- type='video/mp4; codecs="avc1, mp4a"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
- <div id="lastfmdiv"></div>
+ </video>
+ <div id="lastfmdiv"></div>
</body>
</html>
-test("Popcorn LastFM Plugin", function () {
+test( "Popcorn LastFM Plugin", function () {
/*
ATTENTION
-
+
This demo uses an API key obtained for testing the LastFM Popcorn.js
plugin. Please do not use it for other purposes.
*/
- var popped = Popcorn("#video"),
- expects = 10,
+ var popped = Popcorn( "#video" ),
+ expects = 10,
count = 0,
setupId,
- lastfmdiv = document.getElementById('lastfmdiv');
-
+ lastfmdiv = document.getElementById( "lastfmdiv" );
+
expect( expects );
-
+
function plus() {
- if ( ++count === expects) {
+ if ( ++count === expects ) {
start();
}
}
- stop();
-
- ok('lastfm' in popped, "lastfm is a method of the popped instance");
+ stop();
+
+ ok( "lastfm" in popped, "lastfm is a method of the popped instance" );
plus();
equals ( lastfmdiv.innerHTML, "", "initially, there is nothing inside the lastfmdiv" );
plus();
-
+
popped.lastfm({
- start: 1, // seconds
- end: 4, // seconds
- artist: 'yacht',
- target: 'lastfmdiv',
- apikey: '30ac38340e8be75f9268727cb4526b3d'
+ start: 1,
+ end: 4,
+ artist: "yacht",
+ target: "lastfmdiv",
+ apikey: "30ac38340e8be75f9268727cb4526b3d"
})
.lastfm({
- start: 2, // seconds
- end: 7, // seconds
- artist: 'the beatles',
- target: 'lastfmdiv',
- apikey: '30ac38340e8be75f9268727cb4526b3d'
+ start: 2,
+ end: 7,
+ artist: "the beatles",
+ target: "lastfmdiv",
+ apikey: "30ac38340e8be75f9268727cb4526b3d"
})
.lastfm({
- start: 4, // seconds
- end: 7, // seconds
- target: 'lastfmdiv',
- apikey: '30ac38340e8be75f9268727cb4526b3d'
+ start: 4,
+ end: 7,
+ target: "lastfmdiv",
+ apikey: "30ac38340e8be75f9268727cb4526b3d"
});
setupId = popped.getLastTrackEventId();
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" );
+ 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" );
+ 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" );
+ 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" );
+ 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" );
+ equals ( lastfmdiv.children[ 2 ].innerHTML , "Unknown Artist", "Artist information could not be found" );
plus();
popped.pause().removeTrackEvent( setupId );
- ok( !lastfmdiv.children[2], "removed artist was properly destroyed" );
+ ok( !lastfmdiv.children[ 2 ], "removed artist was properly destroyed" );
plus();
});
try {
popped.lastfm({});
} catch( e ) {
- ok(true, 'empty event was caught by debug');
+ ok ( true, "empty event was caught by debug" );
plus();
}
-
- popped.volume(0).play();
+
+ popped.volume( 0 ).play();
});
<title>Popcorn LinkedIn Plug-in Demo</title>
<!--
ATTENTION
-
This demo uses an API key obtained for testing the LinkedIn Popcorn.js
plugin. Please do not use it for other purposes. This API key is meant
to be used on localhost (port 80). For other purposes, please obtain an API key
</head>
<body>
<h1 id="qunit-header">Popcorn LinkedIn Plug-in Demo</h1>
- Right of video:
+ Right of video:
<ul>
- <li>share button: between 1 and 4 seconds</li>
- <li>recommend button: between 5 and 8 seconds</li>
- <li>member profile: between 9 and 15 seconds</li>
+ <li>share button: between 1 and 4 seconds</li>
+ <li>recommend button: between 5 and 8 seconds</li>
+ <li>member profile: between 9 and 15 seconds</li>
</ul>
Below video:
- <ul>
- <li>company insider: between 9 and 15 seconds</li>
+ <ul>
+ <li>company insider: between 9 and 15 seconds</li>
<li>company profile: between 16 and 27 seconds</li>
</ul>
- <p>
+ <p>
For a description of each plugin's purpose, go to: <a href="http://developer.linkedin.com/community/plugins">LinkedIn Plugins</a><br/>
</p>
-
+
<div>
- <video id="video"
- controls preload="none"
+ <video id="video"
+ controls preload="none"
width="350px"
- poster="../../test/poster.png">
+ poster="../../test/poster.png">
<source id="mp4"
src="../../test/trailer.mp4"
- type='video/mp4; codecs="avc1, mp4a"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
<source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
+ </video>
</div>
<div id="sharediv" style="position:absolute;top:400px;left:400px;"></div>
<div id="recommenddiv" style="position:absolute;top:400px;left:400px;"></div>
//PLUGIN: linkedin
-(function (Popcorn){
+(function ( Popcorn ){
/**
* LinkedIn Popcorn plug-in
label: "Counter"
},
memberid: {
- elem:"input",
- type:"text",
- label:"Member ID"
+ elem: "input",
+ type: "text",
+ label: "Member ID"
},
format: {
- elem:"input",
- type:"text",
- label:"Format"
+ elem: "input",
+ type: "text",
+ label: "Format"
},
companyid: {
- elem:"input",
- type:"text",
- label:"Company ID"
+ elem: "input",
+ type: "text",
+ label: "Company ID"
},
modules: {
- elem:"input",
- type:"text",
- label:"Modules"
+ elem: "input",
+ type: "text",
+ label: "Modules"
},
productid: {
- elem:"input",
- type:"text",
- label:"productid"
+ elem: "input",
+ type: "text",
+ label: "productid"
},
related: {
- elem:"input",
- type:"text",
- label:"related"
+ elem: "input",
+ type: "text",
+ label: "related"
},
start: {
- elem:"input",
- type:"text",
- label:"In"
+ elem: "input",
+ type: "text",
+ label: "In"
},
end: {
- elem:"input",
- type:"text",
- label:"Out"
+ elem: "input",
+ type: "text",
+ label: "Out"
},
target: "linkedin-container"
target = document.getElementById( options.target ),
script = document.createElement( "script" );
- Popcorn.getScript("http://platform.linkedin.com/in.js");
+ Popcorn.getScript( "http://platform.linkedin.com/in.js" );
options._container = document.createElement( "div" );
options._container.appendChild( script );
if ( apikey ) {
script.innerHTML = "api_key: " + apikey;
}
-
+
options.type = options.type && options.type.toLowerCase() || "";
// Replace the LinkedIn plugin's error message to something more helpful
<title>Popcorn LinkedIn Plugin Test</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
+ <!--
+ do not move - this must be called immediately prior to
popcorn-api-draft.js
-->
-
<script src="../../popcorn.js"></script>
- <script src="popcorn.linkedin.js"></script>
+ <script src="popcorn.linkedin.js"></script>
<script src="popcorn.linkedin.unit.js"></script>
</head>
<body>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"> </div>
-
- <video id='video'
+
+ <video id="video"
controls
- width= '250px'
- poster="../../test/poster.png">
+ width= "250px"
+ poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
- type='video/mp4; codecs="avc1, mp4a"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
+ </video>
<div id="sharediv"></div>
<div id="recommenddiv"></div>
<div id="memberprofilediv"></div>
<div id="companyinsiderdiv"></div>
- <div id="companyprofilediv"></div>
+ <div id="companyprofilediv"></div>
</body>
</html>
-test("Popcorn LinkedIn Plugin", function () {
-
+test ("Popcorn LinkedIn Plugin", function () {
+
if ( /localhost/.test( location.hostname ) ) {
-
+
// run tests on localhost
- var popped = Popcorn("#video"),
+ var popped = Popcorn( "#video" ),
expects = 23,
count = 0,
setupId,
memberprofilediv = document.getElementById( "memberprofilediv" ),
companyinsiderdiv = document.getElementById( "companyinsiderdiv" ),
companyprofilediv = document.getElementById( "companyprofilediv" );
-
+
expect( expects );
-
+
function plus() {
-
+
if ( ++count === expects ) {
start();
}
}
-
+
stop();
-
+
ok( "linkedin" in popped, "linkedin is a method of the popped instance" );
plus();
-
+
// Testing the share plugin
equals( sharediv.innerHTML, "", "initially, there is nothing inside the sharediv" );
plus();
-
+
popped.linkedin({
type: "share",
counter: "right",
start: 1,
end: 3
});
-
+
popped.exec( 2, function() {
-
+
ok( /block/.test( sharediv.children[ 0 ].style.display ), "sharediv contents are displayed" );
plus();
ok( /script/.test( sharediv.children[ 0 ].innerHTML ), "share plugin exists" );
plus();
});
-
+
popped.exec( 4, function() {
-
+
ok( /none/.test( sharediv.children[ 0 ].style.display ), "sharediv contents are hidden again" );
plus();
});
-
+
// Testing the recommendproduct plugin
equals( recommenddiv.innerHTML, "", "initially, there is nothing inside the recommenddiv" );
plus();
-
+
popped.linkedin({
type: "recommendproduct",
counter: "top",
start: 1,
end: 3
});
-
+
popped.exec( 2, function() {
-
+
ok( /block/.test( recommenddiv.children[ 0 ].style.display ), "recommenddiv contents are displayed" );
plus();
ok( /script/.test( recommenddiv.children[ 0 ].innerHTML ), "recommend plugin exists" );
plus();
});
-
+
popped.exec( 4, function() {
-
+
ok( /none/.test( recommenddiv.children[ 0 ].style.display ), "recommenddiv contents are hidden again" );
plus();
});
-
+
// Testing memberprofile plugin
equals( memberprofilediv.innerHTML, "", "initially, there is nothing inside the memberprofilediv" );
plus();
-
+
popped.linkedin({
type: "memberprofile",
memberid: "/in/jeffweiner08",
});
popped.exec( 2, function() {
-
+
ok( /block/.test( memberprofilediv.children[ 0 ].style.display ), "memberprofilediv contents are displayed" );
plus();
ok( /script/.test( memberprofilediv.children[ 0 ].innerHTML ), "member profile plugin exists" );
plus();
});
-
+
popped.exec( 4, function() {
-
+
ok( /none/.test( memberprofilediv.children[ 0 ].style.display ), "memberprofilediv contents are hidden again" );
plus();
});
-
+
// Testing the company insider plugin
equals( companyinsiderdiv.innerHTML, "", "initially, there is nothing inside the companyinsiderdiv" );
plus();
-
+
popped.linkedin({
type: "companyinsider",
companyid: "1441",
});
popped.exec( 2, function() {
-
+
ok( /block/.test( companyinsiderdiv.children[ 0 ].style.display ), "companyinsiderdiv contents are displayed" );
plus();
ok( /script/.test( companyinsiderdiv.children[ 0 ].innerHTML ), "company insider plugin exists" );
plus();
});
-
+
popped.exec( 4, function() {
-
+
ok( /none/.test( companyinsiderdiv.children[ 0 ].style.display ), "companyinsiderdiv contents are hidden again" );
plus();
});
// Testing company profile plugin
equals( companyprofilediv.innerHTML, "", "initially, there is nothing inside the companyprofilediv" );
plus();
-
+
popped.linkedin({
type: "companyprofile",
companyid: "1441",
start: 1,
end: 3
});
-
+
setupId = popped.getLastTrackEventId();
popped.exec( 2, function() {
-
+
ok( /block/.test( companyprofilediv.children[ 0 ].style.display ), "companyprofilediv contents are displayed" );
plus();
ok( /script/.test( companyprofilediv.children[ 0 ].innerHTML ), "company profile plugin exists" );
plus();
});
-
+
popped.exec( 4, function() {
-
+
ok( /none/.test( companyprofilediv.children[ 0 ].style.display ), "companyprofilediv contents are hidden again" );
plus();
-
+
// Make sure _teardown functionality works
popped.pause().removeTrackEvent( setupId );
- ok( !companyprofilediv.children[1], "companyprofilediv plugin was properly destroyed" );
+ ok( !companyprofilediv.children[ 1 ], "companyprofilediv plugin was properly destroyed" );
plus();
});
try {
popped.linkedin({});
} catch( e ) {
- ok(true, 'empty event was caught by debug');
+ ok( true, "empty event was caught by debug" );
plus();
}
popped.volume( 0 ).play();
} else {
-
+
// tests must be run on localhost
ok( false, "LinkedIn apikey will only work under localhost" );
}
<source id="mp4"
src="../../test/trailer.mp4"
- type="video/mp4; codecs='avc1, mp4a'">
+ type='video/mp4; codecs="avc1, mp4a"'>
<source id="ogv"
src="../../test/trailer.ogv"
- type="video/ogg; codecs='theora, vorbis'">
+ type='video/ogg; codecs="theora, vorbis"'>
<p>Your user agent does not support the HTML5 Video element.</p>
<source id="mp4"
src="../../test/trailer.mp4"
- type="video/mp4; codecs='avc1, mp4a'">
+ type='video/mp4; codecs="avc1, mp4a"'>
<source id="ogv"
src="../../test/trailer.ogv"
- type="video/ogg; codecs='theora, vorbis'">
+ type='video/ogg; codecs="theora, vorbis"'>
<p>Your user agent does not support the HTML5 Video element.</p>
// PLUGIN: Mustache
-(function (Popcorn) {
+(function ( Popcorn ) {
/**
* Mustache Popcorn Plug-in
*
*/
- Popcorn.plugin( 'mustache' , function( options ) {
+ Popcorn.plugin( "mustache" , function( options ) {
var getData, data, getTemplate, template;
- Popcorn.getScript('https://github.com/janl/mustache.js/raw/master/mustache.js');
+ Popcorn.getScript( "https://github.com/janl/mustache.js/raw/master/mustache.js" );
var shouldReload = !!options.dynamic,
typeOfTemplate = typeof options.template,
}
options.container = target || document.createElement( "div" );
- if ( typeOfTemplate === 'function' ) {
+ if ( typeOfTemplate === "function" ) {
if ( !shouldReload ) {
template = options.template( options );
} else {
getTemplate = options.template;
}
- } else if ( typeOfTemplate === 'string' ) {
+ } else if ( typeOfTemplate === "string" ) {
template = options.template;
} else if ( Popcorn.plugin.debug ) {
- throw new Error( 'Mustache Plugin Error: options.template must be a String or a Function.' );
+ throw new Error( "Mustache Plugin Error: options.template must be a String or a Function." );
} else {
template = "";
}
- if ( typeOfData === 'function' ) {
+ if ( typeOfData === "function" ) {
if ( !shouldReload ) {
- data = options.data(options);
+ data = options.data( options );
} else {
getData = options.data;
}
- } else if ( typeOfData === 'string' ) {
+ } else if ( typeOfData === "string" ) {
data = JSON.parse( options.data );
- } else if ( typeOfData === 'object' ) {
+ } else if ( typeOfData === "object" ) {
data = options.data;
} else if ( Popcorn.plugin.debug ) {
- throw new Error( 'Mustache Plugin Error: options.data must be a String, Object, or Function.' );
+ throw new Error( "Mustache Plugin Error: options.data must be a String, Object, or Function." );
} else {
data = "";
}
var html = Mustache.to_html( template,
data
- ).replace( /^\s*/mg, '' );
+ ).replace( /^\s*/mg, "" );
options.container.innerHTML = html;
}
};
},
end: function( event, options ) {
- options.container.innerHTML = '';
+ options.container.innerHTML = "";
},
_teardown: function( options ) {
getData = data = getTemplate = template = null;
},
{
about: {
- name: 'Popcorn Mustache Plugin',
- version: '0.1',
- author: 'David Humphrey (@humphd)',
- website: 'http://vocamus.net/dave'
+ name: "Popcorn Mustache Plugin",
+ version: "0.1",
+ author: "David Humphrey (@humphd)",
+ website: "http://vocamus.net/dave"
},
options: {
- start: {elem:'input', type:'text', label:'In'},
- end: {elem:'input', type:'text', label:'Out'},
- target: 'mustache-container',
- template: {elem:'input', type:'text', label:'Template'},
- data: {elem:'input', type:'text', label:'Data'},
+ start: {
+ elem: "input",
+ type: "text",
+ label: "In"
+ },
+ end: {
+ elem: "input",
+ type: "text",
+ label: "Out"
+ },
+ target: "mustache-container",
+ template: {
+ elem: "input",
+ type: "text",
+ label: "Template"
+ },
+ data: {
+ elem: "input",
+ type: "text",
+ label: "Data"
+ },
/* TODO: how to show a checkbox/boolean? */
- dynamic: {elem:'input', type:'text', label:'Dynamic'}
+ dynamic: {
+ elem: "input",
+ type: "text",
+ label: "Dynamic"
+ }
}
});
})( Popcorn );
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"> </div>
- <video id='video'
+ <video id="video"
autobuffer
preload="auto"
controls
- width= '250px'
+ width= "250px"
poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
type='video/ogg; codecs="theora, vorbis"'>
-test('Popcorn Mustache Plugin', function () {
+test( "Popcorn Mustache Plugin", function () {
- var popped = Popcorn('#video'),
+ var popped = Popcorn( "#video" ),
expects = 6,
count = 0,
- mustacheDiv = document.getElementById('mustache-div');
+ mustacheDiv = document.getElementById( "mustache-div" );
expect( expects );
function plus() {
- if ( ++count === expects) {
+ if ( ++count === expects ) {
start();
}
}
stop();
- ok('mustache' in popped, 'mustache is a method of the popped instance');
+ ok( "mustache" in popped, "mustache is a method of the popped instance" );
plus();
- equals ( mustacheDiv.innerHTML, '', 'initially, there is nothing inside the mustache-div' );
+ equals ( mustacheDiv.innerHTML, "", "initially, there is nothing inside the mustache-div" );
plus();
// Static strings
popped.mustache({
- start: 0, // seconds
- end: 2, // seconds
- template: '<h1>{{heading}}</h1>',
+ start: 0,
+ end: 2,
+ template: "<h1>{{heading}}</h1>",
data: '{"heading": "mustache - test 1/3"}',
- target: 'mustache-div',
+ target: "mustache-div",
dynamic: false
- } );
+ });
// Dynamic functions
popped.mustache({
- start: 2, // seconds
- end: 4, // seconds
- template: function(plugin, options) {
- return '<h1>{{heading}}</h1>';
+ start: 2,
+ end: 4,
+ template: function( plugin, options ) {
+ return "<h1>{{heading}}</h1>";
},
- data: function(plugin, options) {
- return JSON.parse('{"heading": "mustache - test 2/3"}');
+ data: function( plugin, options ) {
+ return JSON.parse( '{"heading": "mustache - test 2/3"}' );
},
- target: 'mustache-div',
- } );
+ target: "mustache-div",
+ });
// Template + Object literal
popped.mustache({
- start: 4, // seconds
- end: 5, // seconds
- template: function(plugin, options) {
- return '<h1>{{heading}}</h1>';
+ start: 4,
+ end: 5,
+ template: function( plugin, options ) {
+ return "<h1>{{heading}}</h1>";
},
- data: { heading: 'mustache - test 3/3' },
- target: 'mustache-div',
+ data: { heading: "mustache - test 3/3" },
+ target: "mustache-div",
dynamic: false
- } );
+ });
- var video = document.getElementById('video');
+ var video = document.getElementById( "video" );
var two = six = ten = false;
- video.addEventListener('timeupdate', function() {
+ video.addEventListener( "timeupdate", function() {
- function pass(a, b) {
- equals( mustacheDiv.innerHTML, '<h1>mustache - test ' + a + '/' + b + '<\/h1>','Mustache template rendered' );
+ function pass( a, b ) {
+ equals( mustacheDiv.innerHTML, "<h1>mustache - test " + a + "/" + b + "<\/h1>","Mustache template rendered" );
plus();
}
- var t = Math.floor(video.currentTime);
+ var t = Math.floor( video.currentTime );
- if (t === 1 && !two) {
- pass(1, 3);
+ if ( t === 1 && !two ) {
+ pass( 1, 3 );
two = true;
- } else if (t === 3 && !six) {
- pass(2, 3);
+ } else if ( t === 3 && !six ) {
+ pass( 2, 3 );
six = true;
- } else if (t === 4 && !ten) {
- pass(3, 3);
+ } else if ( t === 4 && !ten ) {
+ pass( 3, 3 );
ten = true;
}
- if (t === 6) {
+ if ( t === 6 ) {
video.pause();
}
try {
popped.mustache({});
} catch( e ) {
- ok(true, 'empty event was caught by debug');
+ ok( true, "empty event was caught by debug" );
plus();
}
- popped.volume(0);
+ popped.volume( 0 );
popped.play();
});
<script src="../../popcorn.js"></script>
<script src="popcorn.openmap.js"></script>
<script>
- document.addEventListener('DOMContentLoaded', function () {
- Popcorn('#video')
+ document.addEventListener( "DOMContentLoaded", function () {
+ Popcorn( "#video" )
.volume( 0 )
.play()
.openmap( {
start: 0,
end: 20,
- type: 'ROADMAP',
- target: 'map',
+ type: "ROADMAP",
+ target: "map",
lat: 43.665429,
lng: -79.403323,
zoom: "10"
- } )
+ })
.openmap( {
start: 0,
end: 30,
- type: 'SATELLITE',
- target: 'map2',
+ type: "SATELLITE",
+ target: "map2",
lat: 42.358544,
lng: -71.05957,
zoom: 9,
text: "Another clickable marker"
}
]
- } )
- .openmap( {
+ })
+ .openmap({
start: 0,
end: 20,
- type: 'TERRAIN',
- target: 'map3',
+ type: "TERRAIN",
+ target: "map3",
lat: 40.943926,
lng: -78.968525,
zoom: 14
- } );
+ });
}, false);
</script>
</head>
<p> An OpenLayers + NASA LandSat Map displaying Boston and a map marker will appear at 0 seconds and disappear at 30 seconds.</p>
<p> An OpenLayers + USGS Topographic Map displaying Punxsutawney, PA will appear at 0 seconds and disappear at 20 seconds.</p>
<div>
- <video id='video'
- controls
- width= '250px'
- poster="../../test/poster.png">
+ <video id="video"
+ controls
+ width= "250px"
+ poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
- type='video/mp4;' codecs="avc1, mp4a"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg;' codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
</video>
</div>
<div id="map3" style="position:relative;float:left;width:300px;height:400px"><p>Locations in this video:</p></div>
</div>
</body>
-</html>
\ No newline at end of file
+</html>
// PLUGIN: OPENMAP
( function ( Popcorn ) {
-
+
/**
- * openmap popcorn plug-in
+ * openmap popcorn plug-in
* Adds an OpenLayers map and open map tiles (OpenStreetMap [default], NASA WorldWind, or USGS Topographic)
* Based on the googlemap popcorn plug-in. No StreetView support
* Options parameter will need a start, end, target, type, zoom, lat and lng
* -Start is the time that you want this plug-in to execute
- * -End is the time that you want this plug-in to stop executing
+ * -End is the time that you want this plug-in to stop executing
* -Target is the id of the DOM element that you want the map to appear in. This element must be in the DOM
* -Type [optional] either: ROADMAP (OpenStreetMap), SATELLITE (NASA WorldWind / LandSat), or TERRAIN (USGS). ROADMAP/OpenStreetMap is the default.
* -Zoom [optional] defaults to 2
* --Lat and Lng are coordinates of the map marker if location is not specified
* --Location is a name of a place for the map marker, geocoded to coordinates using TinyGeocoder.com
* Note: using location requires extra loading time, also not specifying both lat/lng and location will
- * cause a JavaScript error.
+ * cause a JavaScript error.
* @param {Object} options
- *
+ *
* Example:
var p = Popcorn( '#video' )
.openmap({
function toggle( container, display ) {
if ( container.map ) {
-
+
container.map.div.style.display = display;
return;
}
Popcorn.getJSONP(
"http://tinygeocoder.com/create-api.php?q=" + options.location + "&callback=jsonp",
function( latlng ) {
- centerlonlat = new OpenLayers.LonLat( latlng[1], latlng[0] );
+ centerlonlat = new OpenLayers.LonLat( latlng[ 1 ], latlng[ 0 ] );
options.map.setCenter( centerlonlat );
}
);
displayProjection = new OpenLayers.Projection( "EPSG:4326" );
projection = new OpenLayers.Projection( "EPSG:4326" );
options.map = new OpenLayers.Map( {div: newdiv, projection: projection } );
- var relief = new OpenLayers.Layer.WMS( "USGS Terraserver", "http://terraserver-usa.org/ogcmap.ashx?", { layers: 'DRG' } );
+ var relief = new OpenLayers.Layer.WMS( "USGS Terraserver", "http://terraserver-usa.org/ogcmap.ashx?", { layers: 'DRG' } );
options.map.addLayer( relief );
} else {
// add OpenStreetMap layer
}
}
};
-
+
isGeoReady();
return {
-
+
/**
- * @member openmap
- * The setup function will be executed when the plug-in is instantiated
+ * @member openmap
+ * The setup function will be executed when the plug-in is instantiated
*/
_setup: function( options ) {
-
+
// insert openlayers api script once
if ( !window.OpenLayers ) {
Popcorn.getScript( "http://openlayers.org/api/OpenLayers.js" );
}
-
+
var isReady = function() {
// wait until OpenLayers has been loaded, and the start function is run, before adding map
if ( !options.map ) {
isReady();
}, 13 );
} else {
-
+
// default zoom is 2
options.zoom = options.zoom || 2;
-
+
// make sure options.zoom is a number
if ( options.zoom && typeof options.zoom !== "number" ) {
options.zoom = +options.zoom;
// reset the location and zoom just in case the user played with the map
options.map.setCenter( centerlonlat, options.zoom );
if ( options.markers ) {
- var layerStyle = OpenLayers.Util.extend( {} , OpenLayers.Feature.Vector.style[ 'default' ] ),
+ var layerStyle = OpenLayers.Util.extend( {} , OpenLayers.Feature.Vector.style[ "default" ] ),
featureSelected = function( clickInfo ) {
clickedFeature = clickInfo.feature;
if ( !clickedFeature.attributes.text ) {
clickedFeature.popup = popup;
popup.feature = clickedFeature;
options.map.addPopup( popup );
- },
+ },
featureUnSelected = function( clickInfo ) {
feature = clickInfo.feature;
if ( feature.popup ) {
myPointStyle.externalGraphic = myMarker.icon;
var myPointFeature = new OpenLayers.Feature.Vector( myPoint, null, myPointStyle );
if ( myMarker.text ) {
- myPointFeature.attributes = {
+ myPointFeature.attributes = {
text: myMarker.text
};
}
);
};
pointLayer = new OpenLayers.Layer.Vector( "Point Layer", { style: layerStyle } );
- options.map.addLayer( pointLayer );
+ options.map.addLayer( pointLayer );
for ( var m = 0, l = options.markers.length; m < l ; m++ ) {
var myMarker = options.markers[ m ];
if( myMarker.text ){
}
if ( myMarker.location ) {
var geocodeThenPlotMarker = gcThenPlotMarker;
- geocodeThenPlotMarker(myMarker);
+ geocodeThenPlotMarker( myMarker );
} else {
var myPoint = new OpenLayers.Geometry.Point( myMarker.lng, myMarker.lat ).transform( displayProjection, projection ),
myPointStyle = OpenLayers.Util.extend( {}, layerStyle );
myPointStyle.externalGraphic = myMarker.icon;
var myPointFeature = new OpenLayers.Feature.Vector( myPoint, null, myPointStyle );
if ( myMarker.text ) {
- myPointFeature.attributes = {
+ myPointFeature.attributes = {
text: myMarker.text
};
}
}
}
};
-
+
isReady();
},
-
+
/**
- * @member openmap
- * The start function will be executed when the currentTime
- * of the video reaches the start time provided by the
+ * @member openmap
+ * The start function will be executed when the currentTime
+ * of the video reaches the start time provided by the
* options variable
*/
start: function( event, options ) {
toggle( options, "block" );
},
-
+
/**
* @member openmap
- * The end function will be executed when the currentTime
- * of the video reaches the end time provided by the
+ * The end function will be executed when the currentTime
+ * of the video reaches the end time provided by the
* options variable
*/
end: function( event, options ) {
- toggle( options, "none" );
+ toggle( options, "none" );
},
-
+
_teardown: function( options ) {
target && target.removeChild( newdiv );
website: "mapadelsur.blogspot.com"
},
options:{
- start : { elem: 'input', type: 'text', label: 'In'},
- end : { elem: 'input', type: 'text', label: 'Out'},
- target : 'map-container',
- type : { elem: 'select', options:[ 'ROADMAP', 'SATELLITE', 'TERRAIN' ], label: 'Type' },
- zoom : { elem: 'input', type: 'text', label: 'Zoom'},
- lat : { elem: 'input', type: 'text', label: 'Lat'},
- lng : { elem: 'input', type: 'text', label: 'Lng'},
- location : { elem: 'input', type: 'text', label: 'Location'},
- markers : { elem: 'input', type: 'text', label: 'List Markers'}
+ start: {
+ elem: "input",
+ type: "text",
+ label: "In"
+ },
+ end: {
+ elem: "input",
+ type: "text",
+ label: "Out"
+ },
+ target: "map-container",
+ type: {
+ elem: "select",
+ options: [ "ROADMAP", "SATELLITE", "TERRAIN" ],
+ label: "Type"
+ },
+ zoom: {
+ elem: "input",
+ type: "text",
+ label: "Zoom"
+ },
+ lat: {
+ elem: "input",
+ type: "text",
+ label: "Lat"
+ },
+ lng: {
+ elem: "input",
+ type: "text",
+ label: "Lng"
+ },
+ location: {
+ elem: "input",
+ type: "text",
+ label: "Location"
+ },
+ markers: {
+ elem: "input",
+ type: "text",
+ label: "List Markers"
+ }
}
});
}) ( Popcorn );
<title>Popcorn Open Map Test</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
+ <!--
+ do not move - this must be called immediately prior to
popcorn-api-draft.js
-->
-
<script src="../../popcorn.js"></script>
<script src="popcorn.openmap.js"></script>
-
<script src="popcorn.openmap.unit.js"></script>
</head>
<body>
<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'
+ <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"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg;' codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
- <div id="map" style="position:relative;float:left;width:300px;height:400px"></div>
+ </video>
+ <div id="map" style="position:relative;float:left;width:300px;height:400px"></div>
<div id="map2" style="position:relative;float:left;width:300px;height:400px"></div>
<div id="map3" style="position:relative;float:left;width:300px;height:400px"></div>
<div id="map4" style="position:relative;float:left;width:300px;height:400px"></div>
test( "Popcorn OpenMap Plugin", function () {
-
- var popped = Popcorn("#video"),
- expects = 15,
+
+ var popped = Popcorn( "#video" ),
+ expects = 15,
count = 0;
-
- expect(expects);
-
+
+ expect( expects );
+
function plus() {
- if ( ++count===expects) {
+ if ( ++count===expects ) {
start();
}
}
-
+
stop();
- ok ('openmap' in popped, "openmap is a method of the popped instance");
+ ok ( "openmap" in popped, "openmap is a method of the popped instance" );
plus();
-
- ok ( document.getElementById('map').innerHTML === "", "initially, there is nothing inside map" );
+
+ ok ( document.getElementById( "map" ).innerHTML === "", "initially, there is nothing inside map" );
plus();
-
- ok ( document.getElementById('map2').innerHTML === "", "initially, there is nothing inside map2" );
+
+ ok ( document.getElementById( "map2" ).innerHTML === "", "initially, there is nothing inside map2" );
plus();
- ok ( document.getElementById('map3').innerHTML === "", "initially, there is nothing inside map3" );
+ ok ( document.getElementById( "map3" ).innerHTML === "", "initially, there is nothing inside map3" );
plus();
-
+
popped.openmap({
start: 0,
end: 4,
- type: 'ROADMAP',
- target: 'map',
+ type: "ROADMAP",
+ target: "map",
lat: 43.665429,
lng: -79.403323,
zoom: 10
- } )
+ })
.openmap({
start: 0,
end: 4,
- type: 'SATELLITE',
- target: 'map2',
+ type: "SATELLITE",
+ target: :map2",
lat: 40.943926,
lng: -78.968525,
zoom: 9
- } )
- .openmap( {
+ })
+ .openmap({
start: 0,
end: 4,
- type: 'TERRAIN',
- target: 'map3',
+ type: "TERRAIN",
+ target: "map3",
lat: 40.943926,
lng: -78.968525,
zoom: 14
- } )
- .openmap( {
+ })
+ .openmap({
start: 0,
end: 4,
- target: 'map4',
+ target: "map4",
lat: 40.943926,
lng: -78.968525,
zoom: "14"
- } )
- .volume(0)
+ })
+ .volume( 0 )
.play();
setupId = popped.getLastTrackEventId();
popped.exec( 3, function() {
- ok(OpenLayers, "OpenLayers is available");
+ ok( OpenLayers, "OpenLayers is available" );
plus();
- ok (document.getElementById('openmapdiv1'), "First map is on the page" );
+ ok ( document.getElementById( "openmapdiv1" ), "First map is on the page" );
plus();
- equals (document.getElementById('openmapdiv1').offsetParent.id, "map", "First map is inside the 'map' div" );
+ equals ( document.getElementById( "openmapdiv1" ).offsetParent.id, "map", "First map is inside the 'map' div" );
plus();
- ok (document.getElementById('openmapdiv2'), "Second map is on the page" );
+ ok ( document.getElementById( "openmapdiv2" ), "Second map is on the page" );
plus();
- equals (document.getElementById('openmapdiv2').offsetParent.id, "map2", "Second map is inside the 'map2' div" );
+ equals ( document.getElementById( "openmapdiv2" ).offsetParent.id, "map2", "Second map is inside the 'map2' div" );
plus();
- ok (document.getElementById('openmapdiv3'), "Third map is on the page" );
+ ok ( document.getElementById( "openmapdiv3" ), "Third map is on the page" );
plus();
- equals (document.getElementById('openmapdiv3').offsetParent.id, "map3", "Third map is inside the 'map3' div" );
+ equals ( document.getElementById( "openmapdiv3" ).offsetParent.id, "map3", "Third map is inside the 'map3' div" );
plus();
- ok (document.getElementById('openmapdiv4'), "Fourth map is on the page" );
+ ok ( document.getElementById( "openmapdiv4" ), "Fourth map is on the page" );
plus();
- equals (document.getElementById('openmapdiv4').offsetParent.id, "map4", "Fourth map is inside the 'map4' div" );
+ equals ( document.getElementById( "openmapdiv4" ).offsetParent.id, "map4", "Fourth map is inside the 'map4' div" );
plus();
} )
.exec( 5, function() {
- ok (document.getElementById('openmapdiv2').style.display === "none" &&
- document.getElementById('openmapdiv3').style.display === "none" &&
- document.getElementById('openmapdiv4').style.display === "none" &&
- document.getElementById('openmapdiv1').style.display === "none", "All three maps are no longer visible" );
+ ok ( document.getElementById( "openmapdiv2" ).style.display === "none" &&
+ document.getElementById( "openmapdiv3" ).style.display === "none" &&
+ document.getElementById( "openmapdiv4" ).style.display === "none" &&
+ document.getElementById( "openmapdiv1" ).style.display === "none", "All three maps are no longer visible" );
plus();
popped.pause().removeTrackEvent( setupId );
- ok( !document.getElementById('actualmap3'), "removed map was properly destroyed" );
+ ok( !document.getElementById( "actualmap3" ), "removed map was properly destroyed" );
plus();
- } );
-} );
+ });
+});
<source id="mp4"
src="../../test/trailer.mp4"
- type="video/mp4; codecs='avc1, mp4a'" />
+ type='video/mp4; codecs="avc1, mp4a"' />
<source id="ogv"
src="../../test/trailer.ogv"
- type="video/ogg; codecs='theora, vorbis'" />
+ type='video/ogg; codecs="theora, vorbis"' />
<p>Your user agent does not support the HTML5 Video element.</p>
<source id="mp4"
src="../../test/trailer.mp4"
- type="video/mp4; codecs='avc1, mp4a'" />
+ type='video/mp4; codecs="avc1, mp4a"' />
<source id="ogv"
src="../../test/trailer.ogv"
- type="video/ogg; codecs='theora, vorbis'" />
+ type='video/ogg; codecs="theora, vorbis"' />
<p>Your user agent does not support the HTML5 Video element.</p>
</video>
<source id="mp4"
src="../../test/trailer.mp4"
- type="video/mp4; codecs='avc1, mp4a'">
+ type='video/mp4; codecs="avc1, mp4a"'>
<source id="ogv"
src="../../test/trailer.ogv"
- type="video/ogg; codecs='theora, vorbis'">
+ type='video/ogg; codecs="theora, vorbis"'>
<p>Your user agent does not support the HTML5 Video element.</p>
</video>
<html>
<head>
-
+
<title>Popcorn processing Plug-in Simple Demo</title>
<script src="../../popcorn.js"></script>
<script src="popcorn.processing.js"></script>
-
+
<script>
document.addEventListener( "DOMContentLoaded", function () {
var p = Popcorn( "#video" )
</head>
<body>
<h1 id="qunit-header">Popcorn processing Plug-in Simple Demo</h1>
-
+
<div>
- <video id='video'
+ <video id="video"
controls preload="auto"
- width= '250px'
+ width= "250px"
poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
type='video/ogg; codecs="theora, vorbis"'>
* Processing Popcorn Plug-In
*
* This plugin adds a Processing.js sketch to be added to a target div or canvas.
- *
+ *
* Options parameter needs to specify start, end, target and sketch attributes
- * -Start is the time [in seconds] that you want the sketch to display and start looping.
+ * -Start is the time [in seconds] that you want the sketch to display and start looping.
* -End is the time [in seconds] you want the sketch to become hidden and stop looping.
* -Target is the id of the div or canvas you want the target sketch to be displayed in. ( a target that is a div will have a canvas created and placed inside of it. )
* -Sketch specifies the filename of the Procesing code to be loaded into Processing.js
Popcorn.plugin( "processing" , function ( options ) {
var init = function( context ) {
-
+
var initProcessing,
canvas;
}
options.parentTarget = document.getElementById( options.target );
-
+
if ( !options.parentTarget && Popcorn.plugin.debug ) {
throw new Error( "target container doesn't exist" );
}
-
+
initProcessing = function() {
var addListeners = function() {
context.listen( "pause", function () {
}
});
};
-
+
if ( window.Processing ) {
options.pjsInstance = new Processing( options.canvas, options.processingCode );
});
options._running && !context.media.paused && options.pjsInstance.loop();
-
+
options.noPause = options.noPause || false;
- !options.noPause && addListeners();
- options.codeReady = true;
+ !options.noPause && addListeners();
+ options.codeReady = true;
} else {
setTimeout ( function() {
initProcessing.call( this );
}, 10 );
}
};
-
+
canvas = document.createElement( "canvas" );
canvas.id = Popcorn.guid( options.target + "-sketch-" );
canvas[ "data-processing-sources" ] = options.sketch;
- canvas.style.display = "none";
+ canvas.style.display = "none";
options.canvas = canvas;
-
+
options.parentTarget && options.parentTarget.appendChild( options.canvas );
if ( options.sketch ) {
return {
_setup: function( options ) {
-
+
options.codeReady = false;
init( this );
},
end: function( event, options ) {
-
+
options.pjsInstance && options.pjsInstance.noLoop();
options.canvas.style.display = "none";
},
-
+
_teardown: function( options ) {
options.pjsInstance && options.pjsInstance.exit();
options.parentTarget && options.parentTarget.removeChild( options.canvas );
website: "cadecairos.blogspot.com, ben1amin.wordpress.org"
},
options: {
- start : { elem: "input", type: "text", label: "In" },
- end : { elem: "input", type: "text", label: "Out" },
- target : { elem: "input", type: "text", label: "Target" },
- sketch : { elem: "input", type: "text", label: "Sketch" },
- noPause : { elem: "select", options: [ "TRUE", "FALSE" ], label: "No Loop" }
+ start: {
+ elem: "input",
+ type: "text",
+ label: "In"
+ },
+ end: {
+ elem: "input",
+ type: "text",
+ label: "Out"
+ },
+ target: {
+ elem: "input",
+ type: "text",
+ label: "Target"
+ },
+ sketch: {
+ elem: "input",
+ type: "text",
+ label: "Sketch"
+ },
+ noPause: {
+ elem: "select",
+ options: [ "TRUE", "FALSE" ],
+ label: "No Loop"
+ }
}
});
}( Popcorn ));
<html>
<head>
-
+
<title>Popcorn processing unit Tests</title>
<link rel="stylesheet" href="../../test/qunit/qunit.css" type="text/css" media="screen">
<script src="../../test/qunit/qunit.js"></script>
-
+
<script src="../../popcorn.js"></script>
<script src="popcorn.processing.js"></script>
<script src="popcorn.processing.unit.js"></script>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"> </div>
<div>
- <video id='video'
- controls preload='none'
- width= '250px'
+ <video id="video"
+ controls preload="none"
+ width= "250px"
poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
type='video/ogg; codecs="theora, vorbis"'>
trackids = [];
expect( expects );
-
+
function plus() {
if ( ++count === expects ) {
start();
}
}
-
+
stop();
-
+
ok( "processing" in popped, "processing is a method of the popped instance" );
plus();
equals( processingDiv.innerHTML, "", "'processing-div-1' is empty" );
plus();
-
+
equals( processingDiv2.innerHTML, "", "'processing-div-2' is empty" );
plus();
-
+
equals( processingDiv3.innerHTML, "", "'processing-div-3' is empty" );
plus();
-
+
equals( processingDiv4.innerHTML, "", "'processing-div-4' is empty" );
plus();
sketch: "test.pjs"
});
trackids.push( popped.getLastTrackEventId() );
-
+
popped.processing({
start: 1,
end: 3,
sketch: "test2.pjs"
});
trackids.push( popped.getLastTrackEventId() );
-
+
popped.processing({
start: 3,
end: 4,
sketch: "test2.pjs"
});
trackids.push( popped.getLastTrackEventId() );
-
+
popped.exec( 0.5, function() {
equals( processingDiv.children[ 0 ].style.display, "inline", "canvas '" + processingDiv.children[ 0 ].id + "' is displayed" );
plus();
plus();
equals( processingDiv4.children[ 0 ].style.display, "none", "canvas '" + processingDiv4.children[ 0 ].id + "' is hidden" );
plus();
- //TODO: David Humphrey has written code that allows for listening to events on Processing instances. when
+ //TODO: David Humphrey has written code that allows for listening to events on Processing instances. when
// it lands In the next processing release we'll be able to detect if a processing instance is looping or not.
// this is required in order to test the noPause functionality (automatically)
})
plus();
equals( processingDiv4.children[ 0 ].style.display, "inline", "canvas '" + processingDiv4.children[ 0 ].id + "' is displayed" );
plus();
- }).exec( 4.5, function() {
+ }).exec( 4.5, function() {
var idx = 5;
while ( --idx ) {
popped.removeTrackEvent( trackids.pop() );
plus();
}
});
-
+
ok( "processing" in popped, "processing is a method of the popped instance" );
plus();
-
+
//check that four canvases were created
- canvases = document.querySelectorAll( "canvas" );
+ canvases = document.querySelectorAll( "canvas" );
equals( canvases.length, 4, "four canvases are present" );
plus();
//enable this when ticket #583 lands
//Popcorn.forEach( canvases, function( ctx, idx ) {
[].forEach.call( canvases, function( ctx ) {
-
+
var idCount = 0, i = -1, len = canvases.length;
for ( ; ++i < len; ){
if ( ctx.id === canvases[ i ].id ) {
ok(true, 'empty event was caught by debug');
plus();
}
-
+
popped.play();
});
<html>
<head>
<title>Popcorn Subtitle Plug-in Demo</title>
-
<script src="../../popcorn.js"></script>
-
<script src="popcorn.subtitle.js"></script>
<script>
- document.addEventListener('DOMContentLoaded', function () {
- var p = Popcorn('#video')
- .volume(0)
- .play()
+ document.addEventListener( "DOMContentLoaded", function () {
+ var p = Popcorn( "#video" )
+ .volume( 0 )
+ .play()
.subtitle({
- start: 5, // seconds
- end: 15, // seconds
- text: 'this is the first subtitle of 2011',
- } )
+ start: 5,
+ end: 15,
+ text: "this is the first subtitle of 2011",
+ })
.subtitle({
- start: 20, // seconds
- end: 45, // seconds
- text: 'this is the second subtitle of 2011',
- } )
-
+ start: 20,
+ end: 45,
+ text: "this is the second subtitle of 2011",
+ })
}, false);
-
</script>
</head>
<body>
<p> A subtitle displaying 'this is the second subtitle of 2011' will appear at 20 seconds and disappear at 45 seconds.</p>
<div>
- <video id='video'
+ <video id="video"
controls height="480" width="854"
- poster="../../test/poster.png">
+ poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
- type='video/mp4; codecs="avc1, mp4a"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
+ </video>
</div>
</body>
};
/**
- * Subtitle popcorn plug-in
+ * Subtitle popcorn plug-in
* Displays a subtitle over the video, or in the target div
* Options parameter will need a start, and end.
* Optional parameters are target and text.
* Text is the text of the subtitle you want to display.
*
* @param {Object} options
- *
+ *
* Example:
var p = Popcorn('#video')
.subtitle({
*/
Popcorn.plugin( "subtitle" , {
-
+
manifest: {
about: {
name: "Popcorn Subtitle Plugin",
},
options: {
start: {
- elem: "input",
- type: "text",
+ elem: "input",
+ type: "text",
label: "In"
},
end: {
- elem: "input",
- type: "text",
+ elem: "input",
+ type: "text",
label: "Out"
},
target: "subtitle-container",
text: {
- elem: "input",
- type: "text",
+ elem: "input",
+ type: "text",
label: "Text"
}
}
newdiv.style.display = "none";
// Creates a div for all subtitles to use
- ( !this.container && ( !options.target || options.target === "subtitle-container" ) ) &&
+ ( !this.container && ( !options.target || options.target === "subtitle-container" ) ) &&
createDefaultContainer( this );
// if a target is specified, use that
if ( options.target && options.target !== "subtitle-container" ) {
options.container = document.getElementById( options.target );
- } else {
+ } else {
// use shared default container
options.container = this.container;
}
};
},
/**
- * @member subtitle
- * The start function will be executed when the currentTime
- * of the video reaches the start time provided by the
+ * @member subtitle
+ * The start function will be executed when the currentTime
+ * of the video reaches the start time provided by the
* options variable
*/
start: function( event, options ){
options.showSubtitle( options, options.text );
},
/**
- * @member subtitle
- * The end function will be executed when the currentTime
- * of the video reaches the end time provided by the
+ * @member subtitle
+ * The end function will be executed when the currentTime
+ * of the video reaches the end time provided by the
* options variable
*/
end: function( event, options ) {
_teardown: function ( options ) {
options.container.removeChild( options.innerContainer );
}
-
+
});
})( Popcorn );
<title>Popcorn Subtitle Plug-in Test</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
+ <!--
+ do not move - this must be called immediately prior to
popcorn-api-draft.js
-->
-
<script src="../../popcorn.js"></script>
-
<script src="popcorn.subtitle.js"></script>
<script src="popcorn.subtitle.unit.js"></script>
</head>
<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'
+ <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"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
</video>
- <video id='video2'
- controls preload='none'
- width= '250px'
- poster="../../test/poster.png">
+ <video id="video2"
+ controls preload="none"
+ width= "250px"
+ poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
- type='video/mp4; codecs="avc1, mp4a"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
+ </video>
</body>
</html>
-test("Popcorn Subtitle Plugin", function () {
-
+test( "Popcorn Subtitle Plugin", function () {
+
var popped = Popcorn( "#video" ),
popped2 = Popcorn( "#video2" ),
expects = 12,
subLeft = 9001,
subtitlediv,
subtitle2div;
-
- expect(expects);
-
+
+ expect( expects );
+
function plus() {
if ( ++count === expects ) {
start();
}
}
-
+
stop( 12000 );
-
- ok ( 'subtitle' in popped, "subtitle is a method of the popped instance" );
+
+ ok ( "subtitle" in popped, "subtitle is a method of the popped instance" );
plus();
-
+
popped.subtitle({
start: 0,
end: 2,
- text: 'this is the first subtitle of 2011',
- } )
+ text: "this is the first subtitle of 2011",
+ })
.subtitle({
start: 2,
end: 4,
- text: 'this is the second subtitle of 2011',
- } )
+ text: "this is the second subtitle of 2011",
+ })
.subtitle({
start: 5,
end: 7,
- text: 'this is the third subtitle of 2011',
+ text: "this is the third subtitle of 2011",
} )
- .volume(0)
+ .volume( 0 )
.play();
subtitlediv = popped.getTrackEvent( popped.getLastTrackEventId() ).container;
popped.subtitle({
start: 7,
end: 9,
- text: 'instance one test'
+ text: "instance one test"
});
popped2.subtitle({
start: 7,
end: 9,
- text: 'instance two test'
+ text: "instance two test"
})
- .volume(0)
+ .volume( 0 )
.play().pause();
subtitle2div = popped2.getTrackEvent( popped2.getLastTrackEventId() ).container;
popped.exec( 1, function() {
-
+
popped.media.pause();
equals( subtitlediv.children[ 0 ].innerHTML, "this is the first subtitle of 2011", "subtitle displaying correct information" );
plus();
-
-
+
// capturing location now, to check against later,
// a subtitle must be displayed to get valid data
// which is why we do this in exec
subLeft = subtitlediv.style.left;
subTop = subtitlediv.style.top;
-
+
// changing position
popped.media.style.position = "absolute";
popped.media.style.left = "400px";
popped.media.style.top = "600px";
popped.media.play();
-
+
});
-
+
popped.exec( 3, function() {
-
+
popped.media.pause();
// check position of subttile that should of moved with video,
plus();
ok( subtitlediv.style.top !== subTop, "subtitle's top position has changed" );
plus();
-
+
// we know values have changed, but how accurate are they?
// check values against the video's values
// we need four checks because if we just check against video's position,
plus();
ok( Popcorn.position( subtitlediv ).top > popped.position().top, "subtitle top position moved" );
plus();
-
- equals (subtitlediv.children[ 1 ].innerHTML, "this is the second subtitle of 2011", "subtitle displaying correct information" );
+
+ equals ( subtitlediv.children[ 1 ].innerHTML, "this is the second subtitle of 2011", "subtitle displaying correct information" );
plus();
popped.media.play();
-
+
});
-
+
popped.exec( 4, function() {
-
+
popped.media.pause();
- equals (subtitlediv.children[ 1 ].innerHTML, "", "subtitle is clear" );
+ equals ( subtitlediv.children[ 1 ].innerHTML, "", "subtitle is clear" );
plus();
popped.media.play();
-
+
});
popped.exec( 8, function() {
popped2.exec( 8, function() {
popped2.media.pause();
- equals (subtitlediv.children[ 3 ].innerHTML, "instance one test", "subtitle displaying correct information" );
+ equals ( subtitlediv.children[ 3 ].innerHTML, "instance one test", "subtitle displaying correct information" );
plus();
- equals (subtitle2div.children[ 0 ].innerHTML, "instance two test", "subtitle displaying correct information" );
+ equals ( subtitle2div.children[ 0 ].innerHTML, "instance two test", "subtitle displaying correct information" );
plus();
popped.media.play();
});
popped.exec( 10, function() {
- ok ( document.getElementById( 'subtitle-0' ).style.display === "none" &&
- document.getElementById( 'subtitle-1' ).style.display === "none" &&
- document.getElementById( 'subtitle-2' ).style.display === "none", "All subtitles are no longer visible" );
+ ok ( document.getElementById( "subtitle-0" ).style.display === "none" &&
+ document.getElementById( "subtitle-1" ).style.display === "none" &&
+ document.getElementById( "subtitle-2" ).style.display === "none", "All subtitles are no longer visible" );
plus();
popped.pause().removeTrackEvent( popped.data.trackEvents.byStart[ 6 ]._id );
- ok( !document.getElementById( 'subtitle-2' ), "removed subtitle div was properly destroyed" );
+ ok( !document.getElementById( "subtitle-2" ), "removed subtitle div was properly destroyed" );
plus();
});
});
-
<source id="mp4"
src="../../test/trailer.mp4"
- type="video/mp4; codecs='avc1, mp4a'">
+ type='video/mp4; codecs="avc1, mp4a"'>
<source id="ogv"
src="../../test/trailer.ogv"
- type="video/ogg; codecs='theora, vorbis'">
+ type='video/ogg; codecs="theora, vorbis"'>
<p>Your user agent does not support the HTML5 Video element.</p>
<source id="mp4"
src="../../test/trailer.mp4"
- type="video/mp4; codecs='avc1, mp4a'">
+ type='video/mp4; codecs="avc1, mp4a"'>
<source id="ogv"
src="../../test/trailer.ogv"
- type="video/ogg; codecs='theora, vorbis'">
+ type='video/ogg; codecs="theora, vorbis"'>
<p>Your user agent does not support the HTML5 Video element.</p>
<html>
<head>
<title>Popcorn Google Feed Plug-in Demo</title>
-
+
<script src="../../popcorn.js"></script>
<script src="popcorn.timeline.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
var p = Popcorn('#video')
- .volume(0)
+ .volume( 0 )
.play()
.timeline({
- start: 1, // seconds
+ start: 1,
target: "timeline",
title: "This is a title",
text: "this is some interesting text that goes inside",
innerHTML: "Click here for <a href='http://www.google.ca'>Google</a>" ,
direction: "up"
- } )
+ })
.timeline({
- start: 3, // seconds
+ start: 3,
target: "timeline",
title: "double as interesting",
text: "this is some interesting text that goes inside",
innerHTML: "Maybe a button? <button onClick=\"window.location.href='http://www.google.com'\">Click Me</button>",
direction: "up"
- } )
+ })
.timeline({
- start: 7, // seconds
+ start: 7,
end: 700,
target: "timeline",
title: "3x as interesting",
text: "this is some interesting text that goes inside",
innerHTML: "",
direction: "up"
- } )
+ })
.timeline({
- start: 1, // seconds
+ start: 1,
target: "timeline2",
title: "This is a title",
text: "this is some interesting text that goes inside",
innerHTML: "Click here for <a href='http://www.google.ca'>Google</a>" ,
direction: "down"
- } )
+ })
.timeline({
- start: 3, // seconds
+ start: 3,
target: "timeline2",
title: "double as interesting",
text: "this is some interesting text that goes inside",
innerHTML: "Maybe a button? <button onClick=\"window.location.href='http://www.google.com'\">Click Me</button>",
direction: "down"
- } )
+ })
.timeline({
- start: 7, // seconds
+ start: 7,
end: 700,
target: "timeline2",
title: "3x as interesting",
text: "this is some interesting text that goes inside",
innerHTML: "",
direction: "down"
- } )
+ })
}, false);
</script>
</head>
<h1 id="qunit-header">Popcorn Timeline Plug-in Demo</h1>
<p>Continuos timeline elements will be added to the div throughout the video</p>
<div>
- <video id='video'
+ <video id="video"
controls
- width= '250px'
+ width= "250px"
poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
type='video/ogg; codecs="theora, vorbis"'>
container.insertBefore( contentDiv, container.firstChild );
}
else {
-
+
container.appendChild( contentDiv );
}
} else if ( Popcorn.plugin.debug ) {
throw new Error( "target container doesn't exist" );
}
-
+
i++;
// Default to empty if not used
- //options.innerHTML = options.innerHTML || "";
+ //options.innerHTML = options.innerHTML || "";
contentDiv.innerHTML = "<p><span id='big'>" + options.title + "</span><br />" +
"<span id='mid'>" + options.text + "</span><br />" + options.innerHTML;
-
+
return {
start: function( event, options ) {
contentDiv.style.display = "block";
-
+
if( options.direction === "down" ) {
container.scrollTop = container.scrollHeight;
}
},
-
+
end: function( event, options ) {
contentDiv.style.display = "none";
},
},
options: {
- start: {
+ start: {
elem: "input",
type: "text",
label: "In"
},
target: "feed-container",
title: {
- elem: "input",
- type: "text",
- label: "title"
+ elem: "input",
+ type: "text",
+ label: "title"
},
text: {
- elem: "input",
- type: "text",
- label: "text"
+ elem: "input",
+ type: "text",
+ label: "text"
},
- innerHTML: {
- elem: "input",
- type: "text",
- label: "innerHTML"
+ innerHTML: {
+ elem: "input",
+ type: "text",
+ label: "innerHTML"
},
direction: {
elem: "input",
}
}
});
-
+
})( Popcorn );
<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
+ <!--
+ do not move - this must be called immediately prior to
popcorn-api-draft.js
-->
-
+
<script src="../../popcorn.js"></script>
<script src="popcorn.timeline.js"></script>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"> </div>
-
- <video id='video'
- controls preload='none'
- width= '250px'
+
+ <video id="video"
+ controls preload="none"
+ width= "250px"
poster="../../test/poster.png"
- style="float: left;">
+ style="float: left;">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
- type='video/mp4; codecs="avc1, mp4a"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
+ </video>
<div id="timeline-up" style="float:left;width:400px;height:200px;overflow:auto"></div>
<div id="timeline-down" style="float:left;width:400px;height:200px;overflow:auto"></div>
</body>
-test("Popcorn Timeline Plugin", function () {
-
+test( "Popcorn Timeline Plugin", function () {
+
var popped = Popcorn( "#video" ),
expects = 17,
- upIds = downIds = [],
+ upIds = downIds = [],
count = 0,
timelineUp = document.getElementById( "timeline-up" ),
timelineDown = document.getElementById( "timeline-down" );
-
+
expect( expects );
-
+
function plus() {
if ( ++count === expects ) {
start();
}
}
-
+
stop();
ok ( "timeline" in popped, "timeline is a method of the popped instance" );
plus();
equals ( document.getElementById( "timeline-down" ).firstChild, undefined, "initially, there is nothing inside the 'timeline-down' feed" );
plus();
-
+
popped.timeline({
- start: 1, // seconds
+ start: 1,
target: "timeline-up",
title: "This is a title",
text: "this is some interesting text that goes inside",
innerHTML: "Click here for <a href='http://www.google.ca'>Google</a>"
- } );
+ });
upIds.push( popped.getLastTrackEventId() );
-
+
popped.timeline({
- start: 2, // seconds
+ start: 2,
target: "timeline-up",
title: "double as interesting",
text: "this is some interesting text that goes inside",
- innerHTML: "Maybe a button? <button onClick=\"window.location.href='http://www.google.com'\">Click Me</button>"
- } );
+ innerHTML: "Maybe a button? <button onClick=\"window.location.href='http://www.google.com'\">Click Me</button>"
+ });
upIds.push( popped.getLastTrackEventId() );
-
+
popped.timeline({
- start: 1, // seconds
+ start: 1,
target: "timeline-down",
title: "This is a title",
text: "this is some interesting text that goes inside",
innerHTML: "Maybe a button? <button onClick=\"window.location.href='http://www.google.com'\">Click Me</button>",
direction: "down"
- } );
+ });
downIds.push( popped.getLastTrackEventId() );
-
+
popped.timeline({
- start: 2, // seconds
+ start: 2,
target: "timeline-down",
title: "double as interesting",
text: "this is some interesting text that goes inside",
innerHTML: "Maybe a button? <button onClick=\"window.location.href='http://www.google.com'\">Click Me</button>",
direction: "down"
- } );
+ });
downIds.push( popped.getLastTrackEventId() );
-
- popped.volume(0);
-
+
+ popped.volume( 0 );
+
popped.exec( 1.5, function() {
//up
ok ( document.getElementById( "timelineDiv1" ), "First timeline is on the page" );
plus();
equals ( document.getElementById("timelineDiv1" ).parentNode.parentNode.id, "timeline-up", "First timeline is inside the 'timeline-up' div" );
plus();
-
+
//down
ok ( document.getElementById( "timelineDiv3" ), "First timeline is on the page" );
plus();
equals ( document.getElementById("timelineDiv3" ).parentNode.parentNode.id, "timeline-down", "First Timeline is inside the 'timeline-down' div" );
plus();
-
+
});
popped.exec( 2.5, function() {
//up
plus();
equals ( timelineUp.firstChild.firstChild.id, "timelineDiv2", "'timelineDiv2' is the first child in 'timeline-up'" );
plus();
-
+
//down
-
+
ok ( timelinediv4, "Second down timeline is on the page" );
plus();
equals ( timelinediv4.parentNode.parentNode.id, "timeline-down", "timelineDiv4 is inside the 'timeline-down' div" );
plus();
});
popped.exec( 4, function() {
- ok (document.getElementById( "timelineDiv1" ).style.display !== "none" &&
+ ok ( document.getElementById( "timelineDiv1" ).style.display !== "none" &&
document.getElementById( "timelineDiv2" ).style.display !== "none", "Both timelines in 'timeline-up are not visible" );
plus();
-
- ok (document.getElementById( "timelineDiv3" ).style.display !== "none" &&
+
+ ok ( document.getElementById( "timelineDiv3" ).style.display !== "none" &&
document.getElementById( "timelineDiv4" ).style.display !== "none", "Both timelines in 'timeline-down' are not visible" );
plus();
-
+
var uid, did;
while ( uid = upIds.pop() ) {
popped.removeTrackEvent( uid );
while ( did = downIds.pop() ) {
popped.removeTrackEvent( did );
}
-
+
popped.pause();
equals( document.getElementById( "timeline-up" ).firstChild, null, "removed timeline was properly destroyed" );
plus();
equals( document.getElementById( "timeline-down" ).firstChild, null, "removed timeline was properly destroyed" );
plus();
});
-
+
popped.play();
-
+
});
<html>
<head>
<title>Popcorn Twitter Plug-in Demo</title>
-
<script src="../../popcorn.js"></script>
-
<script src="popcorn.twitter.js"></script>
<script>
- document.addEventListener('DOMContentLoaded', function () {
- var p = Popcorn('#video')
+ document.addEventListener( "DOMContentLoaded", function () {
+ var p = Popcorn( "#video" )
.twitter({
- start: 5, // seconds
- end: 15, // seconds
- title: 'Steve Song',
- src: '@stevesong',
- target: 'twitterdiv',
- } )
+ start: 5,
+ end: 15,
+ title: "Steve Song",
+ src: "@stevesong",
+ target: "twitterdiv",
+ })
.twitter({
- start: 20, // seconds
- end: 45, // seconds
- title: 'Oil Spill',
- src: '#oilspill',
- target: 'twitterdiv'
- } )
+ start: 20,
+ end: 45,
+ title: "Oil Spill",
+ src: "#oilspill",
+ target: "twitterdiv"
+ })
.play();
}, false);
-
</script>
</head>
<body>
<p>Twitter profile '@stevesong' widget will appear at 5 seconds and disappear at 15 seconds.</p>
<p>More Twitter hash '#oilspill' widget will appear at 20 seconds and disappear at 45 seconds.</p>
<div>
- <video id='video'
+ <video id="video"
controls
- width= '250px'
- poster="../../test/poster.png">
+ width= "250px"
+ poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
- type='video/mp4; codecs="avc1, mp4a"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
+ </video>
</div>
<div id="twitterdiv"></div>
</body>
// PLUGIN: TWITTER
-(function (Popcorn) {
+(function ( Popcorn ) {
var scriptLoading = false;
/**
- * Twitter popcorn plug-in
+ * Twitter popcorn plug-in
* Appends a Twitter widget to an element on the page.
* Options parameter will need a start, end, target and source.
* Optional parameters are height and width.
* appended to, this target element must exist on the DOM
* Height is the height of the widget, defaults to 200
* Width is the width of the widget, defaults to 250
- *
+ *
* @param {Object} options
- *
+ *
* Example:
var p = Popcorn('#video')
.twitter({
manifest: {
about:{
- name: "Popcorn Twitter Plugin",
+ name: "Popcorn Twitter Plugin",
version: "0.1",
- author: "Scott Downe",
+ author: "Scott Downe",
website: "http://scottdowne.wordpress.com/"
},
options:{
- start : {elem:'input', type:'number', label:'In'},
- end : {elem:'input', type:'number', label:'Out'},
- src : {elem:'input', type:'text', label:'Source'},
- target : 'twitter-container',
- height : {elem:'input', type:'number', label:'Height'},
- width : {elem:'input', type:'number', label:'Width'}
+ start: {
+ elem: "input",
+ type: "number",
+ label: "In"
+ },
+ end: {
+ elem: "input",
+ type: "number",
+ label: "Out"
+ },
+ src: {
+ elem: "input",
+ type: "text",
+ label: "Source"
+ },
+ target: "twitter-container",
+ height: {
+ elem: "input",
+ type: "number",
+ label: "Height"
+ },
+ width: {
+ elem: "input",
+ type: "number",
+ label: "Width"
+ }
}
},
if ( !window.TWTR && !scriptLoading ) {
scriptLoading = true;
- Popcorn.getScript("http://widgets.twimg.com/j/2/widget.js");
+ Popcorn.getScript( "http://widgets.twimg.com/j/2/widget.js" );
}
var target = document.getElementById( options.target );
-
+ // create the div to store the widget
// setup widget div that is unique per track
- options.container = document.createElement( 'div' ); // create the div to store the widget
- options.container.setAttribute('id', Popcorn.guid()); // use this id to connect it to the widget
- options.container.style.display = "none"; // display none by default
+ options.container = document.createElement( "div" );
+ // use this id to connect it to the widget
+ options.container.setAttribute( "id", Popcorn.guid());
+ // display none by default
+ options.container.style.display = "none";
if ( !target && Popcorn.plugin.debug ) {
throw new Error( "target container doesn't exist" );
target && target.appendChild( options.container );
// setup info for the widget
- var src = options.src || "",
- width = options.width || 250,
- height = options.height || 200,
+ var src = options.src || "",
+ width = options.width || 250,
+ height = options.height || 200,
profile = /^@/.test( src ),
- hash = /^#/.test( src ),
+ hash = /^#/.test( src ),
widgetOptions = {
version: 2,
- id: options.container.getAttribute( 'id' ), // use this id to connect it to the div
+ // use this id to connect it to the div
+ id: options.container.getAttribute( "id" ),
rpp: 30,
width: width,
height: height,
interval: 6000,
theme: {
shell: {
- background: '#ffffff',
- color: '#000000'
+ background: "#ffffff",
+ color: "#000000"
},
tweets: {
- background: '#ffffff',
- color: '#444444',
- links: '#1985b5'
+ background: "#ffffff",
+ color: "#444444",
+ links: "#1985b5"
}
},
features: {
},
/**
- * @member Twitter
- * The start function will be executed when the currentTime
- * of the video reaches the start time provided by the
+ * @member Twitter
+ * The start function will be executed when the currentTime
+ * of the video reaches the start time provided by the
* options variable
*/
start: function( event, options ) {
},
/**
- * @member Twitter
- * The end function will be executed when the currentTime
- * of the video reaches the end time provided by the
+ * @member Twitter
+ * The end function will be executed when the currentTime
+ * of the video reaches the end time provided by the
* options variable
*/
end: function( event, options ) {
<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
+ <!--
+ do not move - this must be called immediately prior to
popcorn-api-draft.js
-->
-
<script src="../../popcorn.js"></script>
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script src="popcorn.twitter.js"></script>
-
<script src="popcorn.twitter.unit.js"></script>
</head>
<body>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"> </div>
-
- <video id='video'
- controls
- width= '250px'
- poster="../../test/poster.png">
- <source id='mp4'
+ <video id="video"
+ controls
+ width= "250px"
+ poster="../../test/poster.png">
+
+ <source id="mp4"
src="../../test/trailer.mp4"
- type='video/mp4; codecs="avc1, mp4a"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
- <div id="twitterdiv"></div>
+ </video>
+ <div id="twitterdiv"></div>
</body>
</html>
-test("Popcorn Twitter Plugin", function () {
-
- var popped = Popcorn("#video"),
- expects = 7,
+test( "Popcorn Twitter Plugin", function () {
+
+ var popped = Popcorn( "#video" ),
+ expects = 7,
count = 0,
setupId,
- twitterdiv = document.getElementById('twitterdiv');
-
+ twitterdiv = document.getElementById( "twitterdiv" );
+
expect( expects );
-
+
function plus() {
- if ( ++count === expects) {
+ if ( ++count === expects ) {
start();
}
}
- stop();
-
- ok('twitter' in popped, "twitter is a method of the popped instance");
+ stop();
+
+ ok( "twitter" in popped, "twitter is a method of the popped instance" );
plus();
equals ( twitterdiv.innerHTML, "", "initially, there is nothing inside the twitterdiv" );
plus();
-
+
try {
-
- ok( TWTR, "Twitter constructor exists");
+
+ ok( TWTR, "Twitter constructor exists" );
plus();
-
- } catch (e) {};
+
+ } catch ( e ) {};
popped.twitter({
- start: 1, // seconds
- end: 2, // seconds
- title: 'Steve Song',
- src: '@stevesong',
- target: 'twitterdiv',
+ start: 1,
+ end: 2,
+ title: "Steve Song",
+ src: "@stevesong",
+ target: "twitterdiv",
});
setupId = popped.getLastTrackEventId();
plus();
popped.pause().removeTrackEvent( setupId );
- ok( !twitterdiv.children[0], "removed twitter was properly destroyed" );
+ ok( !twitterdiv.children[ 0 ], "removed twitter was properly destroyed" );
plus();
});
-
+
popped.play();
-
+
});
<script src="../../popcorn.js"></script>
<script src="popcorn.webpage.js"></script>
<script>
- document.addEventListener('DOMContentLoaded', function () {
- var p = Popcorn('#video')
+ document.addEventListener( "DOMContentLoaded", function () {
+ var p = Popcorn( "#video" )
.volume( 0 )
.play()
.webpage({
<source id="mp4"
src="../../test/trailer.mp4"
- type="video/mp4; codecs='avc1, mp4a'">
+ type='video/mp4; codecs="avc1, mp4a"'>
<source id="ogv"
src="../../test/trailer.ogv"
- type="video/ogg; codecs='theora, vorbis'">
+ type='video/ogg; codecs="theora, vorbis"'>
<p>Your user agent does not support the HTML5 Video element.</p>
*/
Popcorn.plugin( "webpage" , {
manifest: {
- about:{
+ about: {
name: "Popcorn Webpage Plugin",
version: "0.1",
author: "@annasob",
website: "annasob.wordpress.com"
},
- options:{
- id : {elem:'input', type:'text', label:'Id'},
- start : {elem:'input', type:'text', label:'In'},
- end : {elem:'input', type:'text', label:'Out'},
- src : {elem:'input', type:'text', label:'Src'},
- target : 'iframe-container'
+ options: {
+ id: {
+ elem: "input",
+ type: "text",
+ label: "Id"
+ },
+ start: {
+ elem: "input",
+ type: "text",
+ label: "In"
+ },
+ end: {
+ elem: "input",
+ type: "text",
+ label: "Out"
+ },
+ src: {
+ elem: "input",
+ type: "text",
+ label: "Src"
+ },
+ target: "iframe-container"
}
},
_setup : function( options ) {
var target = document.getElementById( options.target );
// make an iframe
- options._iframe = document.createElement( 'iframe' );
- options._iframe.setAttribute('width', "100%");
- options._iframe.setAttribute('height', "100%");
- options._iframe.id = options.id;
+ options._iframe = document.createElement( "iframe" );
+ options._iframe.setAttribute( "width", "100%" );
+ options._iframe.setAttribute( "height", "100%" );
+ options._iframe.id = options.id;
options._iframe.src = options.src;
- options._iframe.style.display = 'none';
+ options._iframe.style.display = "none";
if ( !target && Popcorn.plugin.debug ) {
throw new Error( "target container doesn't exist" );
}
// add the hidden iframe to the DOM
- target && target.appendChild(options._iframe);
-
+ target && target.appendChild( options._iframe );
+
},
/**
- * @member webpage
- * The start function will be executed when the currentTime
- * of the video reaches the start time provided by the
+ * @member webpage
+ * The start function will be executed when the currentTime
+ * of the video reaches the start time provided by the
* options variable
*/
- start: function(event, options){
+ start: function( event, options ){
// make the iframe visible
options._iframe.src = options.src;
- options._iframe.style.display = 'inline';
+ options._iframe.style.display = "inline";
},
/**
- * @member webpage
- * The end function will be executed when the currentTime
- * of the video reaches the end time provided by the
+ * @member webpage
+ * The end function will be executed when the currentTime
+ * of the video reaches the end time provided by the
* options variable
*/
- end: function(event, options){
+ end: function( event, options ){
// make the iframe invisible
- options._iframe.style.display = 'none';
+ options._iframe.style.display = "none";
},
_teardown: function( options ) {
<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
+ <!--
+ do not move - this must be called immediately prior to
popcorn-api-draft.js
-->
-
+
<script src="../../popcorn.js"></script>
<script src="popcorn.webpage.js"></script>
<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'
+ <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"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
- <div id="webpagediv"></div>
+ </video>
+ <div id="webpagediv"></div>
</body>
</html>
<script src="../../popcorn.js"></script>
<script src="popcorn.wikipedia.js"></script>
<script>
- document.addEventListener('DOMContentLoaded', function () {
- var p = Popcorn('#video')
- .volume(0)
+ document.addEventListener( "DOMContentLoaded", function () {
+ var p = Popcorn( "#video' )
+ .volume( 0 )
.play()
.wikipedia({
- start: 0, // seconds
- end: 10, // seconds
- src: 'http://en.wikipedia.org/wiki/Cape_Town',
+ start: 0,
+ end: 10,
+ src: "http://en.wikipedia.org/wiki/Cape_Town",
title: "this is an article",
- target: 'wikidiv'
+ target: "wikidiv"
})
.wikipedia({
- start: 7, // seconds
- end: 20, // seconds
- src: 'http://en.wikipedia.org/wiki/S%C3%A3o_Paulo',
- target: 'wikidiv'
- } );
-
+ start: 7,
+ end: 20,
+ src: "http://en.wikipedia.org/wiki/S%C3%A3o_Paulo",
+ target: "wikidiv"
+ });
}, false);
</script>
<p> A Wiki article about Cape Town will appear at 0 seconds and disappear at 10 seconds.</p>
<p> A Wiki article about Sao Paolo will appear at 7 seconds and disappear at 20 seconds.</p>
<div>
- <video id='video'
+ <video id="video"
controls
- width= '250px'
+ width= "250px"
poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
type='video/ogg; codecs="theora, vorbis"'>
if ( options.src ) {
Popcorn.getScript( "http://" + options.lang + ".wikipedia.org/w/api.php?action=parse&props=text&page=" +
- options.src.slice( options.src.lastIndexOf("/")+1) + "&format=json&callback=wikiCallback" + _guid);
+ options.src.slice( options.src.lastIndexOf( "/" ) + 1 ) + "&format=json&callback=wikiCallback" + _guid );
} else if ( Popcorn.plugin.debug ) {
throw new Error( "Wikipedia plugin needs a 'src'" );
}
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"> </div>
- <video id='video'
+ <video id="video"
controls
- width= '250px'
+ width= "250px"
poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
type='video/ogg; codecs="theora, vorbis"'>
-test("Popcorn wikipedia Plugin", function () {
+test( "Popcorn wikipedia Plugin", function () {
- var popped = Popcorn( "#video" ),
- expects = 13,
- count = 0,
- theArticle = document.getElementById( "wikidiv" );
+ var popped = Popcorn( "#video" ),
+ expects = 13,
+ count = 0,
+ theArticle = document.getElementById( "wikidiv" );
expect( expects );
plus();
popped.wikipedia({
- start: 1, // seconds
- end: 3, // seconds
+ start: 1,
+ end: 3,
src: "http://en.wikipedia.org/wiki/Cape_Town",
title: "this is an article",
target: "wikidiv",
numberofwords: 22
- } )
+ })
.wikipedia({
- start: 4, // seconds
- end: 5, // seconds
+ start: 4,
+ end: 5,
src: "http://en.wikipedia.org/wiki/S%C3%A3o_Paulo",
target: "wikidiv",
numberofwords: 43
- } )
- .volume(0)
+ })
+ .volume( 0 )
.play();
popped.exec( 2, function() {
try {
popped.wikipedia({});
} catch( e ) {
- ok(true, 'empty event was caught by debug');
+ ok( true, "empty event was caught by debug" );
plus();
}
});
<html>
<head>
<title>Popcorn Wordriver Plug-in Demo</title>
-
<script src="../../popcorn.js"></script>
-
<script src="popcorn.wordriver.js"></script>
<script>
- document.addEventListener('DOMContentLoaded', function () {
- var p = Popcorn('#video')
- .volume(0)
+ document.addEventListener( "DOMContentLoaded", function () {
+ var p = Popcorn( "#video" )
+ .volume( 0 )
.play()
.wordriver({
- start: 1, // seconds
- end: 3, // seconds
+ start: 1,
+ end: 3,
text: "hello",
target: "wordriverdiv",
color: "red"
})
.wordriver({
- start: 3, // seconds
- end: 6, // seconds
+ start: 3,
+ end: 6,
text: "world",
target: "wordriverdiv",
color: "blue"
})
.wordriver({
- start: 1, // seconds
- end: 4, // seconds
+ start: 1,
+ end: 4,
text: "hello",
target: "wordriverdiv2",
color: "red"
})
.wordriver({
- start: 2, // seconds
- end: 4, // seconds
+ start: 2,
+ end: 4,
text: "world",
target: "wordriverdiv2",
color: "blue"
});
-
}, false);
-
</script>
</head>
<body>
<p> A "hello world" word river will appear from 1 to 6.</p>
<div>
- <video id='video'
+ <video id="video"
controls height="480" width="854"
- poster="../../test/poster.png">
+ poster="../../test/poster.png">
- <source id='mp4'
+ <source id="mp4"
src="../../test/trailer.mp4"
- type='video/mp4; codecs="avc1, mp4a"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
+ </video>
</div>
<div id="wordriverdiv" style="height: 200px; width: 200px;"></div>
<div id="wordriverdiv2" style="height: 200px; width: 200px;"></div>
// PLUGIN: Wordriver
-(function (Popcorn) {
+(function ( Popcorn ) {
var container = {},
spanLocation = 0,
var t = document.getElementById( target );
t && t.appendChild( container[ target ] );
-
+
container[ target ].style.height = "100%";
container[ target ].style.position = "relative";
-
+
return container[ target ];
},
// creates an object of supported, cross platform css transitions
document.getElementsByTagName( "head" )[ 0 ].appendChild( span );
/**
- * Word River popcorn plug-in
- * Displays a string of text, fading it in and out
+ * Word River popcorn plug-in
+ * Displays a string of text, fading it in and out
* while transitioning across the height of the parent container
* for the duration of the instance (duration = end - start)
- *
+ *
* @param {Object} options
- *
+ *
* Example:
var p = Popcorn( '#video' )
.wordriver({
*/
Popcorn.plugin( "wordriver" , {
-
+
manifest: {
about:{
name: "Popcorn WordRiver Plugin"
},
- options:{
- start : {elem:'input', type:'text', label:'In'},
- end : {elem:'input', type:'text', label:'Out'},
- target : 'wordriver-container',
- text : {elem:'input', type:'text', label:'Text'},
- color : {elem:'input', type:'text', label:'Color'}
+ options: {
+ start: {
+ elem: "input",
+ type: "text",
+ label: "In"
+ },
+ end: {
+ elem: "input",
+ type: "text",
+ label: "Out"
+ },
+ target: "wordriver-container",
+ text: {
+ elem: "input",
+ type: "text",
+ label: "Text"
+ },
+ color: {
+ elem: "input",
+ type: "text",
+ label: "Color"
+ }
}
},
if ( !document.getElementById( options.target ) && Popcorn.plugin.debug ) {
throw new Error( "target container doesn't exist" );
- }
+ }
options._duration = options.end - options.start;
options._container = container[ options.target ] || setupContainer( options.target );
<title>Popcorn Word River Plugin</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
+ <!--
+ do not move - this must be called immediately prior to
popcorn-api-draft.js
-->
-
<script src="../../popcorn.js"></script>
<script src="popcorn.wordriver.js"></script>
-
<script src="popcorn.wordriver.unit.js"></script>
</head>
<body>
<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'
+ <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"'>
+ type='video/mp4; codecs="avc1, mp4a"'>
- <source id='ogv'
+ <source id="ogv"
src="../../test/trailer.ogv"
- type='video/ogg; codecs="theora, vorbis"'>
+ type='video/ogg; codecs="theora, vorbis"'>
- <p>Your user agent does not support the HTML5 Video element.</p>
+ <p>Your user agent does not support the HTML5 Video element.</p>
- </video>
- <div id="wordriverdiv" style="height: 200px; width: 200px;"></div>
+ </video>
+ <div id="wordriverdiv" style="height: 200px; width: 200px;"></div>
</body>
</html>
test( "Popcorn wordriver Plugin", function () {
-
+
var popped = Popcorn( "#video" ),
- expects = 17,
+ expects = 17,
count = 0,
firstTrack,
secondTrack,
wordriverdiv = document.getElementById( "wordriverdiv" );
- expect(expects);
-
+ expect( expects );
+
function plus() {
- if ( ++count === expects) {
+ if ( ++count === expects ) {
start();
}
}
-
+
stop();
-
+
ok ( "wordriver" in popped, "wordriver is a method of the popped instance" );
plus();
-
+
equals ( wordriverdiv.childElementCount, 0, "initially, there is nothing inside the wordriverdiv" );
plus();
-
-
+
popped.wordriver({
- start: 0, // seconds
- end: 2, // seconds
+ start: 0,
+ end: 2,
text: "hello",
target: "wordriverdiv",
color: "red"
firstTrack = popped.getLastTrackEventId();
popped.wordriver({
- start: 2, // seconds
- end: 4, // seconds
+ start: 2,
+ end: 4,
text: "world",
target: "wordriverdiv",
color: "blue"
secondTrack = popped.getLastTrackEventId();
popped.wordriver({
- start: 20, // seconds
- end: 24, // seconds
+ start: 20,
+ end: 24,
text: "nothing here",
target: "wordriverdiv",
color: "green"
})
- .volume(0);
+ .volume( 0 );
popped.exec( 0, function() {
- equals( wordriverdiv.children[0].childElementCount, 1, "wordriverdiv now has one inner element" );
+ equals( wordriverdiv.children[ 0 ].childElementCount, 1, "wordriverdiv now has one inner element" );
plus();
- equals( wordriverdiv.children[0].children[0].style.opacity, 1, "first word is visible on the page" );
+ equals( wordriverdiv.children[ 0 ].children[ 0 ].style.opacity, 1, "first word is visible on the page" );
plus();
- equals( wordriverdiv.children[0].children[0].innerHTML, "hello", "first word content is correct" );
+ equals( wordriverdiv.children[ 0 ].children[ 0 ].innerHTML, "hello", "first word content is correct" );
plus();
- ok( !wordriverdiv.children[0].children[1], "second word does not exist yet" );
+ ok( !wordriverdiv.children[ 0 ].children[ 1 ], "second word does not exist yet" );
plus();
});
-
+
popped.exec( 2, function() {
- equals( wordriverdiv.children[0].childElementCount, 2, "wordriverdiv now has two inner elements" );
+ equals( wordriverdiv.children[ 0 ].childElementCount, 2, "wordriverdiv now has two inner elements" );
plus();
- equals( wordriverdiv.children[0].children[0].style.opacity, 0, "first word is not visible on the page" );
+ equals( wordriverdiv.children[ 0 ].children[ 0 ].style.opacity, 0, "first word is not visible on the page" );
plus();
- equals( wordriverdiv.children[0].children[0].innerHTML, "hello", "first word content is correct" );
+ equals( wordriverdiv.children[ 0 ].children[ 0 ].innerHTML, "hello", "first word content is correct" );
plus();
- equals( wordriverdiv.children[0].children[1].style.opacity, 1, "second word is visible on the page" );
+ equals( wordriverdiv.children[ 0 ].children[ 1 ].style.opacity, 1, "second word is visible on the page" );
plus();
- equals( wordriverdiv.children[0].children[1].innerHTML, "world", "second word content is correct" );
+ equals( wordriverdiv.children[ 0 ].children[ 1 ].innerHTML, "world", "second word content is correct" );
plus();
});
-
+
popped.exec( 4, function() {
- equals( wordriverdiv.children[0].children[0].style.opacity, 0, "first word is not visible on the page" );
+ equals( wordriverdiv.children[ 0 ].children[ 0 ].style.opacity, 0, "first word is not visible on the page" );
plus();
- equals( wordriverdiv.children[0].children[1].style.opacity, 0, "second word is not visible on the page" );
+ equals( wordriverdiv.children[ 0 ].children[ 1 ].style.opacity, 0, "second word is not visible on the page" );
plus();
popped.pause().removeTrackEvent( firstTrack );
- equals( wordriverdiv.children[0].childElementCount, 1, "wordriverdiv now has one inner element" );
+ equals( wordriverdiv.children[ 0 ].childElementCount, 1, "wordriverdiv now has one inner element" );
plus();
- equals( wordriverdiv.children[0].children[0].innerHTML, "world", "first word content is changed" );
+ equals( wordriverdiv.children[ 0 ].children[ 0 ].innerHTML, "world", "first word content is changed" );
plus();
popped.pause().removeTrackEvent( secondTrack );
try {
popped.wordriver({});
} catch( e ) {
- ok(true, 'empty event was caught by debug');
+ ok( true, "empty event was caught by debug" );
plus();
}
-
+
popped.play();
});