Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

T1911 #754

Merged
merged 2 commits into from over 1 year ago

4 participants

David Seifried Jon Buckley butterbot Matthew Schranz
David Seifried
Collaborator

No description provided.

Jon Buckley
Owner

/botio check

butterbot
Collaborator

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

Jon Buckley
Owner

/botio preview

butterbot
Collaborator

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
Collaborator

From: Bot.io (butyr.org)


Failed

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

Total script time: 0.65 mins

butterbot
Collaborator

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/

Jon Buckley
Owner

/botio check

butterbot
Collaborator

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
Collaborator

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 @@
  1
+(function( Popcorn ) {
  2
+  Popcorn.plugin( "stop", function() {
  3
+    var _this = this;
  4
+    return {
  5
+      _setup: function( options ) {
  6
+        options.toString = function() {
  7
+          return "Stop " + ( options.duration > 0 ? options.duration : "forever" );
  8
+        };
  9
+      },
  10
+      start: function( event, options ) {
  11
+        this.pause();
2
Jon Buckley Owner
jbuck added a note August 09, 2012

_this?

David Seifried Collaborator
dseif added a note August 13, 2012

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))
  3
+    var _this = this;
  4
+    return {
  5
+      _setup: function( options ) {
  6
+        options.toString = function() {
  7
+          return "Stop " + ( options.duration > 0 ? options.duration : "forever" );
  8
+        };
  9
+      },
  10
+      start: function( event, options ) {
  11
+        this.pause();
  12
+        if ( +options.duration > 0 ) {
  13
+          setTimeout(function() {
  14
+            _this.play();
  15
+          }, options.duration * 1000 );
  16
+        }
  17
+      },
  18
+      end: function( event, options ) {
1
Jon Buckley Owner
jbuck added a note August 09, 2012

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 @@
36 40
       "zoink",
37 41
       "googlemap",
38 42
       "twitter",
39  
-      "image"
  43
+      "image",
  44
+      "pause"
2
Jon Buckley Owner
jbuck added a note August 13, 2012

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

David Seifried Collaborator
dseif added a note August 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jon Buckley jbuck commented on the diff August 15, 2012
templates/assets/plugins/stop/popcorn.stop.js
((7 lines not shown))
  7
+          this.off( "seeked", _seekedFunc );
  8
+        };
  9
+    return {
  10
+      _setup: function( options ) {
  11
+        options.toString = function() {
  12
+          return "Stop " + ( options.duration > 0 ? options.duration : "forever" );
  13
+        };
  14
+      },
  15
+      start: function( event, options ) {
  16
+        // we need to add this on start as well because we can run into a race condition where 'seeked' is fired before
  17
+        // end is fired, or vice versa
  18
+        this.on( "seeked", _seekedFunc );
  19
+        this.pause();
  20
+        if ( +options.duration > 0 ) {
  21
+          _timeout = setTimeout(function() {
  22
+            _this.play();
1
Jon Buckley Owner
jbuck added a note August 15, 2012

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))
  39
+        "label": "In"
  40
+      },
  41
+      "end": {
  42
+        "elem": "input",
  43
+        "type": "text",
  44
+        "label": "Out"
  45
+      },
  46
+      "duration": {
  47
+        "elem": "input",
  48
+        "type": "number",
  49
+        "label": "Pause Duration (0 = forever)",
  50
+        "units": "seconds",
  51
+        "default": "0"
  52
+      },
  53
+      "target": {
  54
+        "default": "overlay"
2
Matthew Schranz Collaborator
mjschranz added a note August 16, 2012

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.

David Seifried Collaborator
dseif added a note August 16, 2012

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))
80 79
               }
81 80
             }
82 81
           }, null, optionsContainer, null, [ "target" ] );
83 82
 
84  
-        targetList = _this.createTargetsList( _targets );
85  
-        selectElement = targetList.querySelector( "select" );
86  
-        // Attach the onchange handler to trackEvent is updated when <select> is changed
87  
-        _this.attachSelectChangeHandler( selectElement, trackEvent, "target" );
88  
-        optionsContainer.appendChild( targetList );
  83
+        if ( trackEvent.manifest.options.target[ "default" ] !== "hidden" ) {
1
Matthew Schranz Collaborator
mjschranz added a note August 16, 2012

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 @@
40 39
         "label": "Out"
41 40
       },
42 41
       "target": {
43  
-        "default": "overlay"
  42
+        "default": "hidden"
1
Matthew Schranz Collaborator
mjschranz added a note August 16, 2012

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
Matthew Schranz
Collaborator

/botio check

butterbot
Collaborator

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
Collaborator

From: Bot.io (butyr.org)


Success

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

Total script time: 1.30 mins

Matthew Schranz
Collaborator

/botio preview

butterbot
Collaborator

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
Collaborator

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/

David Seifried dseif merged commit 1cb311f into from August 16, 2012
David Seifried dseif closed this August 16, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
15  src/editor/default.js
@@ -76,16 +76,17 @@ define( [ "text!./default.html", "editor/editor" ],
76 76
                 else {
77 77
                   _this.attachInputChangeHandler( element, trackEvent, name, updateTrackEvent );
78 78
                 }
79  
-                
80 79
               }
81 80
             }
82 81
           }, null, optionsContainer, null, [ "target" ] );
