Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

T1911 #754

Merged
merged 2 commits into from

4 participants

@dseif
Owner

No description provided.

@jbuck
Owner

/botio check

@butterbot
Owner

From: Bot.io (butyr.org)


Received

Command cmd_check from @jbuck received. Current queue size: 0

Live output at: http://botio.butyr.org:8000/bb978d1de7d42b9/output.txt

@jbuck
Owner

/botio preview

@butterbot
Owner

From: Bot.io (butyr.org)


Received

Command cmd_preview from @jbuck received. Current queue size: 1

Live output at: http://botio.butyr.org:8000/3c16a5c5cb01b66/output.txt

@butterbot
Owner

From: Bot.io (butyr.org)


Failed

Full output at http://botio.butyr.org:8000/bb978d1de7d42b9/output.txt

Total script time: 0.65 mins

@butterbot
Owner

From: Bot.io (butyr.org)


Success

Full output at http://botio.butyr.org:8000/3c16a5c5cb01b66/output.txt

Total script time: 0.92 mins

Server is running on http://pr754.butyr.org/templates/basic/

@jbuck
Owner

/botio check

@butterbot
Owner

From: Bot.io (butyr.org)


Received

Command cmd_check from @jbuck received. Current queue size: 0

Live output at: http://botio.butyr.org:8000/4c0d8e490ade9c4/output.txt

@butterbot
Owner

From: Bot.io (butyr.org)


Success

Full output at http://botio.butyr.org:8000/4c0d8e490ade9c4/output.txt

Total script time: 0.96 mins

