PageSourceSearch

https://urologogdl.com/js/jquery.googlemap.js

js urologogdl.com collected 2026-09-28 02:22:36 UTC 9,955 bytes, 360 lines download raw bytes

1$(function() {
2
3	$.fn.googleMap = function(params) {
4		params = $.extend( {
5			zoom : 17,
6			coords : [48.895651, 2.290569],
7			type : "ROADMAP",
8			debug : false,
9			langage : "spanish",
10			overviewMapControl: false,
11			streetViewControl: false,
12			scrollwheel: false,
13			mapTypeControl: false
14		}, params);
15
16		switch(params.type) {
17			case 'ROADMAP':
18			case 'SATELLITE':
19			case 'HYBRID':
20			case 'TERRAIN':
21				params.type = google.maps.MapTypeId[params.type];
22				break;
23			default:
24				params.type = google.maps.MapTypeId.ROADMAP;
25				break;
26		}
27
28		this.each(function() {
29
30			var map = new google.maps.Map(this, {
31				zoom: params.zoom,
32				center: new google.maps.LatLng(params.coords[0], params.coords[1]),
33				mapTypeId: params.type,
34				scrollwheel: params.scrollwheel,
35				streetViewControl: params.streetViewControl,
36				overviewMapControl: params.overviewMapControl,
37				mapTypeControl: params.mapTypeControl
38
39			});
40
41			$(this).data('googleMap', map);
42			$(this).data('googleLang', params.langage);
43			$(this).data('googleDebug', params.debug);
44			$(this).data('googleMarker', new Array());
45			$(this).data('googleBound', new google.maps.LatLngBounds());
46		});
47
48		return this;
49	}
50
51	$.fn.addMarker = function(params) {
52		params = $.extend( {
53			coords : false,
54			address : false,
55			url : false,
56			id : false,
57			icon : false,
58			draggable : false,
59			title : "",
60			text : "",
61			success : function() {}
62		}, params);
63
64		this.each(function() {
65			$this = $(this);
66
67			if(!$this.data('googleMap')) {
68				if($this.data('googleDebug'))
69					console.error("jQuery googleMap : Unable to add a marker where there is no map !");
70					
71				return false;
72			}
73
74			if(!params.coords && !params.address) {
75				if($this.data('googleDebug'))
76					console.error("jQuery googleMap : Unable to add a marker if you don't tell us where !");
77					
78				return false;
79			}
80
81			if(params.address && typeof params.address == "string") {
82
83				var geocodeAsync = function($that) {
84
85					var geocoder = new google.maps.Geocoder();
86
87					geocoder.geocode({
88						address : params.address,
89						bounds : $that.data('googleBound'),
90						language : $that.data('googleLang')
91					}, function(results, status) {
92
93						if (status == google.maps.GeocoderStatus.OK) {
94							$that.data('googleBound').extend(results[0].geometry.location);
95
96							if(params.icon) {
97								var marker = new google.maps.Marker({
98									map: $this.data('googleMap'),
99									position: results[0].geometry.location,
100									title: params.title,
101									icon: params.icon,
102									draggable: params.draggable
103								});
104							} else {
105								var marker = new google.maps.Marker({
106									map: $that.data('googleMap'),
107									position: results[0].geometry.location,
108									title: params.title,
109									draggable: params.draggable
110								});
111							}
112
113							if(params.draggable) {
114								google.maps.event.addListener(marker, 'dragend', function() {
115									var location = marker.getPosition();
116
117									var coords = {};
118
119									coords.lat = location.lat();
120									coords.lon = location.lng();
121
122									params.success(coords, $this);
123								});
124							}
125
126							if(params.title != "" && params.text != "" && !params.url) {
127								var infowindow = new google.maps.InfoWindow({
128									content: "<h1>"+params.title+"</h1>"+params.text
129								});
130
131								var map = $that.data('googleMap');
132
133								google.maps.event.addListener(marker, 'click', function() {
134									infowindow.open(map, marker);
135								});
136							} else if(params.url) {
137								google.maps.event.addListener(marker, 'click', function() {
138									document.location = params.url;
139								});
140							}
141
142							if(!params.id) {
143								$that.data('googleMarker').push(marker);
144							} else {
145								$that.data('googleMarker')[params.id] = marker;
146							}
147
148							if($that.data('googleMarker').length == 1) {
149								$that.data('googleMap').setCenter(results[0].geometry.location);
150								$that.data('googleMap').setZoom($that.data('googleMap').getZoom());
151							} else {
152								$that.data('googleMap').fitBounds($that.data('googleBound'));
153							}
154
155							var coords = {};
156							coords.lat = results[0].geometry.location.lat();
157							coords.lon = results[0].geometry.location.lng();
158
159							params.success(coords, $this);
160
161						} else {
162							if($this.data('googleDebug'))
163								console.error("jQuery googleMap : Unable to find the place asked for the marker ("+status+")");
164						}
165					});
166				}($this);
167			} else {
168				$this.data('googleBound').extend(new google.maps.LatLng(params.coords[0], params.coords[1]));
169
170        			if(params.icon) {
171					var marker = new google.maps.Marker({
172						map: $this.data('googleMap'),
173						position: new google.maps.LatLng(params.coords[0], params.coords[1]),
174						title: params.title,
175						icon: params.icon,
176						draggable: params.draggable
177					});
178				} else {
179					var marker = new google.maps.Marker({
180						map: $this.data('googleMap'),
181						position: new google.maps.LatLng(params.coords[0], params.coords[1]),
182						title: params.title,
183						draggable: params.draggable
184					});
185				}
186
187        			if(params.title != "" && params.text != "" && !params.url) {
188          				var infowindow = new google.maps.InfoWindow({
189						content: "<h1>"+params.title+"</h1>"+params.text
190					});
191
192					var map = $this.data('googleMap');
193
194	        			google.maps.event.addListener(marker, 'click', function() {
195		        			infowindow.open(map, marker);
196	        			});
197				} else if(params.url) {
198          				google.maps.event.addListener(marker, 'click', function() {
199              					document.location = params.url;
200        				});
201				}
202
203				if(params.draggable) {
204					google.maps.event.addListener(marker, 'dragend', function() {
205						var location = marker.getPosition();
206
207						var coords = {};
208
209						coords.lat = location.lat();
210						coords.lon = location.lng();
211
212						params.success(coords, $this);
213					});
214				}
215
216				if(!params.id) {
217       					$this.data('googleMarker').push(marker);
218        			} else {
219        				$this.data('googleMarker')[params.id] = marker;
220        			}
221
222				if($this.data('googleMarker').length == 1) {
223					$this.data('googleMap').setCenter(new google.maps.LatLng(params.coords[0], params.coords[1]));
224					$this.data('googleMap').setZoom($this.data('googleMap').getZoom());
225				} else {
226					$this.data('googleMap').fitBounds($this.data('googleBound'));
227				}
228
229				params.success({
230					lat: params.coords[0],
231					lon: params.coords[1]
232				}, $this);
233			}
234		});
235
236		return this;
237	}
238
239	$.fn.removeMarker = function(id) {
240		this.each(function() {
241			var $this = $(this);
242
243    			if(!$this.data('googleMap')) {
244    				if($this.data('googleDebug'))
245      					console.log("jQuery googleMap : Unable to delete a marker where there is no map !");
246      					
247      				return false;
248    			}
249
250    			var $markers = $this.data('googleMarker');
251
252    			if(typeof $markers[id] != 'undefined') {
253    				$markers[id].setMap(null);
254    				
255      				if($this.data('googleDebug'))
256      					console.log('jQuery googleMap : marker deleted');
257      					
258      				return true;
259    			} else {
260      				if($this.data('googleDebug'))
261      					console.error("jQuery googleMap : Unable to delete a marker if it not exists !");
262      		
263      				return false;
264    			}
265		});
266	}
267
268	$.fn.addWay = function(params) {
269		params = $.extend( {
270			start : false,
271			end : false,
272			step : [],
273			route : false,
274			langage : 'spanish'
275		}, params);
276
277		var direction = new google.maps.DirectionsService({
278			region: "fr"
279		});
280
281		var way = new google.maps.DirectionsRenderer({
282			draggable: true,
283			map: $(this).data('googleMap'),
284			panel: document.getElementById(params.route),
285			provideTripAlternatives: true
286		});
287		
288		document.getElementById.innerHTML = "";
289
290		var waypoints = [];
291
292    		for(var i in params.step) {
293    			var step;
294      			if(typeof params.step[i] == "object") {
295        			step = new google.maps.LatLng(params.step[i][0], params.step[i][1]);
296      			} else {
297        			step = params.step[i];
298      			}
299
300      			waypoints.push({
301      				location: step,
302      				stopover: true
303      			});
304		}
305
306		if(typeof params.end != "object") {
307			var geocodeAsync = function($that) {
308				var geocoder = new google.maps.Geocoder();
309
310		    		geocoder.geocode({
311		    			address  : params.end,
312		    			bounds   : $that.data('googleBound'),
313		    			language : params.langage
314		    		}, function(results, status) {
315	        			if (status == google.maps.GeocoderStatus.OK) {
316	        				var request = {
317	            					origin: params.start,
318	            					destination: results[0].geometry.location,
319	            					travelMode: google.maps.DirectionsTravelMode.DRIVING,
320	            					region: "fr",
321	            					waypoints: waypoints
322		        			};
323
324		        			direction.route(request, function(response, status) {
325	            					if (status == google.maps.DirectionsStatus.OK) {
326	              						way.setDirections(response);
327	            					} else {
328	              						if($that.data('googleDebug'))
329	            							console.error("jQuery googleMap : Unable to find the place asked for the route ("+response+")");
330	            					}
331		        			});
332
333	        			} else {
334	          				if($that.data('googleDebug'))
335	          					console.error("jQuery googleMap : Address not found");
336	        			}
337		    		});
338	    		}($(this));
339		} else {
340			var request = {
341				origin: params.start,
342				destination: new google.maps.LatLng(params.end[0], params.end[1]),
343				travelMode: google.maps.DirectionsTravelMode.DRIVING,
344				region: "fr",
345				waypoints: waypoints
346			};
347
348			direction.route(request, function(response, status) {
349				if (status == google.maps.DirectionsStatus.OK) {
350					way.setDirections(response);
351				} else {
352					if($(this).data('googleDebug'))
353          					console.error("jQuery googleMap : Address not found");
354				}
355			});
356		}
357
358		return this;
359	}
360});

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.