PageSourceSearch

https://www.southwell-lions.org/wp-content/themes/council-wcag/js/map.js?ver=1.6

js southwell-lions.org collected 2026-10-04 02:10:29 UTC 12,448 bytes, 443 lines download raw bytes

1// JavaScript Document
2
3var map;
4var labels = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
5var labelIndex = 0;
6var neighborhoods = [];
7var markerPosition;
8var markers = [];
9var canvasId = '';
10
11
12function initialize(elementId) {
13    var myLatlng = new google.maps.LatLng(52.0486092, -0.8220668);
14
15    canvasId = elementId;
16
17    mapx = new google.maps.Map(document.getElementById(canvasId), {
18        zoom: 12,
19        scrollwheel: false,
20        center: myLatlng,
21        disableDefaultUI: true,
22        zoomControl: true,
23        styles: [
24            {
25                "featureType": "water",
26                "elementType": "geometry",
27                "stylers": [
28                    {
29                        "color": "#e9e9e9"
30                    },
31                    {
32                        "lightness": 17
33                    }
34                ]
35            },
36            {
37                "featureType": "landscape",
38                "elementType": "geometry",
39                "stylers": [
40                    {
41                        "color": "#f5f5f5"
42                    },
43                    {
44                        "lightness": 20
45                    }
46                ]
47            },
48            {
49                "featureType": "road.highway",
50                "elementType": "geometry.fill",
51                "stylers": [
52                    {
53                        "color": "#ffffff"
54                    },
55                    {
56                        "lightness": 17
57                    }
58                ]
59            },
60            {
61                "featureType": "road.highway",
62                "elementType": "geometry.stroke",
63                "stylers": [
64                    {
65                        "color": "#ffffff"
66                    },
67                    {
68                        "lightness": 29
69                    },
70                    {
71                        "weight": 0.2
72                    }
73                ]
74            },
75            {
76                "featureType": "road.arterial",
77                "elementType": "geometry",
78                "stylers": [
79                    {
80                        "color": "#ffffff"
81                    },
82                    {
83                        "lightness": 18
84                    }
85                ]
86            },
87            {
88                "featureType": "road.local",
89                "elementType": "geometry",
90                "stylers": [
91                    {
92                        "color": "#ffffff"
93                    },
94                    {
95                        "lightness": 16
96                    }
97                ]
98            },
99            {
100                "featureType": "poi",
101                "elementType": "geometry",
102                "stylers": [
103                    {
104                        "color": "#f5f5f5"
105                    },
106                    {
107                        "lightness": 21
108                    }
109                ]
110            },
111            {
112                "featureType": "poi.park",
113                "elementType": "geometry",
114                "stylers": [
115                    {
116                        "color": "#dedede"
117                    },
118                    {
119                        "lightness": 21
120                    }
121                ]
122            },
123            {
124                "elementType": "labels.text.stroke",
125                "stylers": [
126                    {
127                        "visibility": "on"
128                    },
129                    {
130                        "color": "#ffffff"
131                    },
132                    {
133                        "lightness": 16
134                    }
135                ]
136            },
137            {
138                "elementType": "labels.text.fill",
139                "stylers": [
140                    {
141                        "saturation": 36
142                    },
143                    {
144                        "color": "#333333"
145                    },
146                    {
147                        "lightness": 40
148                    }
149                ]
150            },
151            {
152                "elementType": "labels.icon",
153                "stylers": [
154                    {
155                        "visibility": "off"
156                    }
157                ]
158            },
159            {
160                "featureType": "transit",
161                "elementType": "geometry",
162                "stylers": [
163                    {
164                        "color": "#f2f2f2"
165                    },
166                    {
167                        "lightness": 19
168                    }
169                ]
170            },
171            {
172                "featureType": "administrative",
173                "elementType": "geometry.fill",
174                "stylers": [
175                    {
176                        "color": "#fefefe"
177                    },
178                    {
179                        "lightness": 20
180                    }
181                ]
182            },
183            {
184                "featureType": "administrative",
185                "elementType": "geometry.stroke",
186                "stylers": [
187                    {
188                        "color": "#fefefe"
189                    },
190                    {
191                        "lightness": 17
192                    },
193                    {
194                        "weight": 1.2
195                    }
196                ]
197            }
198        ]
199    });
200
201    // google.maps.event.addListener(map, 'click', function(event) {
202    // 	console.log(event);
203    // 	addMarker(event.latLng, map);
204    // });
205
206    //var marker = new google.maps.Marker({
207    //var marker = new google.maps.Marker({
208    //position: myLatlng,
209    //map: map,
210    //title: 'Hello World!'
211    //});
212
213    document.getElementById(canvasId).style.display = 'none';
214
215    return mapx;
216}
217
218
219
220function drop(zoom,theMap,theNeighborhoods) {
221
222    clearMarkers();
223
224    var markerBounds = new google.maps.LatLngBounds();
225    for (var i = 0; i < theNeighborhoods.length; i++) {
226        var nm = addMarkerWithTimeout(theNeighborhoods[i], i * 200, false, theMap);
227        markerBounds.extend(nm.getPosition());
228    }
229
230    theMap.setCenter(markerBounds.getCenter());
231    // map.fitBounds(markerBounds);
232    if(zoom){
233        theMap.setZoom(zoom);
234        //console.log(zoom);
235    }else{
236        // no manual zoom set, make the min zoom 15
237        if(theMap.getZoom()<14){
238            theMap.setZoom(14);
239            // if there are > 1 pins then fit them on the map
240            if(theNeighborhoods.length>1) {
241                theMap.fitBounds(markerBounds);
242            }
243        }
244    }
245
246
247    // map.setCenter( new google.maps.LatLng(dropLat, dropLng) );
248    showMap();
249
250}
251
252function replaceMarker() {
253    /*clearMarkers();
254    var markerBounds = new google.maps.LatLngBounds();
255    for (var i = 0; i < neighborhoods.length; i++) {
256        var nm = addMarkerWithTimeout(neighborhoods[i], i * 200, true);
257        google.maps.event.addListener(nm, 'dragend', function() {
258            markerPosition = nm.getPosition().toUrlValue(6);
259            var positionArr = markerPosition.split(',');
260            $('#lat').val(positionArr[0]);
261            $('#lon').val(positionArr[1]);
262        } );
263        markerBounds.extend(nm.getPosition());
264    }
265
266    //map.setCenter(markerBounds.getCenter());
267    //map.fitBounds(markerBounds);
268    console.log('drop');
269    console.log(map.getZoom());
270    if(map.getZoom()<=20){
271        map.setZoom(16);
272    }
273    map.setCenter( new google.maps.LatLng(neighborhoods[0].lat, neighborhoods[0].lng) );*/
274
275    clearMarkers();
276
277    var markerBounds = new google.maps.LatLngBounds();
278    for (var i = 0; i < neighborhoods.length; i++) {
279        var nm = addMarkerWithTimeout(neighborhoods[i], i * 200);
280        markerBounds.extend(nm.getPosition());
281    }
282
283    map.setCenter(markerBounds.getCenter());
284    map.fitBounds(markerBounds);
285    //console.log('drop');
286    //console.log(map.getZoom());
287    // if(map.getZoom()>15){
288        map.setZoom(14);
289    // }
290
291    showMap();
292}
293
294function geocodePosition(pos) {
295    geocoder.geocode({
296        latLng: pos
297    }, function(responses) {
298        if (responses && responses.length > 0) {
299            updateMarkerAddress(responses[0].formatted_address);
300        } else {
301            updateMarkerAddress('Cannot determine address at this location.');
302        }
303    });
304}
305
306function dropNoCenter(Zoom) {
307
308    clearMarkers();
309
310    var markerBounds = new google.maps.LatLngBounds();
311    for (var i = 0; i < neighborhoods.length; i++) {
312        var nm = addMarkerWithTimeout(neighborhoods[i], i * 200);
313        markerBounds.extend(nm.getPosition());
314    }
315
316    map.setCenter(markerBounds.getCenter());
317    // map.fitBounds(markerBounds);
318    //console.log('dvrop');
319
320    map.setZoom(14);
321
322    // map.setCenter( new google.maps.LatLng(dropLat, dropLng) );
323    showMap();
324
325}
326
327function addMarkerWithTimeout(args, timeout, isDraggable, theMap) {
328
329
330    var position = new google.maps.LatLng(args.lat, args.lng);
331
332    var contentString = '<div id="content">'+
333        '<div id="siteNotice">'+
334        '</div>'+
335        '<div id="bodyContent">'+
336        '<p>'+args.content+'</p>'+
337        '</div>'+
338        '</div>';
339
340
341    var infowindow = new google.maps.InfoWindow({
342        content: contentString
343    });
344
345    // Marker sizes are expressed as a Size of X,Y
346    // where the origin of the image (0,0) is located
347    // in the top left of the image.
348
349    // Origins, anchor positions and coordinates of the marker
350    // increase in the X direction to the right and in
351    // the Y direction down.
352    /*var image = {
353        url: 'map-pin-CMYK.png',
354        // This marker is 20 pixels wide by 32 pixels tall.
355        size: new google.maps.Size(20, 32),
356        // The origin for this image is 0,0.
357        origin: new google.maps.Point(0,0),
358        // The anchor for this image is the base of the flagpole at 0,32.
359        anchor: new google.maps.Point(0, 32)
360    };*/
361    // Shapes define the clickable region of the icon.
362    // The type defines an HTML &lt;area&gt; element 'poly' which
363    // traces out a polygon as a series of X,Y points. The final
364    // coordinate closes the poly by connecting to the first
365    // coordinate.
366    /*var shape = {
367        coords: [1, 1, 1, 20, 18, 20, 18 , 1],
368        type: 'poly'
369    };*/
370
371
372    var marker;
373    if(isDraggable == true){
374        marker = new google.maps.Marker({
375            position: position,
376            map: theMap,
377            draggable: true,
378        });
379    }else{
380        marker = new google.maps.Marker({
381            position: position,
382            map: theMap,
383        });
384    }
385
386    // The Info Window
387    google.maps.event.addListener(marker, 'click', function() {
388        infowindow.open(theMap,marker);
389    });
390
391  //  markers.push(marker);
392
393    //var markerBounds = new google.maps.LatLngBounds();
394
395    //markerBounds.extend(position);
396
397    //map.fitBounds(markerBounds);
398
399    return(marker);
400
401}
402
403
404function clearMarkers() {
405    //console.log('clear markers');
406    for (var i = 0; i < markers.length; i++) {
407        markers[i].setMap(null);
408        //markers[i].setVisible(false);
409        //markers[i]=null;
410        //console.log(markers[i]);
411    }
412    markers = [];
413    //document.getElementById('no-pins-found').style.display = 'none';
414
415}
416
417
418//		function addMarker(location, map) {
419//			// Add the marker at the clicked location, and add the next-available label
420//			// from the array of alphabetical characters.
421//			var marker = new google.maps.Marker({
422//				position: location,
423//				label: labels[labelIndex++ % labels.length],
424//				map: map
425//			});
426//		}
427
428function showMap() {
429
430    document.getElementById(canvasId).style.display = 'block';
431
432}
433
434function noMapLocations(){
435    clearMarkers();
436    document.getElementById('no-pins-found').style.display = 'block';
437    map.setZoom(12);
438    map.setCenter(new google.maps.LatLng(53.008307, -10.501798));
439    //console.log('no pins');
440    showMap();
441}
442
443//google.maps.event.addDomListener(window, 'load', initialize);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.