You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
7 lines
5.7 KiB
7 lines
5.7 KiB
function loadMapsAPI(){ldelim}if(window.google&&google.maps)return;{rdelim}window.initMap=function(){ldelim}{rdelim} |
|
loadMapsAPI();$(document).ready(function(){ldelim}loadMap{$gmap.id}();{rdelim});var defaultZoom{$gmap.id}={$gmap.gmap_zoom};var map{$gmap.id};var infowindow{$gmap.id};var markerList{$gmap.id}=[];function loadMap{$gmap.id}(){ldelim}console.log('loadMap');var defaultLatlng{$gmap.id}=new google.maps.LatLng({$gmap.latitude},{$gmap.longitude});var myOptions{$gmap.id}={ldelim}zoom:defaultZoom{$gmap.id},center:defaultLatlng{$gmap.id},mapTypeId:google.maps.MapTypeId.ROADMAP{rdelim};map{$gmap.id}=new google.maps.Map(document.getElementById("myMap{$gmap.id}"),myOptions{$gmap.id});infowindow{$gmap.id}=new google.maps.InfoWindow({ldelim}maxWidth:700{rdelim});loadMarkers{$gmap.id}();{rdelim} |
|
function loadMarkers{$gmap.id}(){ldelim}var lmarkers{$gmap.id}={$markers};$.each(lmarkers{$gmap.id},function(i,item){ldelim}loadMarker{$gmap.id}(item);{rdelim});{rdelim} |
|
function loadMarker{$gmap.id}(markerData){ldelim}var myLatlng=new google.maps.LatLng(markerData['latitude'],markerData['longitude']);var image='/modules/gmap/images/'+markerData['image']+'.png';if(markerData['img_title']!='/modules/gmap/img/no_image.png'){ldelim}var a_stimg="<img style=\"margin: 0px 10px 0px 0px;\" src=\"/index.php?thumb="+markerData['img_title']+"&height=64&width=64&mode=f\">";{rdelim}else{ldelim}var a_stimg="<img style=\"margin: 0px 10px 10px 0px;\" src=\"/modules/gmap/img/no_image.png\">";{rdelim};if(markerData['marker_cat_title']!=''){ldelim}if(markerData['marker_cat_link']=='/'||markerData['marker_cat_link']=='javascript:void(0);'){ldelim}var a_categ="<li><a style=\"color:#828282; font-size:11px; text-decoration:none;\" onmouseover=\"this.style.color='#181818';\" onmouseout=\"this.style.color='#828282';\" href=\""+markerData['marker_cat_link']+"\">"+markerData['marker_cat_title']+"</a></li>";{rdelim}else{ldelim}var a_categ="<li><a style=\"color:#828282; font-size:11px; text-decoration:none;\" onmouseover=\"this.style.color='#181818';\" onmouseout=\"this.style.color='#828282';\" href=\"/"+markerData['marker_cat_link']+"\">"+markerData['marker_cat_title']+"</a></li>";{rdelim}{rdelim}else{ldelim}var a_categ='';{rdelim};if(markerData['title']!=''){ldelim}if(markerData['title_link']=='/'||markerData['title_link']=='javascript:void(0);'){ldelim}var a_title="<li><a style=\"color:#181818; font-size:18px; text-decoration:none; border-bottom:2px solid;\" onmouseover=\"this.style.color='#FF6600';\" onmouseout=\"this.style.color='#181818';\" href=\""+markerData['title_link']+"\"><strong>"+markerData['title']+"</strong></a></li>";{rdelim}else{ldelim}var a_title="<li><a style=\"color:#181818; font-size:18px; text-decoration:none; border-bottom:2px solid;\" onmouseover=\"this.style.color='#FF6600';\" onmouseout=\"this.style.color='#181818';\" href=\"/"+markerData['title_link']+"\"><strong>"+markerData['title']+"</strong></a></li>";{rdelim}{rdelim}else{ldelim}var a_title='';{rdelim};if(markerData['marker_street']!=''){ldelim}var a_city="<li><span style=\"font-size:12px; color:#68809B;\">"+markerData['marker_city']+", "+markerData['marker_street']+", "+markerData['marker_building']+"</span></li>";{rdelim}else{ldelim}var a_city='';{rdelim};if(markerData['marker_dopfield']!=''){ldelim}var a_dopfield="<li><div style=\"max-width:280px; white-space: normal !important; color:#828282;\">"+markerData['marker_dopfield']+"</div></li>";{rdelim}else{ldelim}var a_dopfield='';{rdelim};if(markerData['marker_phone']!=''){ldelim}var a_phone="<li><img src=\"{$ABS_PATH}modules/gmap/img/phone.png\">"+markerData['marker_phone']+"</li>";{rdelim}else{ldelim}var a_phone='';{rdelim};if(markerData['marker_www']!=''){ldelim}var a_placeholders=new Array('http://www.','https://www.','http://','https://');var a_www="<li><a style=\"font-size:12px; color:#828282; text-decoration:none;\" onmouseover=\"this.style.color='#181818';\" onmouseout=\"this.style.color='#828282';\" href=\""+markerData['marker_www']+"\"><img src=\"{$ABS_PATH}modules/gmap/img/url.png\">"+str_replace(a_placeholders,'www.',markerData['marker_www'])+"</a></li>";{rdelim}else{ldelim} |
|
var a_www='';{rdelim};var a_divs="<div style=\"white-space: nowrap; overflow:hidden; min-height: 64px; \">";var a_dive="</div>";var a_uls="<ul style=\"list-style:none; margin-top:-68px; margin-left: 30px;\">";var a_ultws="<ul style=\"margin-top:-8px; list-style:none; text-align: center;\">";var a_ule="</ul>";var content=a_divs+a_stimg+a_uls+a_categ+a_title+a_city+a_dopfield+a_ule+a_ultws+a_phone+a_www+a_ule+a_dive;var marker=new google.maps.Marker({ldelim}id:markerData['id'],map:map{$gmap.id},content:content,icon:image,position:myLatlng{rdelim});markerList{$gmap.id}[marker.id]=marker;google.maps.event.addListener(marker,'click',function(){ldelim}showMarker{$gmap.id}(marker.id);{rdelim});{rdelim} |
|
function showMarker{$gmap.id}(markerId){ldelim}var marker=markerList{$gmap.id}[markerId];if(marker){ldelim}infowindow{$gmap.id}.setContent(marker.content);infowindow{$gmap.id}.open(map{$gmap.id},marker);{rdelim}else{ldelim}alert('Error marker not found: '+markerId);{rdelim}{rdelim} |
|
function str_replace(search,replace,subject){ldelim}if(!(replace instanceof Array)){ldelim}replace=new Array(replace);if(search instanceof Array){ldelim}while(search.length>replace.length){ldelim}replace[replace.length]=replace[0];{rdelim}{rdelim}{rdelim}if(!(search instanceof Array))search=new Array(search);while(search.length>replace.length){ldelim}replace[replace.length]='';{rdelim}if(subject instanceof Array){ldelim}for(k in subject){ldelim}subject[k]=str_replace(search,replace,subject[k]);{rdelim}return subject;{rdelim}for(var k=0;k<search.length;k++){ldelim}var i=subject.indexOf(search[k]);while(i>-1){ldelim}subject=subject.replace(search[k],replace[k]);i=subject.indexOf(search[k],i);{rdelim}{rdelim}return subject;{rdelim} |