]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
Fixed leaking variable issue, as well as other problems coming up through linting
authorDavid Seifried <david.c.seifried@gmail.com>
Tue, 17 May 2011 18:46:06 +0000 (14:46 -0400)
committerDavid Seifried <david.c.seifried@gmail.com>
Tue, 17 May 2011 18:46:06 +0000 (14:46 -0400)
plugins/googlemap/popcorn.googlemap.js

index df3230051ac489bb11af7e014f5a4be2a222074b..9a21cb625f93de9147ecf95bcaa56f1ea6f2c31e 100644 (file)
@@ -142,6 +142,7 @@ var googleCallback;
        */\r
       start: function (event, options) {\r
         var that = this;\r
+        var sView;\r
 \r
         // ensure the map has been initialized in the setup function above\r
         var isMapSetup = function () {\r
@@ -219,13 +220,13 @@ var googleCallback;
                   }\r
                   else{\r
 \r
-                    for ( var i = 0; i < rM.length; i++ ) {\r
+                    for ( var k = 0; k < rM.length; k++ ) {\r
 \r
-                      if( that.media.currentTime >= (options.interval*( i+1 ) )/1000 &&\r
-                      ( that.media.currentTime <= (options.interval*( i+2 ) )/1000 ||\r
+                      if( that.media.currentTime >= (options.interval*( k+1 ) )/1000 &&\r
+                      ( that.media.currentTime <= (options.interval*( k+2 ) )/1000 ||\r
                        that.media.currentTime >= options.interval*( rM.length )/1000 ) ){\r
 \r
-                        sView2.setPosition( checkpoints[i] );\r
+                        sView2.setPosition( checkpoints[ k ] );\r
 \r
                         sView2.setPov({\r
                                heading: options.heading || 0,\r
@@ -240,7 +241,7 @@ var googleCallback;
                   }   \r
                   }, t );\r
 \r
-                }\r
+                };\r
 \r
                 \r
                 //  Determines if we should use hardcoded values ( using options.tween ),\r
@@ -278,7 +279,7 @@ var googleCallback;
 \r
                   });\r
 \r
-                  function showSteps( directionResult, that ) {\r
+                  var showSteps = function ( directionResult, that ) {\r
                   \r
                   //  Push new google map lat and lng values into an array from our list of lat and lng values\r
                   for ( var j = 0; j < directionResult.routes[ 0 ].overview_path.length; j++ ) {\r
@@ -289,7 +290,7 @@ var googleCallback;
                     options.interval = options.interval || 1000;\r
                     tween( checkpoints, 10);\r
 \r
-                  }\r
+                  };\r
                 }\r
                 else if( typeof options.tween === "object" ){\r
 \r