[Pkg-javascript-commits] [leaflet-markercluster] 101/479: Fixes from jshint

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:15 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository leaflet-markercluster.

commit 2d71f7d8effa324feefac5d547fabc47846cf349
Author: danzel <danzel at localhost.geek.nz>
Date:   Wed Jul 25 10:47:22 2012 +1200

    Fixes from jshint
---
 src/MarkerCluster.Default.css   | 18 +++++++++---------
 src/MarkerCluster.Default.js    |  2 +-
 src/MarkerCluster.Spiderfier.js | 10 ++++++----
 src/MarkerCluster.js            | 14 +++++++-------
 src/MarkerClusterGroup.js       | 22 +++++++++++++---------
 5 files changed, 36 insertions(+), 30 deletions(-)

diff --git a/src/MarkerCluster.Default.css b/src/MarkerCluster.Default.css
index 6b380c1..69f3356 100644
--- a/src/MarkerCluster.Default.css
+++ b/src/MarkerCluster.Default.css
@@ -1,29 +1,29 @@
 .marker-cluster-small {
 	background-color: rgba(181, 226, 140, 0.6);
-}
+	}
 .marker-cluster-small div {
 	background-color: rgba(110, 204, 57, 0.6);
-}
+	}
 
 .marker-cluster-medium {
 	background-color: rgba(241, 211, 87, 0.6);
-}
+	}
 .marker-cluster-medium div {
 	background-color: rgba(240, 194, 12, 0.6);
-}
+	}
 
 .marker-cluster-large {
 	background-color: rgba(253, 156, 115, 0.6);
-}
+	}
 .marker-cluster-large div {
 	background-color: rgba(241, 128, 23, 0.6);
-}
+	}
 
 .marker-cluster {
 	text-align: center;
 	background-clip: padding-box;
 	border-radius: 20px;
-}
+	}
 .marker-cluster div {
 	width: 30px;
 	height: 30px;
@@ -33,7 +33,7 @@
 	text-align: center;
 	border-radius: 15px;
 	font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
-}
+	}
 .marker-cluster span {
 	line-height: 30px;
-}
\ No newline at end of file
+	}
\ No newline at end of file
diff --git a/src/MarkerCluster.Default.js b/src/MarkerCluster.Default.js
index d4de4e2..15e64de 100644
--- a/src/MarkerCluster.Default.js
+++ b/src/MarkerCluster.Default.js
@@ -1,4 +1,4 @@
-(function () {
+(function () {
 	L.MarkerClusterDefault = {
 		iconCreateFunction: function (childCount) {
 			var c = ' marker-cluster-';
diff --git a/src/MarkerCluster.Spiderfier.js b/src/MarkerCluster.Spiderfier.js
index f5b4113..7ed4800 100644
--- a/src/MarkerCluster.Spiderfier.js
+++ b/src/MarkerCluster.Spiderfier.js
@@ -1,4 +1,4 @@
-//This code is 100% based on https://github.com/jawj/OverlappingMarkerSpiderfier-Leaflet
+//This code is 100% based on https://github.com/jawj/OverlappingMarkerSpiderfier-Leaflet
 //Huge thanks to jawj for implementing it first to make my job easy :-)
 
 L.MarkerCluster.include({
@@ -15,7 +15,7 @@ L.MarkerCluster.include({
 								// 0 -> always spiral; Infinity -> always circle
 
 	spiderfy: function () {
-		if (this._group._spiderfied == this) {
+		if (this._group._spiderfied === this) {
 			return;
 		}
 
@@ -85,6 +85,7 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
 	//Non Animated versions of everything
 	_animationSpiderfy: function (childMarkers, positions) {
 		var group = this._group,
+			map = group._map,
 			i, m, leg;
 
 		for (i = childMarkers.length - 1; i >= 0; i--) {
@@ -128,6 +129,7 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
 	_animationSpiderfy: function (childMarkers, positions) {
 		var me = this,
 			group = this._group,
+			map = group._map,
 			i, m, leg;
 
 		for (i = childMarkers.length - 1; i >= 0; i--) {
@@ -199,7 +201,7 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
 			// Doing this at 250ms causes some minor flickering on FF, so just do it immediately
 			// If the initial opacity of the spiderlegs isn't 0 then they appear before the animation starts.
 			if (L.Browser.svg) {
-				setTimeout(function() {
+				setTimeout(function () {
 					for (i = childMarkers.length - 1; i >= 0; i--) {
 						m = childMarkers[i]._spiderLeg;
 
@@ -284,5 +286,5 @@ L.MarkerClusterGroup.include({
 		if (this._spiderfied) {
 			this._spiderfied.unspiderfy();
 		}
-	},
+	}
 });
\ No newline at end of file
diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js
index ae801a7..4b9ed04 100644
--- a/src/MarkerCluster.js
+++ b/src/MarkerCluster.js
@@ -149,7 +149,7 @@ L.MarkerCluster = L.Marker.extend({
 
 		//Check our children
 		for (i = markers.length - 1; i >= 0; i--) {
-			if (markers[i] == layer) {
+			if (markers[i] === layer) {
 				if (markers[i]._icon) {
 					L.FeatureGroup.prototype.removeLayer.call(group, markers[i]);
 				}
@@ -247,15 +247,15 @@ L.MarkerCluster = L.Marker.extend({
 	},
 
 	_recursivelyBecomeVisible: function (bounds, depth) {
-		this._recursively(bounds, 0, depth, null, function(c) {
+		this._recursively(bounds, 0, depth, null, function (c) {
 			c.setOpacity(1);
 		});
 	},
 
 	_recursivelyAddChildrenToMap: function (startPos, depth, bounds) {
-		this._recursively(bounds, 0, depth, 
+		this._recursively(bounds, 0, depth,
 			function (c, recursionDepth) {
-				if (recursionDepth == 0) {
+				if (recursionDepth === 0) {
 					return;
 				}
 
@@ -343,7 +343,7 @@ L.MarkerCluster = L.Marker.extend({
 	//Run the given functions recursively to this and child clusters
 	// boundsToApplyTo: a L.LatLngBounds representing the bounds of what clusters to recurse in to
 	// depthToStartAt: the depth to start calling the given functions
-	// timesToRecurse: how many layers deep to recurse in to after hitting depthToStartAt, bottom level: depthToRunFor == 0 
+	// timesToRecurse: how many layers deep to recurse in to after hitting depthToStartAt, bottom level: depthToRunFor == 0
 	// runAtEveryLevel: function that takes an L.MarkerCluster as an argument that should be applied on every level
 	// runAtBottomLevel: function that takes an L.MarkerCluster as an argument that should be applied at only the bottom level
 	_recursively: function (boundsToApplyTo, depthToStartAt, timesToRecurse, runAtEveryLevel, runAtBottomLevel) {
@@ -362,7 +362,7 @@ L.MarkerCluster = L.Marker.extend({
 			if (runAtEveryLevel) {
 				runAtEveryLevel(this, timesToRecurse);
 			}
-			if (timesToRecurse == 0 && runAtBottomLevel) {
+			if (timesToRecurse === 0 && runAtBottomLevel) {
 				runAtBottomLevel(this);
 			}
 
@@ -399,6 +399,6 @@ L.MarkerCluster = L.Marker.extend({
 	//Returns true if we are the parent of only one cluster and that cluster is the same as us
 	_isSingleParent: function () {
 		//Don't need to check this._markers as the rest won't work if there are any
-		return this._childClusters.length > 0 && this._childClusters[0]._childCount == this._childCount;
+		return this._childClusters.length > 0 && this._childClusters[0]._childCount === this._childCount;
 	}
 });
\ No newline at end of file
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index aed4383..100b5b6 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -258,7 +258,7 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
 	},
 	_animationAddLayer: function (layer, newCluster) {
 		L.FeatureGroup.prototype.addLayer.call(this, newCluster);
-		if (newCluster != layer && newCluster._childCount == 2) {
+		if (newCluster !== layer && newCluster._childCount === 2) {
 			newCluster._recursivelyRemoveChildrenFromMap(newCluster._bounds, 1);
 		}
 	}
@@ -269,13 +269,13 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
 		this._map._mapPane.className += ' leaflet-cluster-anim';
 	},
 	_animationEnd: function () {
-		this._map._mapPane.className = map._mapPane.className.replace(' leaflet-cluster-anim', '');
+		this._map._mapPane.className = this._map._mapPane.className.replace(' leaflet-cluster-anim', '');
 		this._inZoomAnimation--;
 	},
 	_animationZoomIn: function (previousZoomLevel, newZoomLevel) {
 		var me = this,
 		    bounds = this._getExpandedVisibleBounds(),
-		    i, 
+		    i,
 		    depthToStartAt = 1 + previousZoomLevel - this._topClusterLevel._zoom,
 		    depthToDescend = newZoomLevel - previousZoomLevel;
 
@@ -285,7 +285,7 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
 				markers = c._markers,
 				m;
 
-			if (c._isSingleParent() && depthToDescend == 1) { //Immediately add the new child and remove us
+			if (c._isSingleParent() && depthToDescend === 1) { //Immediately add the new child and remove us
 				L.FeatureGroup.prototype.removeLayer.call(me, c);
 				c._recursivelyAddChildrenToMap(null, depthToDescend, bounds);
 			} else {
@@ -307,14 +307,18 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
 
 		//Immediately fire an event to update the opacity and locations (If we immediately set it they won't animate)
 		setTimeout(function () {
+			var j, n;
+
 			//Update opacities
 			me._topClusterLevel._recursivelyBecomeVisible(bounds, depthToStartAt + depthToDescend);
 			//TODO Maybe? Update markers in _recursivelyBecomeVisible
-			for (i in me._layers) {
-				var n = me._layers[i];
+			for (j in me._layers) {
+				if (this._layers.hasOwnProperty(j)) {
+					n = me._layers[j];
 
-				if (!(n instanceof L.MarkerCluster) && n._icon) {
-					n.setOpacity(1);
+					if (!(n instanceof L.MarkerCluster) && n._icon) {
+						n.setOpacity(1);
+					}
 				}
 			}
 
@@ -376,7 +380,7 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
 		var me = this;
 
 		L.FeatureGroup.prototype.addLayer.call(this, layer);
-		if (newCluster != layer) {
+		if (newCluster !== layer) {
 			if (newCluster._childCount > 2) { //Was already a cluster
 
 				this._animationStart();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet-markercluster.git



More information about the Pkg-javascript-commits mailing list