templates/assets/plugins/stop/popcorn.stop.js
@@ -0,0 +1,46 @@
+(function( Popcorn ) {
+ Popcorn.plugin( "stop", function() {
+ var _this = this;
+ return {
+ _setup: function( options ) {
+ options.toString = function() {
+ return "Stop " + ( options.duration > 0 ? options.duration : "forever" );
+ };
+ },
+ start: function( event, options ) {
+ this.pause();
@jbuck Owner
jbuck added a note

_this?

@dseif Owner
dseif added a note

I only need _this for inside the setTimeout, otherwise I just use this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
templates/assets/plugins/stop/popcorn.stop.js
((3 lines not shown))
+ var _this = this;
+ return {
+ _setup: function( options ) {
+ options.toString = function() {
+ return "Stop " + ( options.duration > 0 ? options.duration : "forever" );
+ };
+ },
+ start: function( event, options ) {
+ this.pause();
+ if ( +options.duration > 0 ) {
+ setTimeout(function() {
+ _this.play();
+ }, options.duration * 1000 );
+ }
+ },
+ end: function( event, options ) {
@jbuck Owner
jbuck added a note

Is it possible to remove this empty end() function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
templates/basic/config.json
@@ -36,7 +40,8 @@
"zoink",
"googlemap",
"twitter",
- "image"
+ "image",
+ "pause"
@jbuck Owner
jbuck added a note

Shouldn't this be "stop" to match with above?

@dseif Owner
dseif added a note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jbuck jbuck commented on the diff
templates/assets/plugins/stop/popcorn.stop.js
((7 lines not shown))
+ this.off( "seeked", _seekedFunc );
+ };
+ return {
+ _setup: function( options ) {
+ options.toString = function() {
+ return "Stop " + ( options.duration > 0 ? options.duration : "forever" );
+ };
+ },
+ start: function( event, options ) {
+ // we need to add this on start as well because we can run into a race condition where 'seeked' is fired before
+ // end is fired, or vice versa
+ this.on( "seeked", _seekedFunc );
+ this.pause();
+ if ( +options.duration > 0 ) {
+ _timeout = setTimeout(function() {
+ _this.play();
@jbuck Owner
jbuck added a note

Add a this.off( ... ) call here too so that the normal case doesn't leak.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
templates/assets/plugins/stop/popcorn.stop.js
((39 lines not shown))
+ "label": "In"
+ },
+ "end": {
+ "elem": "input",
+ "type": "text",
+ "label": "Out"
+ },
+ "duration": {
+ "elem": "input",
+ "type": "number",
+ "label": "Pause Duration (0 = forever)",
+ "units": "seconds",
+ "default": "0"
+ },
+ "target": {
+ "default": "overlay"
@mjschranz Owner

remove this and change it to

hidden: true

The plugin itself doesn't use a target, and having this here would confuse the user when a target list is appearing in the editor.

@dseif Owner
dseif added a note

ah good call, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
src/editor/default.js
((5 lines not shown))
}
}
}, null, optionsContainer, null, [ "target" ] );
- targetList = _this.createTargetsList( _targets );
- selectElement = targetList.querySelector( "select" );
- // Attach the onchange handler to trackEvent is updated when <select> is changed
- _this.attachSelectChangeHandler( selectElement, trackEvent, "target" );
- optionsContainer.appendChild( targetList );
+ if ( trackEvent.manifest.options.target[ "default" ] !== "hidden" ) {
@mjschranz Owner

you mistook my comment for how I wanted it defined :( See below

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
templates/assets/plugins/repeat/popcorn.repeat.js
@@ -40,7 +39,7 @@
"label": "Out"
},
"target": {
- "default": "overlay"
+ "default": "hidden"
@mjschranz Owner

You don't really want the default here. You just need to specify if you want the target manifest ignored completely.

target: {
  hidden: true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mjschranz
Owner

/botio check

@butterbot
Owner

From: Bot.io (butyr.org)


Received

Command cmd_check from @mjschranz received. Current queue size: 0

Live output at: http://botio.butyr.org:8000/7b0b37193f8c45e/output.txt

@butterbot
Owner

From: Bot.io (butyr.org)


Success

Full output at http://botio.butyr.org:8000/7b0b37193f8c45e/output.txt

Total script time: 1.30 mins

@mjschranz
Owner

/botio preview

@butterbot
Owner

From: Bot.io (butyr.org)


Received

Command cmd_preview from @mjschranz received. Current queue size: 0

Live output at: http://botio.butyr.org:8000/4fb866ceb0a978d/output.txt

@butterbot
Owner

From: Bot.io (butyr.org)


Success

Full output at http://botio.butyr.org:8000/4fb866ceb0a978d/output.txt

Total script time: 0.66 mins

Server is running on http://pr754.butyr.org/templates/basic/
Run the Test Suite: http://pr754.butyr.org/test/

@dseif dseif merged commit 1cb311f into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 16, 2012
  1. @dseif

    [#1911] Pause plugin

    dseif authored
  2. @dseif
This page is out of date. Refresh to see the latest.
View
15 src/editor/default.js
@@ -76,16 +76,17 @@ define( [ "text!./default.html", "editor/editor" ],
else {
_this.attachInputChangeHandler( element, trackEvent, name, updateTrackEvent );
}
-
}
}
}, null, optionsContainer, null, [ "target" ] );
- targetList = _this.createTargetsList( _targets );
- selectElement = targetList.querySelector( "select" );
- // Attach the onchange handler to trackEvent is updated when <select> is changed
- _this.attachSelectChangeHandler( selectElement, trackEvent, "target" );
- optionsContainer.appendChild( targetList );
+ if ( !trackEvent.manifest.options.target.hidden ) {
+ targetList = _this.createTargetsList( _targets );
+ selectElement = targetList.querySelector( "select" );
+ // Attach the onchange handler to trackEvent is updated when <select> is changed
+ _this.attachSelectChangeHandler( selectElement, trackEvent, "target" );
+ optionsContainer.appendChild( targetList );
+ }
_this.updatePropertiesFromManifest( trackEvent, null, true );
@@ -95,7 +96,7 @@ define( [ "text!./default.html", "editor/editor" ],
_messageContainer.parentNode.addEventListener( "oTransitionEnd", _this.scrollbar.update, false );
_messageContainer.parentNode.addEventListener( "webkitTransitionEnd", _this.scrollbar.update, false );
}
-
+
_this.scrollbar.update();
View
3  templates/assets/plugins/repeat/popcorn.repeat.js
@@ -17,7 +17,6 @@
}
if ( options.count > 0 || +options.loop === 0 ) {
this.currentTime( options.start );
-
if ( options.loop ) {
options.count--;
}
@@ -40,7 +39,7 @@
"label": "Out"
},
"target": {
- "default": "overlay"
+ "hidden": true
},
"loop": {
"label": "Number of loops (0 = forever)",
View
58 templates/assets/plugins/stop/popcorn.stop.js
@@ -0,0 +1,58 @@
+(function( Popcorn ) {
+ Popcorn.plugin( "stop", function() {
+ var _this = this,
+ _timeout,
+ _seekedFunc = function() {
+ _timeout && clearTimeout( _timeout );
+ this.off( "seeked", _seekedFunc );
+ };
+ return {
+ _setup: function( options ) {
+ options.toString = function() {
+ return "Stop " + ( options.duration > 0 ? options.duration : "forever" );
+ };
+ },
+ start: function( event, options ) {
+ // we need to add this on start as well because we can run into a race condition where 'seeked' is fired before
+ // end is fired, or vice versa
+ this.on( "seeked", _seekedFunc );
+ this.pause();
+ if ( +options.duration > 0 ) {
+ _timeout = setTimeout(function() {
+ _this.play();
@jbuck Owner
jbuck added a note

Add a this.off( ... ) call here too so that the normal case doesn't leak.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ _this.off( "seeked", _seekedFunc );
+ }, options.duration * 1000 );
+ }
+ },
+ end: function( event, options ) {
+ // we need to add this on end instead of start because when seeking outside of an active trackevent,
+ // end automatically gets fired
+ this.on( "seeked", _seekedFunc );
+ }
+ };
+ },
+ {
+ "options": {
+ "start": {
+ "elem": "input",
+ "type": "text",
+ "label": "In"
+ },
+ "end": {
+ "elem": "input",
+ "type": "text",
+ "label": "Out"
+ },
+ "duration": {
+ "elem": "input",
+ "type": "number",
+ "label": "Pause Duration (0 = forever)",
+ "units": "seconds",
+ "default": "0"
+ },
+ "target": {
+ "hidden": true
+ }
+ }
+ });
+}( Popcorn ));
View
7 templates/basic/config.json
@@ -32,6 +32,10 @@
{
"type": "repeat",
"path": "{{baseDir}}templates/assets/plugins/repeat/popcorn.repeat.js"
+ },
+ {
+ "type": "stop",
+ "path": "{{baseDir}}templates/assets/plugins/stop/popcorn.stop.js"
}
],
"defaults": [
@@ -41,7 +45,8 @@
"googlemap",
"twitter",
"image",
- "repeat"
+ "repeat",
+ "stop"
]
},
"editor": {
Something went wrong with that request. Please try again.