mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-04 00:11:51 +02:00
Fixes from jshint
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
(function () {
|
||||
(function () {
|
||||
L.MarkerClusterDefault = {
|
||||
iconCreateFunction: function (childCount) {
|
||||
var c = ' marker-cluster-';
|
||||
|
||||
@@ -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--) {
|
||||
@@ -284,5 +286,5 @@ L.MarkerClusterGroup.include({
|
||||
if (this._spiderfied) {
|
||||
this._spiderfied.unspiderfy();
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
@@ -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]);
|
||||
}
|
||||
@@ -255,7 +255,7 @@ L.MarkerCluster = L.Marker.extend({
|
||||
_recursivelyAddChildrenToMap: function (startPos, depth, bounds) {
|
||||
this._recursively(bounds, 0, depth,
|
||||
function (c, recursionDepth) {
|
||||
if (recursionDepth == 0) {
|
||||
if (recursionDepth === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
});
|
||||
@@ -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,7 +269,7 @@ 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) {
|
||||
@@ -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,16 +307,20 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//update the positions of the just added clusters/markers
|
||||
me._topClusterLevel._recursively(bounds, depthToStartAt, 0, function (c) {
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user