PageSourceSearch

https://www.indjijatravel.rs/wp-content/plugins/designthemes-store…/modules/location/assets/map.js?ver=7.1.2

js indjijatravel.rs collected 2026-10-02 23:38:58 UTC 7,918 bytes, 274 lines download raw bytes

1var map;
2var geocoder;
3var gmarkers = [];
4
5var dtStoreLocatorMapUtils = {
6
7	dtStoreLocatorMapInitialize : function() {
8
9    	geocoder = new google.maps.Geocoder();
10
11	    var listing_latitude = jQuery('#dtsl_latitude').val();
12	    var listing_longitude = jQuery('#dtsl_longitude').val();
13
14		var showMapMarker = true;
15	    if(listing_latitude == '' || listing_longitude == '') {
16	        listing_latitude = dtslmapobject.defaultLatitude;
17			listing_longitude = dtslmapobject.defaultLongitude;
18			showMapMarker = false;
19	    }
20
21	    var default_zoom_level = dtslmapobject.defaultZoomLevel;
22	    var default_map_type = dtslmapobject.defaultMapType;
23
24	    var mapOptions = {
25							flat:false,
26							noClear:false,
27							zoom: parseInt(default_zoom_level, 10),
28							scrollwheel: false,
29							draggable: true,
30							disableDefaultUI:false,
31							center: new google.maps.LatLng( listing_latitude, listing_longitude),
32							mapTypeId: default_map_type.toLowerCase()
33						};
34
35
36	    if(document.getElementById('dtsl-addlist-map-holder')) {
37	        map = new google.maps.Map(document.getElementById('dtsl-addlist-map-holder'), mapOptions);
38	    } else {
39	        return;
40	    }
41
42	    google.maps.visualRefresh = true;
43
44		if(showMapMarker) {
45			var point = new google.maps.LatLng(listing_latitude, listing_longitude);
46			dtStoreLocatorMapUtils.dtStoreLocatorMapPlaceSavedMarker(point);
47		}
48
49	    google.maps.event.addListener(map, 'click', function(event) {
50	        dtStoreLocatorMapUtils.dtStoreLocatorMapPlaceMarker(event.latLng);
51	    });
52
53	},
54
55	dtStoreLocatorMapPlaceSavedMarker : function(location) {
56
57		dtStoreLocatorMapUtils.dtStoreLocatorMapRemoveMarkers();
58
59		var marker = new google.maps.Marker({
60			position: location,
61			map: map
62		});
63		gmarkers.push(marker);
64
65		var infowindow = new google.maps.InfoWindow({
66			content: 'Latitude: ' + location.lat() + '<br>Longitude: ' + location.lng()
67		});
68
69		infowindow.open(map,marker);
70
71	},
72
73	dtStoreLocatorMapPlaceMarker : function(location) {
74
75		dtStoreLocatorMapUtils.dtStoreLocatorMapRemoveMarkers();
76
77		var marker = new google.maps.Marker({
78			position: location,
79			map: map
80		});
81		gmarkers.push(marker);
82
83		var infowindow = new google.maps.InfoWindow({
84			content: 'Latitude: ' + location.lat() + '<br>Longitude: ' + location.lng()
85		});
86
87		infowindow.open(map,marker);
88
89		document.getElementById("dtsl_latitude").value=location.lat();
90		document.getElementById("dtsl_longitude").value=location.lng();
91
92	},
93
94	dtStoreLocatorMapRemoveMarkers : function() {
95
96	    for (i = 0; i<gmarkers.length; i++){
97	        gmarkers[i].setMap(null);
98	    }
99
100	},
101
102	dtStoreLocatorMapRegenerateMap : function() {
103
104		dtStoreLocatorMapUtils.dtStoreLocatorMapRemoveMarkers();
105
106		var address = document.getElementById('dtsl_address').value;
107		var full_address = address;
108
109		if( document.getElementById('dtsl_city') ) {
110			var city = document.getElementById('dtsl_city').value;
111			if(city) {
112				full_address = full_address +','+ city;
113			}
114		}
115
116		if( document.getElementById('dtsl_countystate') ) {
117			var state = document.getElementById('dtsl_countystate').value;
118			if(state) {
119				full_address = full_address +','+ state;
120			}
121		}
122
123		if( document.getElementById('dtsl_country') ) {
124			var country   = document.getElementById('dtsl_country').value;
125			if(country){
126				full_address = full_address +','+ country;
127			}
128		}
129
130		geocoder.geocode( { 'address': full_address}, function(results, status) {
131			if (status == google.maps.GeocoderStatus.OK) {
132
133				map.setCenter(results[0].geometry.location);
134				var marker = new google.maps.Marker({
135					map: map,
136					position: results[0].geometry.location
137				});
138				gmarkers.push(marker);
139
140				var infowindow = new google.maps.InfoWindow({
141					content: 'Latitude: ' + results[0].geometry.location.lat() + '<br>Longitude: ' + results[0].geometry.location.lng()
142				});
143
144				infowindow.open(map,marker);
145				document.getElementById("dtsl_latitude").value=results[0].geometry.location.lat();
146				document.getElementById("dtsl_longitude").value=results[0].geometry.location.lng();
147
148			}
149		});
150
151	},
152
153	dtStoreLocatorMapFillAddress : function(place) {
154
155	    var componentForm = {
156	        establishment:'long_name',
157	        street_number: 'short_name',
158	        route: 'long_name',
159	        locality: 'long_name',
160	        administrative_area_level_1: 'long_name',
161	        administrative_area_level_2: 'long_name',
162	        country: 'short_name',
163	        postal_code: 'short_name',
164	        postal_code_prefix:'short_name',
165	        neighborhood:'long_name'
166	    };
167
168    	jQuery('#dtsl_city').val('');
169        jQuery('#dtsl_neighborhood').val('');
170        jQuery('#dtsl_zip').val('');
171        jQuery('#dtsl_countystate').val('');
172        jQuery('#dtsl_country').val('');
173
174        for(var i = 0; i < place.address_components.length; i++) {
175
176          	var addressType = place.address_components[i].types[0];
177
178            var temp = '';
179            var val = place.address_components[i][componentForm[addressType]];
180
181            if(addressType=== 'street_number' || addressType=== 'route') {
182            } else if(addressType=== 'neighborhood') {
183                jQuery('#dtsl_neighborhood').val(val);
184            } else if(addressType=== 'postal_code_prefix') {
185                jQuery('#dtsl_zip').val(val);
186            } else if(addressType=== 'postal_code') {
187                jQuery('#dtsl_zip').val(val);
188            } else if(addressType=== 'administrative_area_level_2') {
189                jQuery('#dtsl_countystate').val(val);
190            } else if(addressType=== 'administrative_area_level_1') {
191                jQuery('#dtsl_countystate').val(val);
192            } else if(addressType=== 'locality') {
193                jQuery('#dtsl_city').val(val);
194            } else if(addressType=== 'country') {
195                jQuery('#dtsl_country').val(val);
196            }
197
198        }
199
200	},
201
202};
203
204var dtStoreLocatorMap = {
205
206	dtInit : function() {
207		dtStoreLocatorMap.dtLoadMap();
208		dtStoreLocatorMap.dtMapEvents();
209	},
210
211	dtLoadMap : function() {
212
213		google.maps.event.addDomListener(window, 'load', dtStoreLocatorMapUtils.dtStoreLocatorMapInitialize());
214
215	},
216
217	dtMapEvents : function() {
218
219	    if( document.getElementById('dtsl_address') ) {
220
221	        var address_autocomplete = new google.maps.places.Autocomplete(( document.getElementById('dtsl_address')), {
222	        	types: ['geocode'],
223	            "partial_match" : true
224	        });
225
226	        var input = document.getElementById('dtsl_address');
227            google.maps.event.addDomListener(input, 'keydown', function(e) {
228                if (e.keyCode == 13) {
229                    e.stopPropagation();
230                    e.preventDefault();
231                }
232	        });
233
234	        google.maps.event.addListener(address_autocomplete, 'place_changed', function(event) {
235	            var place = address_autocomplete.getPlace();
236	            dtStoreLocatorMapUtils.dtStoreLocatorMapFillAddress(place);
237	            dtStoreLocatorMapUtils.dtStoreLocatorMapRegenerateMap();
238	        });
239
240	   }
241
242	   if( document.getElementById('dtsl_city') ) {
243
244	        city_autocomplete = new google.maps.places.Autocomplete(( document.getElementById('dtsl_city')), {
245	        	types: ['(cities)']
246	        });
247
248	        var input = document.getElementById('dtsl_city');
249	            google.maps.event.addDomListener(input, 'keydown', function(e) {
250	                if (e.keyCode == 13) {
251	                    e.stopPropagation();
252	                    e.preventDefault();
253	                }
254	        });
255
256	        google.maps.event.addListener(city_autocomplete, 'place_changed', function() {
257	            var place = city_autocomplete.getPlace();
258	            dtStoreLocatorMapUtils.dtStoreLocatorMapFillAddress(place);
259	            dtStoreLocatorMapUtils.dtStoreLocatorMapRegenerateMap();
260	        });
261
262	    }
263
264	},
265
266};
267
268jQuery(document).ready(function() {
269
270	"use strict";
271
272	dtStoreLocatorMap.dtInit();
273
274});

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.