83 82
 
84  
-        targetList = _this.createTargetsList( _targets );
85  
-        selectElement = targetList.querySelector( "select" );
86  
-        // Attach the onchange handler to trackEvent is updated when <select> is changed
87  
-        _this.attachSelectChangeHandler( selectElement, trackEvent, "target" );
88  
-        optionsContainer.appendChild( targetList );
  83
+        if ( !trackEvent.manifest.options.target.hidden ) {
  84
+          targetList = _this.createTargetsList( _targets );
  85
+          selectElement = targetList.querySelector( "select" );
  86
+          // Attach the onchange handler to trackEvent is updated when <select> is changed
  87
+          _this.attachSelectChangeHandler( selectElement, trackEvent, "target" );
  88
+          optionsContainer.appendChild( targetList );
  89
+        }
89 90
 
90 91
         _this.updatePropertiesFromManifest( trackEvent, null, true );
91 92
 
@@ -95,7 +96,7 @@ define( [ "text!./default.html", "editor/editor" ],
95 96
           _messageContainer.parentNode.addEventListener( "oTransitionEnd", _this.scrollbar.update, false );
96 97
           _messageContainer.parentNode.addEventListener( "webkitTransitionEnd", _this.scrollbar.update, false );
97 98
         }
98  
-        
  99
+
99 100
         _this.scrollbar.update();
100 101
 
101 102
 
3  templates/assets/plugins/repeat/popcorn.repeat.js
@@ -17,7 +17,6 @@
17 17
           }
18 18
           if ( options.count > 0 || +options.loop === 0 ) {
19 19
             this.currentTime( options.start );
20  
-            
21 20
             if ( options.loop ) {
22 21
               options.count--;
23 22
             }
@@ -40,7 +39,7 @@
40 39
         "label": "Out"
41 40
       },
42 41
       "target": {
43  
-        "default": "overlay"
  42
+        "hidden": true
44 43
       },
45 44
       "loop": {
46 45
         "label": "Number of loops (0 = forever)",
58  templates/assets/plugins/stop/popcorn.stop.js
... ...
@@ -0,0 +1,58 @@
  1
+(function( Popcorn ) {
  2
+  Popcorn.plugin( "stop", function() {
  3
+    var _this = this,
  4
+        _timeout,
  5
+        _seekedFunc = function() {
  6
+          _timeout && clearTimeout( _timeout );
  7
+          this.off( "seeked", _seekedFunc );
  8
+        };
  9
+    return {
  10
+      _setup: function( options ) {
  11
+        options.toString = function() {
  12
+          return "Stop " + ( options.duration > 0 ? options.duration : "forever" );
  13
+        };
  14
+      },
  15
+      start: function( event, options ) {
  16
+        // we need to add this on start as well because we can run into a race condition where 'seeked' is fired before
  17
+        // end is fired, or vice versa
  18
+        this.on( "seeked", _seekedFunc );
  19
+        this.pause();
  20
+        if ( +options.duration > 0 ) {
  21
+          _timeout = setTimeout(function() {
  22
+            _this.play();
  23
+            _this.off( "seeked", _seekedFunc );
  24
+          }, options.duration * 1000 );
  25
+        }
  26
+      },
  27
+      end: function( event, options ) {
  28
+        // we need to add this on end instead of start because when seeking outside of an active trackevent,
  29
+        // end automatically gets fired
  30
+        this.on( "seeked", _seekedFunc );
  31
+      }
  32
+    };
  33
+  },
  34
+  {
  35
+    "options": {
  36
+      "start": {
  37
+        "elem": "input",
  38
+        "type": "text",
  39
+        "label": "In"
  40
+      },
  41
+      "end": {
  42
+        "elem": "input",
  43
+        "type": "text",
  44
+        "label": "Out"
  45
+      },
  46
+      "duration": {
  47
+        "elem": "input",
  48
+        "type": "number",
  49
+        "label": "Pause Duration (0 = forever)",
  50
+        "units": "seconds",
  51
+        "default": "0"
  52
+      },
  53
+      "target": {
  54
+        "hidden": true
  55
+      }
  56
+    }
  57
+  });
  58
+}( Popcorn ));
7  templates/basic/config.json
@@ -32,6 +32,10 @@
32 32
       {
33 33
         "type": "repeat",
34 34
         "path": "{{baseDir}}templates/assets/plugins/repeat/popcorn.repeat.js"
  35
+      },
  36
+      {
  37
+        "type": "stop",
  38
+        "path": "{{baseDir}}templates/assets/plugins/stop/popcorn.stop.js"
35 39
       }
36 40
     ],
37 41
     "defaults": [
@@ -41,7 +45,8 @@
41 45
       "googlemap",
42 46
       "twitter",
43 47
       "image",
44  
-      "repeat"
  48
+      "repeat",
  49
+      "stop"
45 50
     ]
46 51
   },
47 52
   "editor": {
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.