diff options
-rw-r--r-- | gmap_arcgis.js | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js index ec3b44e..7883b22 100644 --- a/gmap_arcgis.js +++ b/gmap_arcgis.js @@ -503,10 +503,14 @@ function gmapArcgis(config) { // Close all registered infoWindows closeInfoWindows: function() { - for (overlay in [ 'layers', 'markers' ]) { - for (element in this.config[overlay]) { - if (this.config[overlay][element].infowindow != undefined) { - this.config[overlay][element].infowindow.close(); + overlays = [ 'layers', 'markers' ]; + + for (i in overlays) { + var overlay = this.config[overlays[i]]; + + for (element in overlay) { + if (overlay[element].infowindow != undefined) { + this.config[overlays[i]][element].infowindow.close(); } } } @@ -514,14 +518,18 @@ function gmapArcgis(config) { // Remove all loaded overlays cleanOverlays: function() { - for (overlay in [ 'layers', 'markers' ]) { - for (element in this.config[overlay]) { - if (this.config[overlay][element].infowindow != undefined) { - delete this.config[overlay][element].infowindow; + var overlays = [ 'layers', 'markers' ]; + + for (i in overlays) { + var overlay = this.config[overlays[i]]; + + for (element in overlay) { + if (overlay[element].infowindow != undefined) { + delete this.config[overlays[i]][element].infowindow; } - if (this.config[overlay][element].overlay != undefined) { - delete this.config[overlay][element].overlay; + if (overlay[element].overlay != undefined) { + delete this.config[overlays[i]][element].overlay; } } } |