]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
indentation and style fixes
authorKarim Hamidou <khamidou@gmail.com>
Thu, 17 Nov 2011 10:24:59 +0000 (11:24 +0100)
committerKarim Hamidou <khamidou@gmail.com>
Thu, 17 Nov 2011 10:24:59 +0000 (11:24 +0100)
plugins/mediafragment/popcorn.mediafragment.html
plugins/mediafragment/popcorn.mediafragment.js
plugins/mediafragment/popcorn.mediafragment.unit.html
plugins/mediafragment/popcorn.mediafragment.unit.js

index e6fda9b9cc1ddde149eb9eeafdb2d670a0cf8952..e2d4e18c9a23d3a5cbc3c65436af4cc82f7c0574 100644 (file)
@@ -6,12 +6,14 @@
   <script src="../../popcorn.js"></script>
   <script src="popcorn.mediafragment.js"></script>
   <script>
-    document.addEventListener('DOMContentLoaded', function () {
-      var p = Popcorn( "#video" ).mediafragment({start: 0}).play()   
+    document.addEventListener( "DOMContentLoaded", function () {
+      var p = Popcorn( "#video" )
+              .mediafragment({start: 0})
+              .play();
 
-         document.getElementById("pauseButton").addEventListener( 'click', function() {
-               p.pause()
-               });
+      document.getElementById("pauseButton").addEventListener( "click", function() {
+        p.pause()
+      });
                
     }, false);
 
index d2a342507271b251fcae2bc45030e445ecf5a696..e84047955fb3e0bfb7e1525d3793cfd533457f87 100644 (file)
@@ -4,8 +4,8 @@
 
   /**
    * Mediafragment popcorn plug-in
-   * Adds (limited) support for mediafragment requests 
-   * to a popcorn video.  
+   * Adds (limited) support for mediafragment requests
+   * to a popcorn video.
    * @param {Object} options
    *
   **/
         options: {
         }
       },
-      
+
     _setup: function( options ) {
         var advanceTime = function() {
               var url = window.location.href;
-              
-              if ( url.split("#")[1] != null ) {
-                  pageoffset = url.split( "#" )[1];                                                    
-                  
+
+              if ( url.split( "#" )[ 1 ] != null ) {
+                  pageoffset = url.split( "#" )[1];
+
                   if ( pageoffset.substring( 2 ) != null ) {
-                    var offsettime = pageoffset.substring( 2 );                                                
-                    this.currentTime(parseFloat(offsettime));
-                  }                                                    
+                    var offsettime = pageoffset.substring( 2 );
+                    this.currentTime( parseFloat( offsettime ) );
+                  }
               }
         }
-        
+
         var updateTime = function() {
-            splitArr = window.location.href.split("#")                 
-            history.replaceState({}, "", splitArr[0] + "#t=" + this.currentTime().toFixed(2));
+            splitArr = window.location.href.split( "#" )
+            history.replaceState( {}, "", splitArr[0] + "#t=" + this.currentTime().toFixed( 2 ) );
         };
-        
-        this.listen( 'loadedmetadata', advanceTime );        
-        this.listen("pause", updateTime);
-        this.listen("seeked", updateTime);
-        
+
+        this.listen( "loadedmetadata", advanceTime );
+        this.listen( "pause", updateTime );
+        this.listen( "seeked", updateTime );
     },
 
     _teardown: function( options ) {
index ff07abb3be0d61446572ab72da99f9415aad743a..2bd0a12bf952600ccece4b7d8991343938a3e865 100644 (file)
@@ -34,7 +34,7 @@
     <source id="ogv"
       src="../../test/trailer.ogv"
       type='video/ogg; codecs="theora, vorbis"'>
-      
+
     <source id='webm'
       src="../../test/trailer.webm"
       type='video/webm; codecs="vp8, vorbis"'>
index 659a273b986b1b64ec2946c8716a34eec1fa6476..1ff5fe52818fff78f231363f49ca994f88a80066 100644 (file)
@@ -2,7 +2,7 @@ test( "Popcorn Mediafragment Plugin", function() {
 
   var popped = Popcorn( "#video" ),
       expects = 4,
-      count = 0;     
+      count = 0;
 
   expect( expects );
 
@@ -17,48 +17,46 @@ test( "Popcorn Mediafragment Plugin", function() {
   ok( "mediafragment" in popped, "mediafragment is a method of the popped instance" );
   plus();
 
-  var currstate = window.location.href.split("#t=");
+  var currstate = window.location.href.split( "#t=" );
   equals( currstate[1], undefined, "initially, there is no # in the url" );
   plus();
 
   popped.mediafragment({
-    start: 0,   
+    start: 0,
   });
 
   popped.exec( 2, function() {
     popped.pause();
     popped.play();
-    
-    
   });
 
   popped.exec( 3, function() {
-    var currstate = window.location.href.split("#t=");
-    var time = + currstate[1];
-    
+    var currstate = window.location.href.split( "#t=" );
+    var time = + currstate[ 1 ];
+
     // popcorn's precision is limited to the second.
     ok(time >= 2 && time <= 3, "correct time is set" );
     plus();
     popped.play();
-  
+
     popped.currentTime(5);
   });
 
-  popped.exec( 6, function() {      
-    var currstate = window.location.href.split("#t=");
-    var time = + currstate[1];
+  popped.exec( 6, function() {
+    var currstate = window.location.href.split( "#t=" );
+    var time = + currstate[ 1 ];
 
     console.log(time);
     // popcorn's precision is limited to the second.
     ok(time >= 5 && time <= 6, "correct time is set after seeking" );
-    plus();   
-  
+    plus();
+
   });
-  
+
   popped.exec( 10, function() {
     // clear the address bar
-    window.location.href = window.location.href.split("#t=")[0];
+    window.location.href = window.location.href.split( "#t=" )[ 0 ];
   });
-  
+
   popped.play();
 });
\ No newline at end of file