| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- $(function() {
- });
- var infoWindow = false;
- function initialiseMarkers() {
- if(infoWindow == false) {
- infoWindow = new google.maps.InfoWindow();
- }
- $.get(window.location, {
- action: "get-tests"
- }, function(response) {
- if(!response.success) return;
- let tests = response.tests;
- let map = maps["map"];
- let bounds = new google.maps.LatLngBounds();
- for(let i in tests) {
- let test = tests[i];
- let latLng = {
- lat: test.geolocation[0],
- lng: test.geolocation[1]
- };
- bounds.extend(latLng);
- let markerOptions = {
- position: latLng,
- map: map,
- title: test.name
- };
- if(test.icon) {
- markerOptions.icon = "/img/markers/" + test.icon + ".png";
- }
- let marker = new google.maps.Marker(markerOptions);
- marker.addListener("click", function() {
- infoWindow.setContent("<strong>" + test.name + "</strong> " + "<span class=\"badge badge-" + test.statusClass + "\">" + test.status + "</span>" + "<br />" +
- "<small>" + test.address + "</small>"
- );
- infoWindow.open(map, marker);
- });
- }
- map.fitBounds(bounds);
- });
- }
|