From 8a884f3dd2d10b520dd8cce2e2b18f47a53576f9 Mon Sep 17 00:00:00 2001 From: Alyx BB Date: Wed, 12 Jun 2024 04:22:01 +0100 Subject: [PATCH] improve map --- public/js/responsivemap.js | 45 ++++++-------------------------------- views/contact.tmpl | 7 +++++- 2 files changed, 13 insertions(+), 39 deletions(-) diff --git a/public/js/responsivemap.js b/public/js/responsivemap.js index a5ca9730..517938aa 100644 --- a/public/js/responsivemap.js +++ b/public/js/responsivemap.js @@ -1,38 +1,7 @@ -/*global google:true placeName*/ - -$(document).ready(function () { - //Google Maps JS - //Set Map - function initialize() { - var uryLocation = new google.maps.LatLng(Lat, Lng); - var mapOptions = { - zoom: 15, - center: uryLocation - }; - - var map = new google.maps.Map(document.getElementById("map"), mapOptions); - //Callout Content - var contentString = placeName; - //Set window width + content - var infowindow = new google.maps.InfoWindow({ - content: contentString, - maxWidth: 500 - }); - - //Add Marker - var marker = new google.maps.Marker({ - position: uryLocation, - map, - title: placeName - }); - - //Resize Function - google.maps.event.addDomListener(window, "resize", function () { - var center = map.getCenter(); - google.maps.event.trigger(map, "resize"); - map.setCenter(center); - }); - } - - google.maps.event.addDomListener(window, "load", initialize); -}); \ No newline at end of file +var map = L.map('map').setView([Lat, Lng], 15); +L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { + maxZoom: 19, + attribution: '© OpenStreetMap' +}).addTo(map); +var marker = L.marker([Lat, Lng]).addTo(map); +marker.bindPopup("University Radio York").openPopup(); diff --git a/views/contact.tmpl b/views/contact.tmpl index d72ed77f..0a9c90ef 100644 --- a/views/contact.tmpl +++ b/views/contact.tmpl @@ -10,6 +10,9 @@ + {{end}} {{define "content"}} @@ -145,6 +148,8 @@ var placeName = "{{.PageContext.LongName}}"; var Lat = {{.PageContext.Gmaps.Lat}}; var Lng = {{.PageContext.Gmaps.Lng}}; + - {{end}}