Widget:Google Maps: Unterschied zwischen den Versionen
Aus WikiSpeicher
Admin (Diskussion | Beiträge) (Die Seite wurde neu angelegt: «<noinclude>__NOTOC__ This widget allows you to add '''[http://code.google.com/apis/maps/ Google Maps]''' widget to your wiki page. Created by [http://w2ww.mediaw…») |
Admin (Diskussion | Beiträge) |
||
(30 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
<noinclude>__NOTOC__ | <noinclude>__NOTOC__ | ||
This widget allows you to add '''[ | This widget allows you to add '''[https://code.google.com/apis/maps/ Google Maps]''' widget to your wiki page. | ||
Created by [ | 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 == | ||
For information on how to use this widget, see [ | For information on how to use this widget, see [https://www.mediawikiwidgets.org/Google_Maps widget description page on MediaWikiWidgets.org]. | ||
== Copy to your site == | == Copy to your site == | ||
To use this widget on your site, just install [ | To use this widget on your site, just install [https://www.mediawiki.org/wiki/Extension:Widgets MediaWiki Widgets extension] and copy the [{{fullurl:{{FULLPAGENAME}}|action=edit}} full source code] of this page to your wiki as page '''{{FULLPAGENAME}}'''. | ||
</noinclude><includeonly>< | </noinclude><includeonly> | ||
<script | <style> | ||
.mapContainer { | |||
position: relative; | |||
width: 100%; | |||
height: 0; | |||
padding-bottom: 60%; | |||
} | |||
.mapContainer>div { | |||
{ | position: absolute; | ||
left:0; | |||
top:0; | |||
width: 100%; | |||
height: 100%; | |||
} | |||
var createMarker = function(markerLatLng,MarkerTitle,markerIcon,markerPopup) { | </style> | ||
var marker=new google.maps.Marker(markerLatLng, | <div id="map" class="mapContainer"></div> | ||
<script> | |||
var map; | |||
function initMap() { | |||
map = new google.maps.Map(document.getElementById('map'), { | |||
center: {lat: <!--{$lat|escape:'quotes'}-->, lng: <!--{$lng|escape:'quotes'}-->}, | |||
zoom: <!--{$zoom|escape:'quotes'|default:16}-->, | |||
mapTypeId: 'satellite' | |||
}); | |||
var infoWin = new google.maps.InfoWindow(); | |||
var createMarker = function(markerLatLng,MarkerTitle,markerIcon,markerLetter,markerPopup) { | |||
var marker=new google.maps.Marker({ | |||
position: markerLatLng, | |||
map:map, | |||
title:MarkerTitle, | |||
icon: markerIcon, | |||
label: markerLetter | |||
}); | |||
if (markerPopup) { | if (markerPopup) { | ||
marker.addListener('click', function () { | |||
marker.openInfoWindowHtml(markerPopup); | infoWin.setContent(markerPopup); | ||
infoWin.open(map,marker); | |||
//marker.openInfoWindowHtml(markerPopup); | |||
}); | }); | ||
} | } | ||
Zeile 34: | Zeile 56: | ||
} | } | ||
<!--{foreach from=$marker item=m}--> | <!--{foreach from=$marker item=m}--> | ||
var markerIcon= | var markerIcon=''; | ||
<!--{if isset($m. | <!--{if isset($m.icon)}-->markerIcon='<!--{$m.icon|validate:url}-->';<!--{/if}--> | ||
<!--{if isset($m. | var markerLetter = ''; | ||
var markerLatLng = new | <!--{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 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> |
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.