PageSourceSearch

https://www.imperial-rac.com/wp-content/themes/autorent/assets/js/autorent-custom.js?ver=1790630159

js imperial-rac.com collected 2026-10-04 02:41:10 UTC 13,234 bytes, 493 lines download raw bytes

1(function($){
2
3	"use strict";
4
5	/*casa comment from modification start*/
6
7
8	$('#respond').children('form.comment-form').addClass('default-form');
9	$('#respond').children('form.comment-form').children('p.form-submit').children('input.submit').addClass('yellow');
10	$('.post-comments').children('.comment-respond').children('form.comment-form').children('p.form-submit').hide();
11	
12	/*casa comment from modification end*/
13
14
15
16	/*concierge send mail to agency office start*/
17
18	$(".send-mail-success").hide();
19
20	$('#send_mail_to_office').submit(function(e){		
21		var formData = $(this).serializeArray();		
22		$.ajax({
23			type:'POST',
24			url: ajaxurl,
25			data: {'action':'concierge_user_data_for_message', 'form_data': formData	},
26			success: function(result){
27				dataLayer.push({'event':'send_us_message'});
28				$(".send-mail-success").show().delay(5000).fadeOut();				
29			}
30		});
31		return false;
32	});
33
34	/*concierge send mail to agency office end*/
35
36
37
38
39	/*Home page search for car start*/
40
41	$('.reservation-form').submit(function(){
42
43		var type = $('.reservation ul.horizontal-tab li.active a').data("rel");		
44		var searchFormData = $(this).serializeArray();
45		var dataObj = {};
46		var search_page_id = $('#search-page-id').val();
47
48		$(searchFormData).each(function(i, field){
49		  dataObj[field.name] = field.value;
50		});
51
52		var createSearchBar = '';
53
54		if(dataObj.car_location != '' && dataObj.car_location != undefined){
55			if(dataObj.car_location_area != '' && dataObj.car_location_area != undefined){
56				createSearchBar += 'pickUpCity='+dataObj.car_location+'&';
57				createSearchBar += 'location='+dataObj.car_location_area+'&';
58				if(dataObj.location_tax != '' && dataObj.location_tax != undefined){
59					createSearchBar += 'locationTax='+dataObj.location_tax+'&';
60				}
61			}else{
62				createSearchBar += 'pickUpCity='+dataObj.car_location+'&';
63				createSearchBar += 'location='+dataObj.car_location+'&';
64				if(dataObj.location_tax != '' && dataObj.location_tax != undefined){
65					createSearchBar += 'locationTax='+dataObj.location_tax+'&';
66				}
67			}			
68		}
69
70		if(dataObj.car_return_location != '' && dataObj.car_return_location != undefined){
71			if(dataObj.car_return_location_area != '' && dataObj.car_return_location_area != undefined){
72				createSearchBar += 'returnCity='+dataObj.car_return_location+'&';
73				createSearchBar += 'returnLocation='+dataObj.car_return_location_area+'&';
74				if(dataObj.return_location_tax != '' && dataObj.return_location_tax != undefined){
75					createSearchBar += 'returnLocationTax='+dataObj.return_location_tax+'&';
76				}
77			}else{
78				createSearchBar += 'returnCity='+dataObj.car_return_location+'&';
79				createSearchBar += 'returnLocation='+dataObj.car_return_location+'&';
80				if(dataObj.return_location_tax != '' && dataObj.return_location_tax != undefined){
81					createSearchBar += 'returnLocationTax='+dataObj.return_location_tax+'&';
82				}
83			}			
84		}else{
85
86			if(dataObj.car_location != '' && dataObj.car_location != undefined){
87				if(dataObj.car_location_area != '' && dataObj.car_location_area != undefined){
88					createSearchBar += 'returnCity='+dataObj.car_location+'&';
89					createSearchBar += 'returnLocation='+dataObj.car_location_area+'&';
90					if(dataObj.return_location_tax != '' && dataObj.return_location_tax != undefined){
91						createSearchBar += 'returnLocationTax='+dataObj.return_location_tax+'&';
92					}
93				}else{
94					createSearchBar += 'returnCity='+dataObj.car_location+'&';
95					createSearchBar += 'returnLocation='+dataObj.car_location+'&';
96					if(dataObj.return_location_tax != '' && dataObj.return_location_tax != undefined){
97						createSearchBar += 'returnLocationTax='+dataObj.return_location_tax+'&';
98					}
99				}			
100			}
101		}
102
103		if(dataObj.car_type != '' && dataObj.car_type != undefined){
104			createSearchBar += 'carType='+dataObj.car_type+'&';
105			if(dataObj.car_type_tax != '' && dataObj.car_type_tax != undefined){
106				createSearchBar += 'carTypeTax='+dataObj.car_type_tax+'&';
107			}
108		}
109
110
111
112		if(dataObj.pickUpDate != '' && dataObj.pickUpDate != undefined){
113			createSearchBar += 'pickUpDate='+dataObj.pickUpDate+'&'; 
114		}
115
116		if(dataObj.pickUpTime != '' && dataObj.pickUpTime != undefined){
117			createSearchBar += 'pickUpTime='+dataObj.pickUpTime+'&'; 
118		}
119
120		if(dataObj.returnDate != '' && dataObj.returnDate != undefined){
121			createSearchBar += 'returnDate='+dataObj.returnDate+'&'; 
122		}
123
124		if(dataObj.returnTime != '' && dataObj.returnTime != undefined){
125			createSearchBar += 'returnTime='+dataObj.returnTime+'&'; 
126		}		
127
128		//console.log(dataObj.search_page+'#/?'+'type='+type+'&'+createSearchBar);
129
130		window.location.href = window.location.hostname+'/cars/?'+'type='+type+'&'+createSearchBar;
131
132		return false;
133
134	});
135
136	/*Home page search for car end*/
137
138
139	// PROPERTY IMAGES
140	$( '.fleet-details .property-images' ).each(function(){
141
142		var self = $(this),
143		image_list = self.find( '.image-list' ),
144		images = image_list.find( '.image' ),
145		images_count = images.length,
146		footer = self.find( '.images-footer' ),
147		description = footer.find( '.image-description' ),
148		counter = footer.find( '.image-counter' ),
149		btn_prev = footer.find( '.prev-btn' ),
150		btn_next = footer.find( '.next-btn' ),
151		slide_image_count = 0;
152
153		// ADD CLASSES
154		if ( images_count === 1 ) {
155		  self.addClass( 'single-image' );
156		}
157		if ( images.find( 'img[alt=""]' ).length === images_count || images.find( 'img:not([alt])' ).length === images_count ) {
158		  self.addClass( 'no-description' );
159		}
160
161		// SET FIRST IMAGE DESCRIPTION
162		if ( images.first().find( 'img' ).attr( 'alt' ) ) {
163		  description.text( images.first().find( 'img' ).attr( 'alt' ) );
164		}
165
166		// INIT OWL SLIDER
167		if ( $.fn.owlCarousel && images_count > 1 ) {
168
169			// SET COUNTER
170			if(slide_image_count>=images_count){
171			    slide_image_count = 1;
172			  }
173			counter.text( '1/' + images_count );
174
175			image_list.owlCarousel({
176				autoPlay: false,
177				slideSpeed: 300,
178				pagination: false,
179				paginationSpeed : 400,
180				singleItem:true,
181				addClassActive: true,
182				afterMove: function(){
183
184					var active = image_list.find( '.owl-item.active' ),
185					index = active.index();
186					slide_image_count++;
187
188					if(slide_image_count>=images_count){
189					slide_image_count = 0;
190					}
191
192					// SET DESCRIPTION
193					if ( active.find( 'img' ).attr( 'alt' ) ) {
194					description.text( active.find( 'img' ).attr( 'alt' ) );
195					}
196					else {
197					description.text( '' );
198					}
199
200					// SET COUNTER
201					counter.text( parseInt( slide_image_count ) + 1 + '/' + images_count );
202
203				}
204			});
205
206			btn_prev.click(function(){
207			image_list.trigger( 'owl.prev' );
208			});
209			btn_next.click(function(){
210			image_list.trigger( 'owl.next' );
211			});
212
213		}
214
215	});
216
217
218
219
220	/*search query for shortcut search start*/
221
222	$('ul.short-cuts li').click(function(){
223
224		console.log('clicked');
225
226		var reservationTypeTax = $(this).children("a").children("span").data("taxonomy");
227		var searchPage = $(this).children("a").children("span").data("search");
228		var searchTerm = $(this).children("a").children("span").data("terms");
229
230		var createSearchBar = '';
231
232		if(reservationTypeTax != '' && reservationTypeTax != undefined){
233			createSearchBar += 'reservationTypeTax='+reservationTypeTax+'&'; 
234		}
235
236
237		if(searchTerm != '' && searchTerm != undefined){
238			createSearchBar += 'searchTerm='+searchTerm+'&'; 
239		}
240
241
242
243		
244		
245		window.location.href = searchPage+'#/?'+createSearchBar;
246
247	});
248
249
250	/*search query for shortcut search end*/
251
252
253
254
255
256
257	$('.return-car').hide();
258
259	$('#return-car-to-different-location').click(function() {
260        if($(this).is(':checked'))
261            $('.return-car').show();
262        else
263            $('.return-car').hide();
264    });
265
266
267
268
269	/*start login script*/
270
271	$('#bg-login').click(function(e){
272        e.preventDefault();
273        console.log('hi');
274
275        var get_all_data = $('#bg-login-form').serializeArray();
276
277        $.ajax({
278        	
279            url: ajax_object.ajaxurl+'?action=bg_login',
280            type: 'POST',
281            dataType:"json",
282            data: get_all_data,
283            success:function(result){
284
285			    if(!result.loggedin){
286			        $(".status").html(result.message).show(0).delay(5000).hide(0);
287			    }else{
288
289					$(".status").html(result.message).show(0).delay(5000).hide(0);
290					window.location.href = result.url;
291			    }
292
293            }
294        });
295
296    });
297
298
299
300
301
302
303	/*end login script*/
304
305	// check what the browser and give corresponding class to body
306	var isFirefox = typeof InstallTrigger !== 'undefined';
307	var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification));
308	var isIE = /*@cc_on!@*/false || !!document.documentMode;	
309	var isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
310
311	if (isFirefox == true) {
312		$('body').addClass('isFirefox');
313	}
314
315	if (isSafari == true) {
316		$('body').addClass('isSafari');
317	}
318
319	if (isIE == true) {
320		$('body').addClass('isIE');
321	}
322
323	if (isChrome == true) {
324		$('body').addClass('isChrome');
325	}
326
327	// end of check the browser
328
329
330	$(".style-select").chosen();
331
332	/*
333	 * Chosen 0.x renders its control as an anchor without a destination and
334	 * creates an unlabeled search input. Keep the legacy behaviour while
335	 * exposing a valid fragment target and accessible names to crawlers and
336	 * assistive technology.
337	 */
338	$('.style-select').each(function(index){
339		var select = $(this),
340			selectId = select.attr('id') || ('autorent-select-' + index),
341			label = select.attr('aria-label') || select.data('placeholder') || 'Choose an option',
342			chosen = select.next('.chzn-container'),
343			trigger = chosen.children('a.chzn-single');
344
345		select.attr('id', selectId);
346		trigger.attr({
347			href: '#' + selectId,
348			role: 'button',
349			'aria-label': label,
350			'aria-haspopup': 'listbox',
351			'aria-expanded': 'false'
352		});
353		chosen.find('.chzn-search input').attr('aria-label', label + ' search');
354
355		select.on('liszt:showing_dropdown', function(){
356			trigger.attr('aria-expanded', 'true');
357		});
358		select.on('liszt:hiding_dropdown change', function(){
359			trigger.attr('aria-expanded', 'false');
360		});
361	});
362
363	/**
364	 * Handle car single page location form
365	 *
366	 * @since 1.0.0
367	 * @return number
368	 */
369  	$('.car_location_city').change(function(){  		
370  		
371  		var locations = locations_data.locations,
372  			city      = $('.pickup_city').find(':selected').data('pickup-city'),
373          	areas     = $('.car_location_area');
374
375
376  		var opt = '<option value=""> Choose Area </option>';
377
378		$.each( locations, function( key, value ) {     
379		if(key === city){          
380		  $.each(value, function(ky , val){
381		    opt += '<option value="'+val.name+'"> '+val.name+' </option>';  
382		  })        
383		}
384		});
385
386
387		$('.car_location_area').html(opt);
388		$('.car_location_area').trigger("liszt:updated");
389  	});
390	
391
392
393  	$('.car_return_location_city').change(function(){  		
394  		
395  		var locations = locations_data.return_locations,
396  			city      = $('.dropoff_city').find(':selected').data('dropoff-city'),
397          	areas     = $('.car_return_location_area');
398
399  		var opt = '<option value=""> Choose Area </option>';
400
401		$.each( locations, function( key, value ) {     
402		if(key === city){          
403		  $.each(value, function(ky , val){
404		    opt += '<option value="'+val.name+'"> '+val.name+' </option>';  
405		  })        
406		}
407		});
408
409		$('.car_return_location_area').html(opt);
410		$('.car_return_location_area').trigger("liszt:updated");
411  	});
412	
413
414
415  	/**
416	 * Handle home page search location form
417	 *
418	 * @since 1.0.0
419	 * @return number
420	 */
421	 $('.search_car_location_city').change(function(){  		
422  		
423  		var locations = locations_data.locations,
424  			city      = $(this).val(),
425          	areas     = $('.car_location_area');
426
427
428  		var opt = '<option value=""> Choose Area </option>';
429
430		$.each( locations, function( key, value ) {     
431		if(key === city){          
432		  $.each(value, function(ky , val){
433		    opt += '<option value="'+val.slug+'"> '+val.name+' </option>';  
434		  })        
435		}
436		});
437
438
439		$('.car_location_area').html(opt);
440		$('.car_location_area').trigger("liszt:updated");
441  	});
442	
443
444
445  	$('.search_car_return_location_city').change(function(){  		
446  		
447  		var locations = locations_data.return_locations,
448  			city      = $(this).val(),
449          	areas     = $('.car_return_location_area');
450
451  		var opt = '<option value=""> Choose Area </option>';
452
453		$.each( locations, function( key, value ) {     
454		if(key === city){          
455		  $.each(value, function(ky , val){
456		    opt += '<option value="'+val.slug+'"> '+val.name+' </option>';  
457		  })        
458		}
459		});
460
461		$('.car_return_location_area').html(opt);
462		$('.car_return_location_area').trigger("liszt:updated");
463  	});
464
465
466
467
468
469
470	// extras page date time form show or hide	
471	$('.modify-datetime a').on('click', function(e){
472		$('.datetimeoption').toggle();
473		$('.location-field').toggle();
474		e.preventDefault();
475	});
476
477
478
479	//show on/off the currency switcher 
480	
481	var currentURL = window.location.href;
482
483	if(currentURL === cart_page_url || currentURL === checkout_page_url){
484		$('.widget_wc_aelia_currencyswitcher_widget').hide();
485	}else{
486		$('.widget_wc_aelia_currencyswitcher_widget').show();
487	}
488
489
490
491	
492
493})(jQuery);	

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.