diff options
author | Silvio <silvio@socioambiental.org> | 2013-04-23 17:27:05 -0300 |
---|---|---|
committer | Silvio <silvio@socioambiental.org> | 2013-04-23 17:27:05 -0300 |
commit | ed22e2d9a688bb97cb7c215c05de450946abde2f (patch) | |
tree | 498f039e74b768de8fbfb449752675ef706c8fb9 | |
parent | a61af1a2ac4ca325c33a4b776bef2f54fcd313e5 (diff) | |
download | gmap_arcgis_js-ed22e2d9a688bb97cb7c215c05de450946abde2f.tar.gz gmap_arcgis_js-ed22e2d9a688bb97cb7c215c05de450946abde2f.tar.bz2 |
Refactor closeInfoWindows() and cleanOverlays()
-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; } } } |