PageSourceSearch

https://www.glasbena-sb.si/wp-content/themes/melodyschool/fw/js/core.googlemap.js?rnd=269336885

js glasbena-sb.si collected 2026-10-08 06:43:09 UTC 5,960 bytes, 141 lines download raw bytes

1function melodyschool_googlemap_init(dom_obj, coords) {
2	"use strict";
3	if (typeof MELODYSCHOOL_STORAGE['googlemap_init_obj'] == 'undefined') melodyschool_googlemap_init_styles();
4	MELODYSCHOOL_STORAGE['googlemap_init_obj'].geocoder = '';
5	try {
6		var id = dom_obj.id;
7		MELODYSCHOOL_STORAGE['googlemap_init_obj'][id] = {
8			dom: dom_obj,
9			markers: coords.markers,
10			geocoder_request: false,
11			opt: {
12				zoom: coords.zoom,
13				center: null,
14				scrollwheel: false,
15				scaleControl: false,
16				disableDefaultUI: false,
17				panControl: true,
18				zoomControl: true, //zoom
19				mapTypeControl: false,
20				streetViewControl: false,
21				overviewMapControl: false,
22				styles: MELODYSCHOOL_STORAGE['googlemap_styles'][coords.style ? coords.style : 'default'],
23				mapTypeId: google.maps.MapTypeId.ROADMAP
24			}
25		};
26		
27		melodyschool_googlemap_create(id);
28
29	} catch (e) {
30		
31		dcl(MELODYSCHOOL_STORAGE['strings']['googlemap_not_avail']);
32
33	};
34}
35
36function melodyschool_googlemap_create(id) {
37	"use strict";
38
39	// Create map
40	MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].map = new google.maps.Map(MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].dom, MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].opt);
41
42	// Add markers
43	for (var i in MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers)
44		MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].inited = false;
45	melodyschool_googlemap_add_markers(id);
46	
47	// Add resize listener
48	jQuery(window).resize(function() {
49		if (MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].map)
50			MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].map.setCenter(MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].opt.center);
51	});
52}
53
54function melodyschool_googlemap_add_markers(id) {
55	"use strict";
56	for (var i in MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers) {
57		
58		if (MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].inited) continue;
59		
60		if (MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].latlng == '') {
61			
62			if (MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].geocoder_request!==false) continue;
63			
64			if (MELODYSCHOOL_STORAGE['googlemap_init_obj'].geocoder == '') MELODYSCHOOL_STORAGE['googlemap_init_obj'].geocoder = new google.maps.Geocoder();
65			MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].geocoder_request = i;
66			MELODYSCHOOL_STORAGE['googlemap_init_obj'].geocoder.geocode({address: MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].address}, function(results, status) {
67				"use strict";
68				if (status == google.maps.GeocoderStatus.OK) {
69					var idx = MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].geocoder_request;
70					if (results[0].geometry.location.lat && results[0].geometry.location.lng) {
71						MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[idx].latlng = '' + results[0].geometry.location.lat() + ',' + results[0].geometry.location.lng();
72					} else {
73						MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[idx].latlng = results[0].geometry.location.toString().replace(/\(\)/g, '');
74					}
75					MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].geocoder_request = false;
76					setTimeout(function() { 
77						melodyschool_googlemap_add_markers(id); 
78						}, 200);
79				} else
80					dcl(MELODYSCHOOL_STORAGE['strings']['geocode_error'] + ' ' + status);
81			});
82		
83		} else {
84			
85			// Prepare marker object
86			var latlngStr = MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].latlng.split(',');
87			var markerInit = {
88				map: MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].map,
89				position: new google.maps.LatLng(latlngStr[0], latlngStr[1]),
90				clickable: MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].description!=''
91			};
92			if (MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].point) markerInit.icon = MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].point;
93			if (MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].title) markerInit.title = MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].title;
94			MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].marker = new google.maps.Marker(markerInit);
95			
96			// Set Map center
97			if (MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].opt.center == null) {
98				MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].opt.center = markerInit.position;
99				MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].map.setCenter(MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].opt.center);				
100			}
101			
102			// Add description window
103			if (MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].description!='') {
104				MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].infowindow = new google.maps.InfoWindow({
105					content: MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].description
106				});
107				google.maps.event.addListener(MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].marker, "click", function(e) {
108					var latlng = e.latLng.toString().replace("(", '').replace(")", "").replace(" ", "");
109					for (var i in MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers) {
110						if (latlng == MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].latlng) {
111							MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].infowindow.open(
112								MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].map,
113								MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].marker
114							);
115							break;
116						}
117					}
118				});
119			}
120			
121			MELODYSCHOOL_STORAGE['googlemap_init_obj'][id].markers[i].inited = true;
122		}
123	}
124}
125
126function melodyschool_googlemap_refresh() {
127	"use strict";
128	for (id in MELODYSCHOOL_STORAGE['googlemap_init_obj']) {
129		melodyschool_googlemap_create(id);
130	}
131}
132
133function melodyschool_googlemap_init_styles() {
134	// Init Google map
135	MELODYSCHOOL_STORAGE['googlemap_init_obj'] = {};
136	MELODYSCHOOL_STORAGE['googlemap_styles'] = {
137		'default': []
138	};
139	if (window.melodyschool_theme_googlemap_styles!==undefined)
140		MELODYSCHOOL_STORAGE['googlemap_styles'] = melodyschool_theme_googlemap_styles(MELODYSCHOOL_STORAGE['googlemap_styles']);
141}

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.