PageSourceSearch

https://methodist.bg/wp-content/themes/pastore-church-child/assets/js/map.js?ver=6.9.9

js methodist.bg collected 2026-10-02 22:22:04 UTC 10,759 bytes, 433 lines download raw bytes

1;(function($, window, document, undefined) {
2
3	// 'use strict';
4
5	// vars
6	var $win = $(window);
7	var $doc = $(document);
8	var $body = $('body');
9
10	var windowWidth = $win.width();
11
12$win.on('load', function() {
13
14
15	
16		var places = [];
17		var bounds;
18		var map;
19		var markers = [];
20		var markerIcon;
21		// var icon;
22
23		var mapLat = $('.map').data('lat');
24		var mapLng = $('.map').data('lng');
25		var daniasIconUrl = $('.map').data('marker');
26
27		var minimumZoom = 6.5;
28
29		if (windowWidth > 540) {
30			minimumZoom = 8;			
31		}
32
33		var center = {lat: mapLat, lng: mapLng};
34
35		// if ($('.map-wrapper').length > 0) {
36			// icon = $('.map-wrapper').data('marker'); 
37		// console.log(icon);
38		// }
39
40		if ($('#map-accordion').length > 0) {
41			
42			markerIcon = $('#map-accordion').data('marker'); 
43
44			$('.accordionItem').each(function () {
45	    		$(this).find('ul').children('li').each(function (index) {
46
47					var place = [];
48	    			place[0] = $(this).text();
49	    			place[1] = parseFloat($(this).find('.place-link').data('lat'));
50	    			place[2] = parseFloat($(this).find('.place-link').data('lng'));
51	    			place[3] = $(this).closest('.accordionItem').data('id');
52	    			place[4] = String($(this).find('.place-link').data('number')).padStart(2, '0');
53	    	
54	    			places.push(place);
55	    		});
56			});  
57		}
58
59		// console.log(places);
60
61		function initialize() {
62
63		    var myOptions = {
64		    	center: new google.maps.LatLng(mapLat, mapLng),
65		      	zoom: minimumZoom,
66		      	styles: [
67						    {
68						        "featureType": "administrative",
69						        "stylers": [
70						            {
71						                "visibility": "off"
72						            }
73						        ]
74						    },
75						    {
76						        "featureType": "poi",
77						        "stylers": [
78						            {
79						                "visibility": "simplified"
80						            }
81						        ]
82						    },
83						    {
84						        "featureType": "road",
85						        "stylers": [
86						            {
87						                "visibility": "simplified"
88						            }
89						        ]
90						    },
91						    {
92						        "featureType": "water",
93						        "stylers": [
94						            {
95						                "visibility": "simplified"
96						            }
97						        ]
98						    },
99						    {
100						        "featureType": "transit",
101						        "stylers": [
102						            {
103						                "visibility": "simplified"
104						            }
105						        ]
106						    },
107						    {
108						        "featureType": "landscape",
109						        "stylers": [
110						            {
111						                "visibility": "simplified"
112						            }
113						        ]
114						    },
115						    {
116						        "featureType": "road.highway",
117						        "stylers": [
118						            {
119						                "visibility": "off"
120						            }
121						        ]
122						    },
123						    {
124						        "featureType": "road.local",
125						        "stylers": [
126						            {
127						                "visibility": "on"
128						            }
129						        ]
130						    },
131						    {
132						        "featureType": "road.highway",
133						        "elementType": "geometry",
134						        "stylers": [
135						            {
136						                "visibility": "on"
137						            }
138						        ]
139						    },
140						    {
141						        "featureType": "water",
142						        "stylers": [
143						            {
144						                "color": "#84afa3"
145						            },
146						            {
147						                "lightness": 52
148						            }
149						        ]
150						    },
151						    {
152						        "stylers": [
153						            {
154						                "saturation": -77
155						            }
156						        ]
157						    },
158						    {
159						        "featureType": "road"
160						    }
161						],
162
163				   
164
165					
166		      	mapTypeId: google.maps.MapTypeId.ROADMAP
167		    };
168
169		    map = new google.maps.Map(document.getElementById("map"), myOptions);
170		    setMarkers(map,places);
171
172		  //   if (places.length > 0) {
173		  //   	setMarkers(map,places)
174		  //   } else {
175		  //   	var imageUrl = $('.map').data('marker');
176		  //   	// console.log(imageUrl);
177		  //   	var image = {
178		  //         url: imageUrl,
179		  //         // This marker is 20 pixels wide by 32 pixels high.
180		  //         size: new google.maps.Size(120, 160),
181		  //         // The origin for this image is (0, 0).
182		  //         // origin: new google.maps.Point(0, 0),
183		  //         // The anchor for this image is the base of the flagpole at (0, 32).
184		  //         // anchor: new google.maps.Point(0, 160)
185		  //       };
186
187		  //   	var singleMap = new google.maps.Map(document.getElementById("map"), myOptions);
188		  //   	var marker = new google.maps.Marker({
189			 //        position: center,
190			 //        map: singleMap,
191			 //        icon: image
192				// });	
193
194		  //   }
195		}
196
197
198	   $("#cover").fadeOut(200);
199
200		function setMarkers(map,places){
201
202			// new google.maps.Marker({
203			//     position: center,
204			//     label: 'T Y',
205			//     map: map
206			// });
207
208			var i, newMarker, timberMarker;
209
210			bounds = new google.maps.LatLngBounds();
211
212			for (i = 0; i < places.length; i++) {
213
214				newMarker = new google.maps.Marker({
215					position: new google.maps.LatLng(places[i][1], places[i][2]),
216					map: map,
217					// label: {
218				 //        color: '#fff',
219				 //        fontSize: '12px',
220				 //        fontWeight: '400',
221				 //        text: '',
222				 //        // text: places[i][4]
223				 //    },
224					title: places[i][0],
225					icon: markerIcon,
226				});
227				
228				bounds.extend(newMarker.getPosition());
229
230			  	newMarker.category = places[i][3];     
231			  	newMarker.setVisible(false);
232			  	markers.push(newMarker);
233			}
234
235			// console.log(markers);
236
237
238			// timberMarker = new google.maps.Marker({
239			// 	position: new google.maps.LatLng(mapLat, mapLng),
240			// 	map: map,
241			// 	label: {
242			//         color: '#fff',
243			//         fontSize: '14px',
244			//         fontWeight: '400',
245			//         text: 'M'
246			//     },
247			// 	title: 'Методист БГ',
248			// 	// icon: 'http://labs.google.com/ridefinder/images/mm_20_white.png',
249			// });
250
251			// timberMarker.category = 'puzzle';     
252			// timberMarker.setVisible(false);
253			// bounds.extend(timberMarker.getPosition());
254			// markers.push(timberMarker);
255
256			map.fitBounds(bounds);
257	 	}
258
259		function displayMarkers(category) {
260
261		    var i;
262
263		    for (i = 0; i < markers.length; i++) {
264		       	if (markers[i].category === category || markers[i].category === 'puzzle' ) {
265
266		        	markers[i].setVisible(true);
267
268		       	} else {
269		        	
270		        	markers[i].setVisible(false);
271		        }
272		    }
273
274  			map.setOptions({ minZoom: minimumZoom, maxZoom: 17 });
275	   	
276		    fitBoundsToVisibleMarkers();
277
278	   	}
279
280	   	function displayAllMarkers() {
281
282		    var i;
283
284		    for (i = 0; i < markers.length; i++) {
285
286		        	markers[i].setVisible(true);
287		    }
288
289  			map.setOptions({ minZoom: minimumZoom, maxZoom: 15 });
290	   	
291		    fitBoundsToVisibleMarkers();
292
293	   	}
294
295	   	function displayCurrentMarker(placeNumber) {
296
297		    var i;
298
299		    for (i = 0; i < markers.length; i++) {
300
301		    	if ( i === placeNumber) {
302		        	markers[i].setVisible(true);
303		    	} else {
304		    		markers[i].setVisible(false);
305		    	}
306
307		    }
308
309  			map.setOptions({ minZoom: minimumZoom, maxZoom: 15 });
310	   	
311		    fitBoundsToVisibleMarkers();
312
313	   	}
314
315	   	function fitBoundsToVisibleMarkers() {
316
317		   var bounds = new google.maps.LatLngBounds();
318
319		   for (var i = 0; i < markers.length; i++) {
320		       if (markers[i].getVisible()) {
321		           bounds.extend(markers[i].getPosition());
322		       }
323		   }
324
325		   map.fitBounds(bounds);
326		}
327
328	 	function loadFirstMarkers() {
329
330	 		// var catId = $('.accordionItem').data('id');
331	 		// console.log(catId);			
332	 		// displayMarkers(catId);
333
334	 		displayAllMarkers();
335	 	} 
336
337		$( ".accordionItemHeading" ).on( "click", function(e) {
338
339	 		if ($(this).parents('.accordionItem').hasClass('active')) {
340	 			displayAllMarkers();
341		    	$(this).children('ul').slideUp('slow');
342	 		} else {
343				var catId = $(this).parents('.accordionItem').data('id');
344				displayMarkers(catId);
345			}
346
347			$(e.target).parents('.accordionItem').siblings().removeClass('active');
348	 		$(e.target).parents('.accordionItem').toggleClass('active');
349		    $(e.target).parents('.accordionItem').siblings().children('ul').slideUp('slow');
350		    $(e.target).next('ul').slideToggle('slow');
351
352		});
353
354
355		$( ".place-heading" ).on( "click", function(e) {
356			var placeNumber = $(this).children('.place-link').data('number');
357
358	 		if ($(this).parents('.place-entry').hasClass('active')) {
359		    	$(this).siblings('.place-content').slideUp('slow');
360				var catId = $(this).parents('.accordionItem').data('id');
361				displayMarkers(catId);
362	 		} else {
363	 			$(this).siblings('.place-content').slideDown('slow');
364	 			displayCurrentMarker(placeNumber);
365			}
366
367			$(e.target).parents('.place-entry').siblings().removeClass('active');
368	 		$(e.target).parents('.place-entry').toggleClass('active');
369		    $(e.target).parents('.place-entry').siblings().children('.place-content').slideUp('slow');
370		    $(e.target).next('div').slideToggle('slow');
371
372		});
373
374
375
376
377	 // 	$('.map-accordion h5').click(function(e) {
378
379	 // 		if ($(this).parents('.accordionItem').first().hasClass('active')) {
380	 // 			$(this).parents('.accordionItem').first().removeClass('active');
381	 // 			displayAllMarkers();
382	 // 		} else {
383			    
384	 // 			$(this).parents('.accordionItem').first().addClass('active');
385	 // 			$(this).parents('.accordionItem').first().siblings().removeClass('active');
386			    
387		// 	    $(e.target).next('ul').slideToggle('slow');
388		// 		var catId = $(this).data('id');
389		// 		displayMarkers(catId);
390 	// 		}
391
392	 // 		// $(this).parents('.accordionItem').toggleClass('active');
393		//     $(e.target).parents('.accordionItem').siblings().children('ul').slideUp('slow');
394		//     $(e.target).next('ul').slideToggle('slow');
395		// });
396
397
398
399	 // 	$('.map-accordion h5').click(function(e) {
400	 // 		$(this).parents('.accordionItem').siblings().removeClass('active');
401	 // 		$(this).parents('.accordionItem').toggleClass('active');
402		//     $(e.target).parents('.accordionItem').siblings().children('ul').slideUp('slow');
403		//     $(e.target).next('ul').slideToggle('slow');
404		// });
405
406		if ($('#map').length > 0) {
407
408			initialize();
409	 		loadFirstMarkers();
410	 	}
411
412	 	$('.allItemsHeading').on('click', function() {
413
414	 		displayAllMarkers();
415	 	});
416
417
418	 	$('.accordionItem.active .accordionItemHeading').on('click', function() {
419
420	 	});
421
422		// TweenMax.set(".image-container img", {
423		//  drawSVG: '0% 0%'
424		// })
425
426		// TweenMax.staggerTo(".image-container img",1, {drawSVG:"100%", ease: Linear.easeNone, delay: 0.5},0.5)
427
428		//  new Vivus('my-svg', {duration: 200}, dd);
429
430	});
431
432
433})(jQuery, window, document);

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.