PageSourceSearch

https://www.nakheel.com/ResourcePackages/NakheelComponents/assets/…?package=NakheelComponents

js nakheel.com collected 2026-10-02 04:48:10 UTC 7,294 bytes, 347 lines download raw bytes

1(function ($) { //an IIFE so safely alias jQuery to $
2	$.GMapLocation = function (element) {
3
4		//stores the passed element as a property of the created instance.
5
6		if (element instanceof $) {
7			this.element = element
8		} else {
9			this.element = $(element);
10			this.elementSelector = element;
11		}
12	};
13
14	//assigning an object literal to the prototype is a shorter syntax
15	//than assigning one property at a time
16	$.GMapLocation.prototype = {
17		Init: function () {
18			if (this.element.length == 0) { return; }
19
20			var map;
21			var marker, i;
22			var locations = [];
23			var title = this.element.find(".title").text();
24			var lat = this.element.find("#txtlatitude").val();
25			var long = this.element.find("#txtlongititue").val();
26			var infoWindowContent = this.element.find("#txtinfocontent").val();
27
28			var infowindow = new google.maps.InfoWindow();
29			var bounds = new google.maps.LatLngBounds();
30
31			//var locations = [
32			//	['DESCRIPTION', 25.3238216110604, 55.636286312095116, 5],
33			//	['DESCRIPTION', 25.1743017, 55.4141012, 4],
34			//	['DESCRIPTION', 25.1142245, 55.1373917, 3],
35			//	['DESCRIPTION', 25.0659059, 55.2156381, 2],
36			//	['DESCRIPTION', 25.1667232, 55.2771959, 1]
37			//];
38
39			var mapStyle = [
40				{
41					"elementType": "geometry",
42					"stylers": [
43						{
44							"color": "#f5f5f5"
45						}
46					]
47				},
48				{
49					"elementType": "labels.icon",
50					"stylers": [
51						{
52							"visibility": "off"
53						}
54					]
55				},
56				{
57					"elementType": "labels.text.fill",
58					"stylers": [
59						{
60							"color": "#616161"
61						}
62					]
63				},
64				{
65					"elementType": "labels.text.stroke",
66					"stylers": [
67						{
68							"color": "#f5f5f5"
69						}
70					]
71				},
72				{
73					"featureType": "administrative.land_parcel",
74					"elementType": "labels",
75					"stylers": [
76						{
77							"visibility": "off"
78						}
79					]
80				},
81				{
82					"featureType": "administrative.land_parcel",
83					"elementType": "labels.text.fill",
84					"stylers": [
85						{
86							"color": "#bdbdbd"
87						}
88					]
89				},
90				{
91					"featureType": "poi",
92					"elementType": "geometry",
93					"stylers": [
94						{
95							"color": "#eeeeee"
96						}
97					]
98				},
99				{
100					"featureType": "poi",
101					"elementType": "labels.text.fill",
102					"stylers": [
103						{
104							"color": "#757575"
105						}
106					]
107				},
108				{
109					"featureType": "poi.park",
110					"elementType": "geometry",
111					"stylers": [
112						{
113							"color": "#e5e5e5"
114						}
115					]
116				},
117				{
118					"featureType": "poi.park",
119					"elementType": "labels.text.fill",
120					"stylers": [
121						{
122							"color": "#9e9e9e"
123						}
124					]
125				},
126				{
127					"featureType": "road",
128					"elementType": "geometry",
129					"stylers": [
130						{
131							"color": "#ffffff"
132						}
133					]
134				},
135				{
136					"featureType": "road",
137					"elementType": "geometry.fill",
138					"stylers": [
139						{
140							"color": "#ffffff"
141						}
142					]
143				},
144				{
145					"featureType": "road.arterial",
146					"elementType": "geometry.fill",
147					"stylers": [
148						{
149							"color": "#ffffff"
150						}
151					]
152				},
153				{
154					"featureType": "road.arterial",
155					"elementType": "labels.text.fill",
156					"stylers": [
157						{
158							"color": "#757575"
159						}
160					]
161				},
162				{
163					"featureType": "road.highway",
164					"elementType": "geometry",
165					"stylers": [
166						{
167							"color": "#dadada"
168						}
169					]
170				},
171				{
172					"featureType": "road.highway",
173					"elementType": "geometry.stroke",
174					"stylers": [
175						{
176							"color": "#ffffff"
177						}
178					]
179				},
180				{
181					"featureType": "road.highway",
182					"elementType": "labels.text.fill",
183					"stylers": [
184						{
185							"color": "#616161"
186						}
187					]
188				},
189				{
190					"featureType": "road.highway.controlled_access",
191					"elementType": "geometry.fill",
192					"stylers": [
193						{
194							"color": "#ffffff"
195						}
196					]
197				},
198				{
199					"featureType": "road.local",
200					"elementType": "geometry.fill",
201					"stylers": [
202						{
203							"color": "#ffffff"
204						}
205					]
206				},
207				{
208					"featureType": "road.local",
209					"elementType": "labels",
210					"stylers": [
211						{
212							"visibility": "off"
213						}
214					]
215				},
216				{
217					"featureType": "road.local",
218					"elementType": "labels.text.fill",
219					"stylers": [
220						{
221							"color": "#9e9e9e"
222						}
223					]
224				},
225				{
226					"featureType": "transit.line",
227					"elementType": "geometry",
228					"stylers": [
229						{
230							"color": "#e5e5e5"
231						}
232					]
233				},
234				{
235					"featureType": "transit.station",
236					"elementType": "geometry",
237					"stylers": [
238						{
239							"color": "#eeeeee"
240						}
241					]
242				},
243				{
244					"featureType": "water",
245					"elementType": "geometry",
246					"stylers": [
247						{
248							"color": "#c9c9c9"
249						}
250					]
251				},
252				{
253					"featureType": "water",
254					"elementType": "geometry.fill",
255					"stylers": [
256						{
257							"color": "#d1d1d1"
258						}
259					]
260				},
261				{
262					"featureType": "water",
263					"elementType": "labels.text.fill",
264					"stylers": [
265						{
266							"color": "#9e9e9e"
267						}
268					]
269				}
270			]
271
272			//Ahsan M
273			if ($('.loc-latlong').length > 0) {
274				var locLatLongSpans = $(".loc-latlong");
275
276				locLatLongSpans.each(function () {
277					var text = $(this).text();
278					var values = text.split("|");
279
280					if (values.length === 5) {
281						var locationtitle = values[0];
282						var latitude = parseFloat(values[1]);
283						var longitude = parseFloat(values[2]);
284						var index = parseInt(values[3]);
285						var infoContent = values[4];
286
287						var locationData = [
288							infoContent, latitude, longitude, index, locationtitle
289						];
290
291						locations.push(locationData);
292					}
293				});
294			}
295			else {
296				locations = [[infoWindowContent, lat, long, 1]];
297			}
298
299			if ($('.loc-latlong').length > 0) {
300				map = new google.maps.Map(document.getElementById('map'), {
301					zoom: 11,
302					mapTypeId: google.maps.MapTypeId.ROADMAP,
303					styles: mapStyle
304				});
305			}
306			else {
307				map = new google.maps.Map(document.getElementById('map'), {
308					center: new google.maps.LatLng(lat, long),
309					zoom: 11,
310					mapTypeId: google.maps.MapTypeId.ROADMAP,
311					styles: mapStyle
312				});
313			}
314			
315			for (i = 0; i < locations.length; i++) {
316				marker = new google.maps.Marker({
317					position: new google.maps.LatLng(locations[i][1], locations[i][2]),
318					map: map
319				});
320
321				//extend the bounds to include each marker's position
322				bounds.extend(marker.position); //Ahsan M
323
324				google.maps.event.addListener(marker, 'click', (function (marker, i) {
325					return function () {
326						ga('send', 'event', 'Google Maps', 'Pin click', locations[i][4]);
327						infowindow.setContent(locations[i][0]);
328						infowindow.open(map, marker);
329					}
330				})(marker, i));
331			}
332
333			if ($('.loc-latlong').length > 0) {
334				//now fit the map to the newly inclusive bounds
335				map.fitBounds(bounds); //Ahsan M
336			}			
337		}
338	};
339
340	$.GMapLocation.defaultOptions = {};
341
342}(jQuery));
343
344var gMapLocation = new $.GMapLocation(".location-section");
345gMapLocation.Init();
346
347

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.