Changeset 1489 in t29-www


Ignore:
Timestamp:
Jan 12, 2019, 6:28:22 PM (2 months ago)
Author:
sven
Message:

Impressum: Google-Maps-Karte

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • de/impressum.php

    r1487 r1489  
    33        $version = '$Id$';
    44        $titel = 'Impressum';
    5         $header_scripte = array(
    6                 'http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAAraTKZ5cINardZ8ITNVssKhRcOoEBtCgYLJRQznXYEV8m1M3fRRRT9wMSvFwhyo62fD3KyiwQxe5ruw',
    7                 '/shared/js/gmaps-impressum.js'
     5        $header_prepend = array( # Open Source https://leafletjs.com library for OpenStreetMaps
     6                '<link rel="stylesheet" href="https://unpkg.com/leaflet@1.4.0/dist/leaflet.css" />',
     7                '<script src="https://unpkg.com/leaflet@1.4.0/dist/leaflet.js"></script>'
    88        );
    99       
     
    3535     <p>Wir sind Mitglied in der <a class="arrow" href="http://www.gfgf.org" title="www.gfgf.org">Gesellschaft der Freunde der Geschichte des Funkwesens e.V.</a> und im <a class="arrow" href="http://www.fitg.de" title="www.fitg.de">Förderkreis für Industrie- und Technikgeschichte e.V.</a> (Frankfurt).</p>
    3636
    37      <!-- Lage Anfahrt: Google Maps deaktiviert, weil das Einbetten der Karte mittlerweile Geld kostet; https://cloud.google.com/maps-platform/user-guide/account-changes?utm_source=maps_js&utm_medium=degraded&utm_campaign=keyless -->
    38      <!--
    3937        <h3>Lage / Anfahrt</h3>
    4038        <div id="map" style="border: 1px solid #979797; background-color: #e5e3df; height: 320px;">
    41         <div style="padding: 1em; color: gray">Karte wird geladen ...</div>
     39        <div style="padding: 1em; color: gray"><span class="js">Karte wird geladen ...</span></div>
    4240                <noscript>
    4341                        <p>Zur <a href="http://maps.google.de/maps?f=q&hl=de&q=Flachsland+29,+Kelkheim&layer=&sll=50.092393,10.195313&sspn=38.370164,57.392578&ie=UTF8&z=16&om=1&iwloc=addr" class="go">Wegbeschreibung bei Google Maps</a>
    4442                </noscript>
    4543        </div>
    46       -->
    4744
    4845        <h3 id="image-copyright">Hinweise für die Nutzung von Bildern aus der Website des  technikum29</h3>
  • en/contact.php

    r1487 r1489  
    33        $version = '$Id$';
    44        $title = 'Contact';
     5        $header_prepend = array( # Open Source https://leafletjs.com library for OpenStreetMaps
     6                '<link rel="stylesheet" href="https://unpkg.com/leaflet@1.4.0/dist/leaflet.css" />',
     7                '<script src="https://unpkg.com/leaflet@1.4.0/dist/leaflet.js"></script>'
     8        );
    59       
    610        require "../lib/technikum29.php";
     
    2226    </div>
    2327
    24     <!-- Broken since June 2018 since Google changed its policies and wants to have money. TODO: Switch to another maps provider -->
    25     <!--
    26         <h3>Location</h3>
     28        <h3>Location</h3>
    2729        <div id="map" style="border: 1px solid #979797; background-color: #e5e3df; height: 320px;">
    28         <div style="padding: 1em; color: gray">Please stand by while maps is loading ...</div>
     30        <div style="padding: 1em; color: gray"><span class="js">Map is being loaded ...</span></div>
    2931                <noscript>
    30                         <p>Sorry, your browser doesn't understand javascript. See the <a href="http://maps.google.com/maps?f=q&source=s_q&hl=de&geocode=&q=Am+Flachsland+29,+65779+Kelkheim,+Deutschland&sll=50.275299,8.745117&sspn=7.598462,15.930176&ie=UTF8&hq=&hnear=Am+Flachsland+29,+65779+Kelkheim+(Taunus),+Main-Taunus-Kreis,+Hessen,+Deutschland&ll=50.373496,6.855469&spn=15.17797,31.860352&z=5" class="go">Our location at Google Maps</a>
     32                        <p>See <a href="http://maps.google.com/maps?f=q&source=s_q&hl=de&geocode=&q=Am+Flachsland+29,+65779+Kelkheim,+Deutschland&sll=50.275299,8.745117&sspn=7.598462,15.930176&ie=UTF8&hq=&hnear=Am+Flachsland+29,+65779+Kelkheim+(Taunus),+Main-Taunus-Kreis,+Hessen,+Deutschland&ll=50.373496,6.855469&spn=15.17797,31.860352&z=5" class="go">our location at Google Maps</a>
    3133                </noscript>
    32     </div>
    33     -->
     34        </div>
    3435
    3536    <h3 id="image-copyright">Image use policy and information about reusing technikum29 website contents</h3>
  • shared/js-v6/pagescripts/impressum.js

    r301 r1489  
    11/**
    2  * technikum29.de | Google Maps widget for imprint page
    3  *
    4  * Dieses JavaScript wird auf den Impressumsseiten eingebunden, um
    5  * per Google Maps API diese einzubinden. Dazu ist noch ein kurzes
    6  * Schnipsel HTML in der Form <div id="map">...</div> noetig,
    7  * ausserdem muss dieses JavaScript eingebunden werden:
    8  * <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAAraTKZ5cINardZ8ITNVssKhRcOoEBtCgYLJRQznXYEV8m1M3fRRRT9wMSvFwhyo62fD3KyiwQxe5ruw" type="text/javascript"></script>
    9  *
    10  * Als Konstanten koennen in diesem Script bearbeitet werden:
    11  *  * Der Google Maps API Key
    12  *  * Der Inhalt der Sprechblasen an der Museumsposition
    13  *    fuer die jeweilige Sprache
    14  *  * Die Ausgansposition der Karte fuer die jeweilige Sprache
    15  *
    16  * 2009 Sven Koeppel $Id$
    17  * Released under the public domain
     2 * technikum29 OpenStreetMapss / Leaflet maps widget
     3 * Successor of the Google Maps widget from 2009-2018.
     4 * Installed by Sven at 2019-01-12
     5 *
     6 * Requires the Leaflet scripts/css available, cf. https://leafletjs.com/download.html
    187 **/
    198
    20 // if not on this domain => deactivate script since google
    21 // will print out error otherwise
    22 var t29_gmaps_valid_domain = "www.technikum29.de";
    23  
    249var t29_gmaps_content = {
    2510        "de": "<b>technikum29</b><br/>Am Flachsland 29<br/>Kelkheim/Taunus"
     
    2813};
    2914
    30 var t29_gmaps_center = {
     15
     16var t29_maps_center = {
    3117        // map.setCenter(new GLatLng( .. , .. ), .. )
    32         // so [     xpos        ,      ypos        , zoom]
    33         "de": [50.12101835522268, 8.510284423828125, 11],
    34         "en": [51.6452940493054,  8.173828125,       5]
     18        // so [     xpos/lat        ,      ypos        ]
     19        "de": [50.08005710712455, 8.510284423828125],
     20        "en": [51.6452940493054,  8.173828125      ]
    3521};
     22
     23var t29_maps_zoom = { "de": 11, "en": 5 };
     24
     25// Position of museum
     26var t29_maps_pos = [ 50.14522,8.44604 ];
     27
    3628
    3729function t29_gmaps_detect_page_language() {
     
    4032}
    4133
    42 // das schnipsel hier geht unterm IE sowieso nicht:
    43 function t29_gmaps_include_once(src) {
    44     // hole alle vorhandenen Script-Elemente
    45     var scripts = document.getElementsByTagName('script');
    46 
    47     if(scripts) {
    48         for(var k=0; k<scripts.length; k++) {
    49                         // script schon geladen, abbrechen
    50             if(scripts[k].src == src)
    51               return;
    52                 }
    53         }
    54 
    55     // script noch nicht geladen, binde es ein
    56     var script = document.createElement('script');
    57     script.src = src;
    58     script.type = 'text/javascript';
    59     (document.getElementsByTagName('HEAD')[0] || document.body).appendChild(script);
    60 }
    61 
    62 // damit verweigert Google den Dienst (unter localhost gehts aber...)
    63 //t29_gmaps_include_once("http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key="+t29_gmaps_key);
    64 
    65 var gmap;
    6634$(function() {
    6735        var lang = t29_gmaps_detect_page_language();
     36        var map = L.map('map').setView(t29_maps_center[lang], t29_maps_zoom[lang]);
     37        if(t29) t29.map = map; // save back for debugging
    6838
    69         if(location.hostname != t29_gmaps_valid_domain) {
    70                 document.getElementById("map").getElementsByTagName("div")[0].firstChild.data =
    71                         "Karte kann nur auf www.technikum29.de geladen werden, nicht auf anderen Kopien der Homepage!";
    72         }
     39        L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
     40            attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
     41        }).addTo(map);
    7342
    74         if(GBrowserIsCompatible()) {
    75                 var map = new GMap2(document.getElementById("map"));
    76                 gmap = map;
    77                 map.setUIToDefault();
    78 
    79                 // Position vom Museum
    80                 var t29_pos = new GLatLng(50.145129,8.445667);
    81 
    82                 // Uebersichtsfensterchen rechts unten, will Heribert nicht
    83                 //map.addControl(new GOverviewMapControl(new GSize(200,150)));
    84                
    85                 // Zentrum der Karte, kann mit Firebug (gmap.getCenter(), gmap.getZoom())
    86                 // nach rumschieben bestimmt werden.
    87                 map.setCenter(new GLatLng(t29_gmaps_center[lang][0], t29_gmaps_center[lang][1]), t29_gmaps_center[lang][2]);
    88                
    89                 //map.setMapType(G_HYBRID_MAP);
    90                 map.enableContinuousZoom();
    91                 var marker = new GMarker(t29_pos);
    92                 map.addOverlay(marker);
    93                
    94                 // fenster anzeigen
    95                 GEvent.addListener(marker, "click", function() {
    96                         marker.openInfoWindowHtml(t29_gmaps_content[lang]);
    97                 });
    98                 marker.openInfoWindowHtml(t29_gmaps_content[lang]);
    99         }
     43        L.marker(t29_maps_pos).addTo(map)
     44            .bindPopup(t29_gmaps_content[lang])
     45            .openPopup();
    10046});
    101 
Note: See TracChangeset for help on using the changeset viewer.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License