diff options
Diffstat (limited to 'gmap_arcgis.js')
-rw-r--r-- | gmap_arcgis.js | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js index 77b2f7a..bc67623 100644 --- a/gmap_arcgis.js +++ b/gmap_arcgis.js @@ -32,18 +32,12 @@ function gmapArcgis(config) { // UI unblocker wrapper unblockUI: function() { - if (window.ui == undefined || window.ui == 'blocked') { - window.ui = 'unblocked'; - jQuery.unblockUI(); - } + jQuery.unblockUI(); }, // UI blocker wrapper blockUI: function(params) { - if (window.ui == undefined || window.ui == 'unblocked') { - window.ui = 'blocked'; - jQuery.blockUI(params); - } + jQuery.blockUI(params); }, // Block the UI and show an overlay @@ -77,6 +71,16 @@ function gmapArcgis(config) { } }, + // Show overlay dependending on element configuration + showOverlayIf: function(section, element) { + if (this.config[section][element].overlayTime != undefined && this.config[section][element].overlayTime != false) { + this.showOverlay(this.config[section][element].overlayTime); + } + else if (this.config[section][element].overlayTime != false) { + this.showOverlay(); + } + }, + // Count object properties countProperties: function(object) { // Doesn't work with IE8 @@ -214,14 +218,11 @@ function gmapArcgis(config) { this.showKML(element); return; } - - if (this.config['kmls'][element].overlayTime != undefined) { - this.showOverlay(this.config['kmls'][element].overlayTime); - } - + + this.showOverlayIf('kmls', element); this.showKML(element); }, - + // Add a layer to the map addLayers: function(element) { this.config['layers'][element].opacity = this.defaultOpacity(element); @@ -245,10 +246,7 @@ function gmapArcgis(config) { return; } - if (this.config['layers'][element].overlayTime != undefined) { - this.showOverlay(this.config['layers'][element].overlayTime); - } - + this.showOverlayIf('layers', element); this.config['layers'][element].overlay = this.showPolygon(this.config['layers'][element]); }, @@ -263,10 +261,7 @@ function gmapArcgis(config) { this.unblockUI(); } - if (this.config['sliders'][slider].overlayTime != undefined) { - this.showOverlay(this.config['sliders'][slider].overlayTime); - } - + this.showOverlayIf('sliders', slider); this.config['sliders'][slider].overlays[layer] = this.showPolygon(this.config['sliders'][slider]); }, @@ -281,9 +276,7 @@ function gmapArcgis(config) { this.config['markers'][element].overlay = []; } - if (this.config['markers'][element].overlayTime != undefined) { - this.showOverlay(this.config['markers'][element].overlayTime); - } + this.showOverlayIf('markers', element); // Query parameters var query = { @@ -582,6 +575,7 @@ function gmapArcgis(config) { self.setCenter(center, true); } + self.unblockUI(); return params.overlay; }); }, @@ -624,7 +618,7 @@ function gmapArcgis(config) { addPanoramio: function() { if (this.config.panoramio.panoramioLayer == undefined) { var self = this; - this.showOverlay(1000); + this.showOverlay(); var photoDiv = document.createElement('div'); var photoWidgetOptions = this.config.panoramio.photoWidgetOptions; @@ -667,6 +661,8 @@ function gmapArcgis(config) { hWnd.resizeTo(screen.width, screen.height); } } + + this.unblockUI(); }, // Set the current map center, optionally updating the map |