From 8cd3226f12fc1a3703a6914e856e3059234e1742 Mon Sep 17 00:00:00 2001 From: flopp Date: Fri, 26 Oct 2012 17:33:29 +0200 Subject: [PATCH] added hack to disable clickable POIs in google maps --- htdocs/templates2/ocstyle/map2.tpl | 20 +++++++++++++++++--- htdocs/templates2/ocstyle/map2full.tpl | 18 ++++++++++++++++-- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/htdocs/templates2/ocstyle/map2.tpl b/htdocs/templates2/ocstyle/map2.tpl index 4261500d..dece00c7 100644 --- a/htdocs/templates2/ocstyle/map2.tpl +++ b/htdocs/templates2/ocstyle/map2.tpl @@ -502,7 +502,21 @@ function mapLoad() google.maps.event.addListener(moMap, "dragend", function(){map_moveend()}); google.maps.event.addListener(moMap, "zoom_changed", function(){map_moveend()}); google.maps.event.addListener(moMap, "maptypeid_changed", function(){map_maptypechanged()}); - + + /* hack to suppress google's info windows, when clicking on POIs */ + /* inspired by http://stackoverflow.com/questions/7950030/can-i-remove-just-the-popup-bubbles-of-pois-in-google-maps-api-v3 */ + /* patch "InfoWindow.open"-method such that a window is only opened if "force" is true */ + { + var proto = google.maps.InfoWindow.prototype, + open = proto.open; + proto.open = function( map, anchor, force ) { + if( force ) { + return open.apply( this, arguments ); + } + } + } + /**/ + if (msInitWaypoint != "") { show_cachepopup_wp(msInitWaypoint, true); @@ -705,7 +719,7 @@ function searchlist_openitem(nIndex) moInfoWindow.close(); moInfoWindow = new google.maps.InfoWindow({ position: oCoords, content: xmlentities(sText) }); - moInfoWindow.open( moMap ); + moInfoWindow.open( moMap, null, true ); data_load(); } @@ -873,7 +887,7 @@ function show_cachepopup_url(sURL, sWaypoint, bAllowZoomChange) var oPopupHTML = parseXML_GetHTML(oXML); moInfoWindow = new google.maps.InfoWindow({ position: oCoords, content: oPopupHTML }); - moInfoWindow.open( moMap ); + moInfoWindow.open( moMap, null, true ); }); } diff --git a/htdocs/templates2/ocstyle/map2full.tpl b/htdocs/templates2/ocstyle/map2full.tpl index b80d1654..c2d4d229 100644 --- a/htdocs/templates2/ocstyle/map2full.tpl +++ b/htdocs/templates2/ocstyle/map2full.tpl @@ -507,6 +507,20 @@ function mapLoad() google.maps.event.addListener(moMap, "zoom_changed", function(){map_moveend()}); google.maps.event.addListener(moMap, "maptypeid_changed", function(){map_maptypechanged()}); + /* hack to suppress google's info windows, when clicking on POIs */ + /* inspired by http://stackoverflow.com/questions/7950030/can-i-remove-just-the-popup-bubbles-of-pois-in-google-maps-api-v3 */ + /* patch "InfoWindow.open"-method such that a window is only opened if "force" is true */ + { + var proto = google.maps.InfoWindow.prototype, + open = proto.open; + proto.open = function( map, anchor, force ) { + if( force ) { + return open.apply( this, arguments ); + } + } + } + /**/ + if (msInitWaypoint != "") { show_cachepopup_wp(msInitWaypoint, true); @@ -709,7 +723,7 @@ function searchlist_openitem(nIndex) moInfoWindow.close(); moInfoWindow = new google.maps.InfoWindow({ position: oCoords, content: xmlentities(sText) }); - moInfoWindow.open( moMap ); + moInfoWindow.open( moMap, null, true ); data_load(); } @@ -877,7 +891,7 @@ function show_cachepopup_url(sURL, sWaypoint, bAllowZoomChange) var oPopupHTML = parseXML_GetHTML(oXML); moInfoWindow = new google.maps.InfoWindow({ position: oCoords, content: oPopupHTML }); - moInfoWindow.open( moMap ); + moInfoWindow.open( moMap, null, true ); }); }