Widget:Google Maps: Unterschied zwischen den Versionen

Aus WikiSpeicher
 
(7 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 3: Zeile 3:


Created by [https://www.mediawikiwidgets.org/User:Sergey_Chernyshev Sergey Chernyshev]
Created by [https://www.mediawikiwidgets.org/User:Sergey_Chernyshev Sergey Chernyshev]
Modified by [https://vol-2.com Rolf Fleischmann]


== Using this widget ==
== Using this widget ==
Zeile 15: Zeile 16:
width: 100%;
width: 100%;
height: 0;
height: 0;
padding-bottom: 56%;
padding-bottom: 60%;
}
}
.mapContainer>div {
.mapContainer>div {
Zeile 26: Zeile 27:
</style>
</style>
<div id="map" class="mapContainer"></div>
<div id="map" class="mapContainer"></div>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB2VqCGNrS588hUiejVoi-Ycma2U-P4xJI&callback=initMap" async defer></script>
<script>
<script type="text/javascript">
var map;
var map;
function initMap() {
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: <!--{$lat|escape:'quotes'}-->, lng: <!--{$lng|escape:'quotes'}-->},
center: {lat: <!--{$lat|escape:'quotes'}-->, lng: <!--{$lng|escape:'quotes'}-->},
zoom: <!--{$zoom|escape:'quotes'|default:16}-->
zoom: <!--{$zoom|escape:'quotes'|default:16}-->,
mapTypeId: 'satellite'
});
});
var infoWin = new google.maps.InfoWindow();
var createMarker = function(markerLatLng,MarkerTitle,markerIcon,markerPopup) {
var createMarker = function(markerLatLng,MarkerTitle,markerIcon,markerLetter,markerPopup) {
var marker=new google.maps.Marker({
var marker=new google.maps.Marker({
position: markerLatLng,
position: markerLatLng,
map:map,
map:map,
title:MarkerTitle,
title:MarkerTitle,
icon: markerIcon
icon: markerIcon,
label: markerLetter
});
});
if (markerPopup) {
if (markerPopup) {
marker.addListener('click', function () {
marker.addListener('click', function () {
var infoWin = new google.maps.InfoWindow({content: markerPopup});
infoWin.setContent(markerPopup);
infoWin.open(map,marker);
infoWin.open(map,marker);
//marker.openInfoWindowHtml(markerPopup);
//marker.openInfoWindowHtml(markerPopup);
Zeile 53: Zeile 56:
}
}
<!--{foreach from=$marker item=m}-->
<!--{foreach from=$marker item=m}-->
var markerIcon='https://maps.google.com/mapfiles/ms/icons/red-dot.png';
var markerIcon='';
<!--{if isset($m.icon)}-->markerIcon='<!--{$m.icon|validate:url}-->';<!--{/if}-->
<!--{if isset($m.icon)}-->markerIcon='<!--{$m.icon|validate:url}-->';<!--{/if}-->
var markerLetter = '';
<!--{if isset($m.letter)}-->markerLetter='<!--{$m.letter|escape:'quotes'}-->';<!--{/if}-->
var markerLatLng = new google.maps.LatLng('<!--{$m.lat|escape:'quotes'}-->', '<!--{$m.lng|escape:'quotes'}-->');
var markerLatLng = new google.maps.LatLng('<!--{$m.lat|escape:'quotes'}-->', '<!--{$m.lng|escape:'quotes'}-->');
var markerPopup="";
var markerPopup="";
<!--{if isset($m.text)}-->markerPopup='<!--{$m.text|escape:'quotes'}-->';<!--{/if}-->
<!--{if isset($m.text)}-->markerPopup='<!--{$m.text|escape:'quotes'}-->';<!--{/if}-->
var marker = new createMarker(markerLatLng,'<!--{$m.title|escape:'quotes'}-->',markerIcon,markerPopup);
var marker = new createMarker(markerLatLng,'<!--{$m.title|escape:'quotes'}-->',markerIcon,markerLetter,markerPopup);
<!--{/foreach}-->
<!--{/foreach}-->
}
}
</script>
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB2VqCGNrS588hUiejVoi-Ycma2U-P4xJI&callback=initMap" async defer></script>
</includeonly>
</includeonly>

Aktuelle Version vom 29. August 2018, 20:09 Uhr

This widget allows you to add Google Maps widget to your wiki page.

Created by Sergey Chernyshev Modified by Rolf Fleischmann

Using this widget

For information on how to use this widget, see widget description page on MediaWikiWidgets.org.

Copy to your site

To use this widget on your site, just install MediaWiki Widgets extension and copy the full source code of this page to your wiki as page Widget:Google Maps.