Skip to content

Commit

Permalink
Added the pause feature to a footnote plugin after removing it from t…
Browse files Browse the repository at this point in the history
…he core
  • Loading branch information
aljohnson1 committed Oct 28, 2011
1 parent dbf19c3 commit 0116a06
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
15 changes: 14 additions & 1 deletion plugins/footnote/popcorn.footnote.js
Expand Up @@ -65,7 +65,8 @@
* options variable * options variable
*/ */
start: function(event, options){ start: function(event, options){
options._container.style.display = "inline"; options._container.style.display = "inline";

}, },
/** /**
* @member footnote * @member footnote
Expand All @@ -78,8 +79,20 @@
}, },
_teardown: function( options ) { _teardown: function( options ) {
document.getElementById( options.target ) && document.getElementById( options.target ).removeChild( options._container ); document.getElementById( options.target ) && document.getElementById( options.target ).removeChild( options._container );
},

_pause: function(event, options) {
if(options != undefined && options.pause > 0){
if(!Popcorn.instances[0].video.paused){
window.setTimeout(function(){
Popcorn.instances[0].play();
}, options.pause * 1000 );
Popcorn.instances[0].pause();
}
}
} }
}); });

}); });


})( Popcorn ); })( Popcorn );
23 changes: 9 additions & 14 deletions popcorn.js
Expand Up @@ -441,6 +441,7 @@
Popcorn.addTrackEvent( this, { Popcorn.addTrackEvent( this, {
start: time, start: time,
end: time + 1, end: time + 1,
pause: time,
_running: false, _running: false,
_natives: { _natives: {
start: fn || Popcorn.nop, start: fn || Popcorn.nop,
Expand Down Expand Up @@ -622,7 +623,6 @@
return this; return this;
}, },
listen: function( type, fn ) { listen: function( type, fn ) {

var self = this, var self = this,
hasEvents = true, hasEvents = true,
eventHook = Popcorn.events.hooks[ type ], eventHook = Popcorn.events.hooks[ type ],
Expand Down Expand Up @@ -967,6 +967,7 @@
while ( tracks.byStart[ start ] && tracks.byStart[ start ].start <= currentTime ) { while ( tracks.byStart[ start ] && tracks.byStart[ start ].start <= currentTime ) {


byStart = tracks.byStart[ start ]; byStart = tracks.byStart[ start ];
var byPause = byStart;
natives = byStart._natives; natives = byStart._natives;
type = natives && natives.type; type = natives && natives.type;


Expand All @@ -980,16 +981,9 @@
obj.data.disabled.indexOf( type ) === -1 ) { obj.data.disabled.indexOf( type ) === -1 ) {


byStart._running = true; byStart._running = true;


if ( byStart.pause ) {
window.setTimeout(function(){
obj.play();
}, byStart.pause * 1000 );
obj.pause();
}


natives.start.call( obj, event, byStart ); natives.start.call( obj, event, byStart );
natives._pause.call(obj,event,byPause);


// If the `frameAnimation` option is used, // If the `frameAnimation` option is used,
// push the current byStart object into the `animating` cue // push the current byStart object into the `animating` cue
Expand All @@ -999,7 +993,8 @@
animating.push( byStart ); animating.push( byStart );
} }
} }
start++;
start++;
} else { } else {
// remove track event // remove track event
Popcorn.removeTrackEvent( obj, byStart._id ); Popcorn.removeTrackEvent( obj, byStart._id );
Expand Down Expand Up @@ -1196,7 +1191,6 @@
if ( !options ) { if ( !options ) {
return this; return this;
} }
alert(options);
// Storing the plugin natives // Storing the plugin natives
var natives = options._natives = {}, var natives = options._natives = {},
compose = "", compose = "",
Expand Down Expand Up @@ -1236,10 +1230,11 @@ alert(options);
// Checks for expected properties // Checks for expected properties
if ( !( "start" in options ) ) { if ( !( "start" in options ) ) {
options.start = 0; options.start = 0;



} }

if( !( "pause" in options)){
options.pause = 0;
}
if ( !( "end" in options ) ) { if ( !( "end" in options ) ) {
options.end = this.duration() || Number.MAX_VALUE; options.end = this.duration() || Number.MAX_VALUE;
} }
Expand Down

0 comments on commit 0116a06

Please sign in to comment.