PATCH : icons GoogleMAP ne s’affichent plus !

Depuis quelques jours, les icones GOOGLEMAP ne s’affichent plus dans ZADS (toutes versions avant 7.0.5 ) . La raison est que Google a décidé  d’arrêter de fournir le service « d’icons » appelé gmaps-samples. Veuillez suivre la procédure suivant pour PATCHer votre version de ZADS.

Editer le fichier ZADS.JS dans le repertoire /js/

Remplacer le fonction gmap_addMarker par le code ci-dessous

function gmap_addMarker(theloc,lid, it,lastit, totit, themap, what ) {

var adid=theloc.id;

// call gocoder for reverse address
if (theloc.loclatlng) {
// console.log(« calling directly with », theloc.loclatlng);
var myLatlng = new google.maps.LatLng(theloc.loclatlng.split(‘|’)[0],theloc.loclatlng.split(‘|’)[1]);
core_process_markers(myLatlng);
} else {
// console.log(« calling geocode with it/ lid, theloc.title », it, lid,theloc.title, theloc.location);
geocoder.geocode({‘address’ : theloc.location, ‘language’ : ‘en’ }, function(results, status) {
if (status == « OK ») {
core_process_markers(results[0].geometry.location);
} else {
// — case of error from geocoder
}
}); // end Geocode
}

function core_process_markers(thelocation){

var markit = lastit+it;

var labels=’ABCDEFGHIJKLMNOPQRSTUVWXYZ’;
var markerLabel = labels[(markit-1) % labels.length];

// DEPRECATED on GOOGLE
var markerImage= » »; // default
var iconImageUrl= » »; // default

//@Z6.8.1 custom markers
if (locale_settings.gmap_custom_marker_url){markerImage = locale_settings.gmap_custom_marker_url; iconImageUrl =locale_settings.gmap_custom_marker_url;}

// set the associated icons on displayed list
var theLI2= » »;
$(‘#adlist ul.post-list.maplist-view li’).each(function(i,e){
if ($(this).attr(‘id’)==theloc.id) { theLI2 = $(this); return false; }
});

// var theLI2 = $(LIselector);

if (theLI2.length==0) console.warn(« LI not found with selector », LIselector);

theMarker = theLI2.find(‘.map_markers’);
// theMarker.html(‘<img src= »‘+iconImageUrl+' »/>’);
theMarker.html(‘<span class= »marker-label »>’+markerLabel+'</span>’);

theMarker.find(‘span.marker-label’).click (function(e) {
e.preventDefault();
display_googleMapPopUp();
});
// add a marker for this position
var markerOptions = {
//title: title,
icon: markerImage,
label : markerLabel,
position: thelocation,
map: themap
// animation: google.maps.Animation.DROP
};
var mark =new google.maps.Marker(markerOptions);
gmap_markers[markit-1]= mark;

// set the action on click of the item
google.maps.event.addListener(mark,’click’, function(event) {
display_googleMapPopUp();
});

// common function to display the marker
function display_googleMapPopUp(){
mark_html = build_POP_addisplay(theloc,markit, totit,lid,what);
gmap_openInfoWindow(mark, mark_html);
$(‘ul.post-list li’).removeClass(« hasinfofocus »);
theLI2.addClass(« hasinfofocus »);
activate_handler_on_broken_images(‘#infowin IMG’); // activate broken image replacement
};
// set the action on click of the item
google.maps.event.addListener(mark,’mouseover’, function(event) {
theLI2.addClass(« hasfocus »);
});

// set the action on click of the item
google.maps.event.addListener(mark,’mouseout’, function(event) {
theLI2.removeClass(« hasfocus »);
});

// set default popoup displayed
if (it==1) {
google.maps.event.trigger(mark, ‘click’);
}

}

};

et ajouter à votre fichier CSS les style suivant :

.marker-label {
background-color : black;
margin: 2px 2px;
color : white;
cursor: pointer;
display: inline-block;
min-width: 16px;
text-align: center;
}

 

Pour les nostalgiques, vous pouvez retrouver les icones Google sous GITHUB

https://github.com/googlemaps/js-v2-samples