PageSourceSearch

https://comingsoon.ae/wp-content/themes/comingsoon/assets/js/geolocation.js?ver=7.1.2

js comingsoon.ae collected 2026-10-02 20:10:40 UTC 8,053 bytes, 284 lines download raw bytes

1$(document).ready(function () {
2	if (!navigator.geolocation) {
3		if ($('.show-near-venues').length) {
4			$('.show-near-venues').parent('h2').hide();
5		}
6		if ($('.show-near-hotels').length) {
7			$('.show-near-hotels').parent('h2').hide();
8		}
9	}
10	else {
11
12		var inUAE = false;
13
14		function isInUAE(pos) {
15			var geocoder = new google.maps.Geocoder();
16
17			var options = {
18				enableHighAccuracy: true,
19				timeout: 5000,
20				maximumAge: 0
21			};
22
23			var crd = pos.coords;
24
25			console.log(crd);
26
27			geocoder.geocode(
28				{
29					'location': {
30						lat: crd.latitude,
31						lng: crd.longitude
32					}
33				},
34				function (results, status) {//find out current country
35					if (status === 'OK') {
36						var currentCountry;
37						currentCountry = results[results.length - 1]['formatted_address'];
38
39						geocoder.geocode(
40							{'address': 'UAE'},
41							function (results, status) {//find out UAE & compare
42								if (status === 'OK') {
43
44									var restrictionCountry;
45									restrictionCountry = results[results.length - 1]['formatted_address'];
46
47									//if (restrictionCountry && currentCountry && (restrictionCountry == currentCountry)) {
48									if (true) {
49										inUAE = true;
50
51										console.log('Located in UAE');
52										if (true) {
53
54											var args = {
55												'action': 'cs_geolocation'
56											};
57
58											args['location'] = [pos.coords.latitude, pos.coords.longitude];
59
60											//currentEmirate = results[results.length - 1]['formatted_address'];
61
62											//if ($('body')) {
63											//	$('body').addClass(currentEmirate);
64											//}
65
66											if ($('.page-movies-locs-cont').length) {
67												args['type'] = 'page-movies-locs';
68
69												$.ajax({
70													method: "POST",
71													url: ajaxUrl,
72													data: args,
73													success: function (res) {
74
75														console.log('Located in UAE 11');
76														
77														if (res !== '0') {
78															if ($('.page-movies-locs-cont').length) {
79																$('.page-movies-locs-cont').html(res);
80															}
81														}
82													}
83												})
84											}
85
86											if ($('.mainpage-venues-cont').length) {
87												args['type'] = 'main-venues';
88
89												$.ajax({
90													method: "POST",
91													url: ajaxUrl,
92													data: args,
93													success: function (res) {
94														console.log(res);
95														if (res !== '0') {
96															if ($('.mainpage-venues-cont').length) {
97																$('.mainpage-venues-cont').html(res);
98																$('.mainpage-venues-cont-heading').html($('.mainpage-venues-cont-heading').html() + ' near you');
99															}
100														}
101													}
102												})
103											}
104
105											if ($('.feed-venues-geo').length) {
106												args['type'] = 'feed-venues';
107
108												if ($('.feed-venues-geo').attr('category')) {
109													args['category'] = $('.feed-venues-geo').attr('category');
110												}
111
112												if ($('.feed-venues-geo').attr('emirate')) {
113													args['emirate'] = $('.feed-venues-geo').attr('emirate');
114												}
115
116												$.ajax({
117													method: "POST",
118													url: ajaxUrl,
119													data: args,
120													success: function (res) {
121														console.log(res);
122														if (res !== '0') {
123															if ($('.feed-venues-geo').length) {
124																$('.feed-venues-geo').html(res);
125															}
126														}
127													}
128												})
129											}
130
131											if ($('.mainpage-hotels-cont').length) {
132												args['type'] = 'main-hotels';
133
134												$.ajax({
135													method: "POST",
136													url: ajaxUrl,
137													data: args,
138													success: function (res) {
139														if (res !== '0') {
140															if ($('.mainpage-hotels-cont').length) {
141																$('.mainpage-hotels-cont').html(res);
142																$('.mainpage-hotels-cont-heading').html($('.mainpage-hotels-cont-heading').html() + ' near you');
143															}
144														}
145													}
146												})
147											}
148
149											if ($('.location-list-venues').length) {
150
151												args['type'] = 'list-venues';
152
153												if ($('.location-list-venues').attr('category')) {
154													args['category'] = $('.location-list-venues').attr('category');
155												}
156
157												if ($('.location-list-venues').attr('emirate')) {
158													args['emirate'] = $('.location-list-venues').attr('emirate');
159												}
160
161												$('.venues-list-container').slideUp(500);
162												$('.load-venues').slideUp(500);
163
164												$.ajax({
165													method: "POST",
166													url: ajaxUrl,
167													data: args,
168													success: function (res) {
169														if (res !== '0') {
170															if ($('.location-list-venues .row').length) {
171
172																$('.location-list-venues .row').html(res);
173
174																$('.show-all-venues').click(function (e) {
175																	e.preventDefault();
176																	$('.venues-list-container').slideDown(800);
177																	$('.load-venues').slideDown(800);
178																	//$('.show-near-venues').slideDown(800);
179																	$('.location-list-venues').hide();
180																	$('.show-all-venues').hide();
181																})
182
183																$('.show-near-venues').click(function (e) {
184																	e.preventDefault();
185																	$('.location-list-venues').slideDown(800);
186																	$('.show-all-venues').show();
187																	$('.venues-list-container').hide();
188																	$('.load-venues').hide();
189																})
190															}
191															mapTriggerInit();
192														}
193													}
194												})
195
196											}
197
198											if ($('.venues-list-geo-table').length) {
199
200												args['type'] = 'venues-list-geo-table';
201
202												if ($('.venues-list-geo-table').attr('category')) {
203													args['category'] = $('.venues-list-geo-table').attr('category');
204												}
205
206												if ($('.venues-list-geo-table').attr('emirate')) {
207													args['emirate'] = $('.venues-list-geo-table').attr('emirate');
208												}
209
210												$.ajax({
211													method: "POST",
212													url: ajaxUrl,
213													data: args,
214													success: function (res) {
215														if (res !== '0') {
216															if ($('.venues-list-geo-table').length) {
217
218																$('.venues-list-geo-table').html(res);
219
220															}
221															mapTriggerInit();
222														}
223													}
224												})
225
226											}
227
228											if ($('.location-list-hotels').length) {
229
230												args['type'] = 'list-hotels';
231
232												if ($('.location-list-hotels').attr('stars')) {
233													args['stars'] = $('.location-list-hotels').attr('stars');
234												}
235
236												$.ajax({
237													method: "POST",
238													url: ajaxUrl,
239													data: args,
240													success: function (res) {
241														if (res !== '0') {
242															if ($('.location-list-hotels .row').length) {
243
244																$('.location-list-hotels .row').html(res);
245															}
246															mapTriggerInit();
247														}
248													}
249												})
250
251											}
252										}
253									}
254									else{
255										if ($('.show-near-venues').length) {
256											$('.show-near-venues').parent('h2').hide();
257										}
258										if ($('.show-near-hotels').length) {
259											$('.show-near-hotels').parent('h2').hide();
260										}
261									}
262								}
263							});
264					}
265				});
266
267		}
268
269		navigator.geolocation.getCurrentPosition(
270			function (position) {
271				isInUAE(position);
272			},
273			function (error) {
274				if ($('.show-near-venues').length) {
275					$('.show-near-venues').parent('h2').hide();
276				}
277				if ($('.show-near-hotels').length) {
278					$('.show-near-hotels').parent('h2').hide();
279				}
280			}
281		);
282
283	}
284});

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.