[MediaWiki-commits] [Gerrit] Maps fix - removed info windows for markers without a title - change (mediawiki...Cargo)
Yaron Koren has uploaded a new change for review. https://gerrit.wikimedia.org/r/238162 Change subject: Maps fix - removed info windows for markers without a title .. Maps fix - removed info windows for markers without a title Also a smaller fix involving a global variable. Change-Id: Ie33248545b3926d609d51291ca06f01943aee05f --- M libs/ext.cargo.maps.js 1 file changed, 27 insertions(+), 21 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cargo refs/changes/62/238162/1 diff --git a/libs/ext.cargo.maps.js b/libs/ext.cargo.maps.js index 5b51fbe..240d186 100644 --- a/libs/ext.cargo.maps.js +++ b/libs/ext.cargo.maps.js @@ -98,9 +98,11 @@ var infoWindows = []; var numItems = this.allItemValues.length; for ( i = 0; i < numItems; i++ ) { - infoWindows[i] = new google.maps.InfoWindow({ - content: CargoMap.createPopupHTMLForRow( this.allItemValues[i] ) - }); + if ( this.allItemValues[i]['title'] != null ) { + infoWindows[i] = new google.maps.InfoWindow({ + content: CargoMap.createPopupHTMLForRow( this.allItemValues[i] ) + }); + } } if ( doMarkerClustering ) { @@ -123,12 +125,14 @@ markers.push( marker ); } - google.maps.event.addListener(marker, 'click', function() { - for ( i = 0; i < numItems; i++ ) { - infoWindows[i].close(); - } - infoWindows[this.itemNum].open(map,this); - }); + if ( curItem['title'] != null ) { + google.maps.event.addListener(marker, 'click', function() { + for ( i = 0; i < numItems; i++ ) { + infoWindows[i].close(); + } + infoWindows[this.itemNum].open(map,this); + }); + } } if ( doMarkerClustering ) { var mc = new MarkerClusterer( map, markers ); @@ -185,17 +189,19 @@ } markers.addMarker( marker ); - marker.events.register( 'mousedown', feature, function(evt) { - if (this.popup == null ) { - this.popup = this.createPopup( true ); - map.addPopup( this.popup ); - this.popup.show(); - } else { - this.popup.toggle(); - } - currentPopup = this.popup; - OpenLayers.Event.stop( evt ); - }); + if ( curItem['title'] != null ) { + marker.events.register( 'mousedown', feature, function(evt) { + if (this.popup == null ) { + this.popup = this.createPopup( true ); + map.addPopup( this.popup ); + this.popup.show(); + } else { + this.popup.toggle(); + } + currentPopup = this.popup; + OpenLayers.Event.stop( evt ); + }); + } } } @@ -205,7 +211,7 @@ var valuesForMap = jQuery.parseJSON(mapDataText); var mappingService = $(this).find(".cargoMapData").attr('mappingService'); var zoomLevel = $(this).find(".cargoMapData").attr('zoom'); - var doMarkerClustering = valuesForMap.length >= wgCargoMapClusteringMinimum; + var doMarkerClustering = valuesForMap.length >= mw.config.get( 'wgCargoMapClusteringMinimum' ); var cargoMap = new CargoMap( valuesForMap, $(this).attr('id'), zoomLevel ); cargoMap.display( mappingService, doMarkerClustering ); }); -- To view, visit https://gerrit.wikimedia.org/r/238162 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie33248545b3926d609d51291ca06f01943aee05f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Cargo Gerrit-Branch: master Gerrit-Owner: Yaron Koren___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Maps fix - removed info windows for markers without a title - change (mediawiki...Cargo)
Yaron Koren has submitted this change and it was merged. Change subject: Maps fix - removed info windows for markers without a title .. Maps fix - removed info windows for markers without a title Also a smaller fix involving a global variable. Change-Id: Ie33248545b3926d609d51291ca06f01943aee05f --- M libs/ext.cargo.maps.js 1 file changed, 27 insertions(+), 21 deletions(-) Approvals: Yaron Koren: Checked; Looks good to me, approved diff --git a/libs/ext.cargo.maps.js b/libs/ext.cargo.maps.js index 5b51fbe..240d186 100644 --- a/libs/ext.cargo.maps.js +++ b/libs/ext.cargo.maps.js @@ -98,9 +98,11 @@ var infoWindows = []; var numItems = this.allItemValues.length; for ( i = 0; i < numItems; i++ ) { - infoWindows[i] = new google.maps.InfoWindow({ - content: CargoMap.createPopupHTMLForRow( this.allItemValues[i] ) - }); + if ( this.allItemValues[i]['title'] != null ) { + infoWindows[i] = new google.maps.InfoWindow({ + content: CargoMap.createPopupHTMLForRow( this.allItemValues[i] ) + }); + } } if ( doMarkerClustering ) { @@ -123,12 +125,14 @@ markers.push( marker ); } - google.maps.event.addListener(marker, 'click', function() { - for ( i = 0; i < numItems; i++ ) { - infoWindows[i].close(); - } - infoWindows[this.itemNum].open(map,this); - }); + if ( curItem['title'] != null ) { + google.maps.event.addListener(marker, 'click', function() { + for ( i = 0; i < numItems; i++ ) { + infoWindows[i].close(); + } + infoWindows[this.itemNum].open(map,this); + }); + } } if ( doMarkerClustering ) { var mc = new MarkerClusterer( map, markers ); @@ -185,17 +189,19 @@ } markers.addMarker( marker ); - marker.events.register( 'mousedown', feature, function(evt) { - if (this.popup == null ) { - this.popup = this.createPopup( true ); - map.addPopup( this.popup ); - this.popup.show(); - } else { - this.popup.toggle(); - } - currentPopup = this.popup; - OpenLayers.Event.stop( evt ); - }); + if ( curItem['title'] != null ) { + marker.events.register( 'mousedown', feature, function(evt) { + if (this.popup == null ) { + this.popup = this.createPopup( true ); + map.addPopup( this.popup ); + this.popup.show(); + } else { + this.popup.toggle(); + } + currentPopup = this.popup; + OpenLayers.Event.stop( evt ); + }); + } } } @@ -205,7 +211,7 @@ var valuesForMap = jQuery.parseJSON(mapDataText); var mappingService = $(this).find(".cargoMapData").attr('mappingService'); var zoomLevel = $(this).find(".cargoMapData").attr('zoom'); - var doMarkerClustering = valuesForMap.length >= wgCargoMapClusteringMinimum; + var doMarkerClustering = valuesForMap.length >= mw.config.get( 'wgCargoMapClusteringMinimum' ); var cargoMap = new CargoMap( valuesForMap, $(this).attr('id'), zoomLevel ); cargoMap.display( mappingService, doMarkerClustering ); }); -- To view, visit https://gerrit.wikimedia.org/r/238162 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie33248545b3926d609d51291ca06f01943aee05f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Cargo Gerrit-Branch: master Gerrit-Owner: Yaron KorenGerrit-Reviewer: Yaron Koren Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits