PageSourceSearch

https://mahilasaarthi.in/wp-content/plugins/booking-and-rental-man…/mp_style/mp_script.js?ver=1790866982

js mahilasaarthi.in collected 2026-10-01 15:05:05 UTC 21,081 bytes, 569 lines download raw bytes

1//======================================================Price Format==============//
2
3//=======================================================Loader==============//
4function dLoader(target) {
5	if (target.find('div[class*="dLoader"]').length < 1) {
6		target.addClass('pRelative').append('<div class="dLoader"><span class="fas fa-spinner fa-pulse"></span></div>');
7	}
8}
9
10
11function dLoaderBody() {
12	let body = jQuery('body');
13	if (body.find('div[class*="dLoader"]').length < 1) {
14		body.addClass('noScroll').append('<div class="dLoader pFixed"><span class="fas fa-spinner fa-pulse"></span></div>');
15	}
16}
17
18
19
20function dLoaderRemove(target = jQuery('body')) {
21	target.removeClass('noScroll');
22	target.removeClass('pRelative').find('div[class*="dLoader"]').remove();
23}
24function placeholderLoader(target) {
25	target.addClass('placeholderLoader');
26}
27function placeholderLoaderRemove(target) {
28	target.each(function () {
29		target.removeClass('placeholderLoader');
30	})
31}
32//======================================================Page Scroll==============//
33function pageScrollTo(target) {
34	jQuery('html, body').animate({
35		scrollTop: target.offset().top -= 150
36	}, 1000);
37}
38//====================================================Load Date picker==============//
39function mp_load_date_picker(parent = jQuery('.mpStyle')) {
40	parent.find(".date_type.hasDatepicker").each(function () {
41		jQuery(this).removeClass('hasDatepicker').attr('id', '').removeData('datepicker').unbind();
42	}).promise().done(function () {
43		parent.find(".date_type").datepicker({
44			dateFormat: js_date_format,
45			//showButtonPanel: true,
46			autoSize: true,
47			changeMonth: true,
48			changeYear: true,
49			yearRange: '1900:' + (new Date().getFullYear() + 10), // from 1900 to 10 years ahead
50			onSelect: function (dateString, data) {
51				let date = data.selectedYear + '-' + ('0' + (parseInt(data.selectedMonth) + 1)).slice(-2) + '-' + ('0' + parseInt(data.selectedDay)).slice(-2);
52				jQuery(this).closest('label').find('input[type="hidden"]').val(date).trigger('change');
53			},
54		});
55	});
56}
57
58//=====================================================Load initial=================//
59(function ($) {
60	"use strict";
61	$(document).ready(function () {
62		mp_load_date_picker();
63		//$('.mp_select2').select2({});
64	});
65}(jQuery));
66//====================================================================Load Bg Image=================//
67function loadBgImage() {
68	jQuery('body').find('div.mpStyle [data-bg-image]:visible').each(function () {
69		let target = jQuery(this);
70		if (target.closest('.sliderAllItem').length === 0) {
71			let width = target.outerWidth();
72			let height = target.outerHeight();
73			if (target.css('background-image') === 'none' || width === 0 || height === 0) {
74				let bg_url = target.data('bg-image');
75				if (!bg_url || bg_url.width === 0 || bg_url.width === 'undefined') {
76					bg_url = mp_empty_image_url;
77				}
78				mp_resize_bg_image_area(target, bg_url);
79				target.css('background-image', 'url("' + bg_url + '")').promise().done(function () {
80					dLoaderRemove(jQuery(this));
81				});
82			}
83		}
84	});
85	jQuery('body').find('div.mpStyle .sliderAllItem').each(function () {
86		let target = jQuery(this);
87		mpwem_slider_resize(target)
88	});
89	return true;
90}
91function mpwem_slider_resize(target) {
92	let all_height = [];
93	let totalHeight = 0;
94	let imgCount = 0;
95	let main_div_width = target.innerWidth();
96	//console.log(main_div_width);
97	let item_count = target.find('.sliderItem').length;
98	target.find('[data-bg-image]').each(function () {
99		let width = jQuery(this).outerWidth();
100		let height = jQuery(this).outerHeight();
101		// if (jQuery(this).css('background-image') === 'none' || width === 0 || height === 0) {
102		let bg_url = jQuery(this).data('bg-image');
103		if (!bg_url || bg_url.width === 0 || bg_url.width === 'undefined') {
104			bg_url = mp_empty_image_url;
105		}
106		let imgWidth = jQuery(this).data('width');
107		let imgHeight = jQuery(this).data('height');
108		all_height.push(imgHeight);
109		totalHeight = totalHeight + (imgHeight * main_div_width) / imgWidth;
110		imgCount++;
111		if (imgCount === item_count) {
112			let slider_height_type = target.closest('.superSlider').find('input[name="slider_height_type"]').val();
113			let height_content = totalHeight / imgCount;
114			if (slider_height_type === 'min') {
115				height_content = Math.min(...all_height);
116				target.find('.sliderItem').css({"min-height": height_content});
117				target.find('.sliderItem').css({"max-height": height_content});
118			} else if (slider_height_type === 'max') {
119				height_content = Math.max(...all_height);
120				target.find('.sliderItem').css({"min-height": height_content});
121				target.find('.sliderItem').css({"max-height": height_content});
122			} else {
123				target.find('.sliderItem').css({"min-height": height_content});
124				target.find('.sliderItem').css({"max-height": height_content});
125			}
126			target.css({"max-height": height_content});
127			target.siblings('.sliderShowcase').css({"max-height": height_content});
128		}
129		jQuery(this).css('background-image', 'url("' + bg_url + '")').promise().done(function () {
130			dLoaderRemove(jQuery(this));
131		});
132		// }
133	});
134}
135function mp_resize_bg_image_area(target, bg_url) {
136	let tmpImg = new Image();
137	tmpImg.src = bg_url;
138	jQuery(tmpImg).one('load', function () {
139		let imgWidth = tmpImg.width;
140		let imgHeight = tmpImg.height;
141		let height = target.outerWidth() * imgHeight / imgWidth;
142		target.css({"min-height": height});
143	});
144}
145(function ($) {
146	let bg_image_load = false;
147	$(document).ready(function () {
148		$('body').find('div.mpStyle [data-bg-image]').each(function () {
149			dLoader($(this));
150		});
151		$(window).on('load', function () {
152			load_initial();
153		});
154		if (!bg_image_load) {
155			load_initial();
156			$(document).scroll(function () {
157				load_initial();
158			});
159		}
160	});
161
162	$(window).on('load , resize', function () {
163		$('body').find('div.mpStyle [data-bg-image]:visible').each(function () {
164			let target = $(this);
165			if (target.closest('.sliderAllItem').length === 0) {
166				let bg_url = target.data('bg-image');
167				if (!bg_url || bg_url.width === 0 || bg_url.width === 'undefined') {
168					bg_url = mp_empty_image_url;
169				}
170				mp_resize_bg_image_area(target, bg_url);
171			}
172		});
173		jQuery('body').find('div.mpStyle .sliderAllItem:visible').each(function () {
174			let target = jQuery(this);
175			mpwem_slider_resize(target)
176		});
177	});
178	function load_initial() {
179		if (!bg_image_load) {
180			if (loadBgImage()) {
181				bg_image_load = true;
182				placeholderLoaderRemove($('.mpStyle.placeholderLoader'))
183			}
184		}
185	}
186}(jQuery));
187//=============================================================================Change icon and text=================//
188function content_icon_change(currentTarget) {
189	let openIcon = currentTarget.data('open-icon');
190	let closeIcon = currentTarget.data('close-icon');
191	if (openIcon || closeIcon) {
192		currentTarget.find('[data-icon]').toggleClass(closeIcon).toggleClass(openIcon);
193	}
194}
195function content_text_change(currentTarget) {
196	let openText = currentTarget.data('open-text');
197	openText = openText ? openText.toString() : '';
198	let closeText = currentTarget.data('close-text');
199	closeText = closeText ? closeText : '';
200	if (openText || closeText) {
201		let text = currentTarget.find('[data-text]').html();
202		text = text ? text.toString() : ''
203		if (text !== openText) {
204			currentTarget.find('[data-text]').html(openText);
205		} else {
206			currentTarget.find('[data-text]').html(closeText);
207		}
208	}
209}
210function content_class_change(currentTarget) {
211	let clsName = currentTarget.data('add-class');
212	if (clsName) {
213		if (currentTarget.find('[data-class]').length > 0) {
214			currentTarget.find('[data-class]').toggleClass(clsName);
215		} else {
216			currentTarget.toggleClass(clsName);
217		}
218	}
219}
220
221function mp_all_content_change($this) {
222	loadBgImage();
223	content_class_change($this);
224	content_icon_change($this);
225	content_text_change($this);
226}
227
228//==============================================================================Qty inc dec================//
229
230
231(function ($) {
232	"use strict";
233	$(document).on("click", "div.mpStyle .decQty ,div.mpStyle .incQty", function () {
234		let current = $(this);
235		let target = current.closest('.qtyIncDec').find('input');
236		let currentValue = parseInt(target.val()) || 0;
237		let min = parseInt(target.attr('min')) || 0;
238		let max = parseInt(target.attr('max')) || 999;
239		let minQty = parseInt(target.attr('data-min-qty')) || 0;
240		let value;
241		target.parents('.qtyIncDec').find('.incQty , .decQty').removeClass('mpDisabled');
242		if (current.hasClass('incQty')) {
243			// Increment logic
244			if (currentValue === 0 && minQty > 0) {
245				// Jump from 0 to min_qty if min_qty is set
246				value = minQty;
247			} else {
248				// Normal increment
249				value = currentValue + 1;
250			}
251		} else {
252			// Decrement logic
253			if (currentValue <= minQty && minQty > 0) {
254				// If at min_qty, go to 0
255				value = 0;
256			} else {
257				// Normal decrement but not below 0
258				value = Math.max(0, currentValue - 1);
259			}
260		}
261		// Enforce max limit
262		if (value > max) {
263			value = max;
264			target.parents('.qtyIncDec').find('.incQty').addClass('mpDisabled');
265		}
266		// Disable decrement button at 0
267		if (value === 0) {
268			target.parents('.qtyIncDec').find('.decQty').addClass('mpDisabled');
269		}
270		// Disable increment button at max
271		if (value >= max) {
272			target.parents('.qtyIncDec').find('.incQty').addClass('mpDisabled');
273		}
274		target.val(value).trigger('change').trigger('input');
275	});
276}(jQuery));
277
278
279//============================================================================Tabs================//
280(function ($) {
281	"use strict";
282	function active_next_tab(parent, targetTab) {
283		parent.height(parent.height());
284		let tabsContent = parent.find('.tabsContentNext:first');
285		let target_tabContent = tabsContent.children('[data-tabs-next="' + targetTab + '"]');
286		let index = target_tabContent.index() + 1;
287		let num_of_tab = parent.find('.tabListsNext:first').children('[data-tabs-target-next]').length;
288		let i = 1;
289		for (i; i <= num_of_tab; i++) {
290			let target_tab = parent.find('.tabListsNext:first').children('[data-tabs-target-next]:nth-child(' + i + ')');
291			if (i <= index) {
292				target_tab.addClass('active');
293			} else {
294				target_tab.removeClass('active');
295			}
296			if (i === index - 1) {
297				mp_all_content_change(target_tab);
298			}
299		}
300		if (index < 2 && num_of_tab > index) {
301			parent.find('.nextTab_next').slideDown('fast');
302			parent.find('.nextTab_prev').slideUp('fast');
303		} else if (num_of_tab === index) {
304			parent.find('.nextTab_next').slideUp('fast');
305			parent.find('.nextTab_prev').slideDown('fast');
306		} else {
307			parent.find('.nextTab_next').slideDown('fast');
308			parent.find('.nextTab_prev').slideDown('fast');
309		}
310		target_tabContent.slideDown(350);
311		tabsContent.children('[data-tabs-next].active').slideUp(350).removeClass('active').promise().done(function () {
312			target_tabContent.addClass('active').promise().done(function () {
313				pageScrollTo(tabsContent);
314				parent.height('auto').promise().done(function () {
315					loadBgImage();
316					//mp_sticky_management();
317					dLoaderRemove(parent);
318				});
319			});
320		});
321	}
322	$(document).on('click', '.mpStyle .mpTabsNext .nextTab_prev_link', function () {
323		let parent = $(this).closest('.mpTabsNext');
324		if (parent.find('[data-tabs-target-next].active').length > 1) {
325			parent.find('.nextTab_prev').trigger('click');
326		}
327	});
328	$(document).on('click', '.mpStyle .mpTabsNext .nextTab_next', function () {
329		let parent = $(this).closest('.mpTabsNext');
330		let target = parent.find('.tabListsNext:first');
331		let num_of_tab = target.children('[data-tabs-target-next].active').length + 1;
332		let targetTab = target.children('[data-tabs-target-next]:nth-child(' + num_of_tab + ')').data('tabs-target-next');
333		active_next_tab(parent, targetTab);
334	});
335	$(document).on('click', '.mpStyle .mpTabsNext .nextTab_prev', function () {
336		let parent = $(this).closest('.mpTabsNext');
337		let target = parent.find('.tabListsNext:first');
338		let num_of_tab = target.children('[data-tabs-target-next].active').length - 1;
339		let targetTab = target.children('[data-tabs-target-next]:nth-child(' + num_of_tab + ')').data('tabs-target-next');
340		active_next_tab(parent, targetTab);
341	});
342	$(document).ready(function () {
343
344		$('.mpStyle .mpTabsNext').each(function () {
345			let parent = $(this);
346			if (parent.find('[data-tabs-target-next].active').length < 1) {
347				dLoader(parent);
348				let tabLists = parent.find('.tabListsNext:first');
349				let targetTab = tabLists.find('[data-tabs-target-next]').first().data('tabs-target-next')
350				active_next_tab(parent, targetTab);
351			}
352		});
353	});
354	$(document).on('click', '.mpStyle [data-tabs-target]', function () {
355		if (!$(this).hasClass('active')) {
356			let tabsTarget = $(this).data('tabs-target');
357			let parent = $(this).closest('.mpTabs');
358			parent.height(parent.height());
359			let tabLists = $(this).closest('.tabLists');
360			let tabsContent = parent.find('.tabsContent:first');
361			tabLists.find('[data-tabs-target].active').each(function () {
362				$(this).removeClass('active').promise().done(function () {
363					mp_all_content_change($(this))
364				});
365			});
366			$(this).addClass('active').promise().done(function () {
367				mp_all_content_change($(this))
368			});
369			tabsContent.children('[data-tabs="' + tabsTarget + '"]').slideDown(350);
370			tabsContent.children('[data-tabs].active').slideUp(350).removeClass('active').promise().done(function () {
371				tabsContent.children('[data-tabs="' + tabsTarget + '"]').addClass('active').promise().done(function () {
372					//dLoaderRemove(tabsContent);
373					loadBgImage();
374					parent.height('auto');
375				});
376			});
377		}
378	});
379}(jQuery));
380//======================================================================Collapse=================//
381(function ($) {
382	"use strict";
383	$(document).on('click', '.mpStyle [data-collapse-target]', function () {
384		let currentTarget = $(this);
385		let target_id = currentTarget.data('collapse-target');
386		let close_id = currentTarget.data('close-target');
387		let target = $('[data-collapse="' + target_id + '"]');
388		if (target_close(close_id, target_id) && collapse_close_inside(currentTarget) && target_collapse(target, currentTarget)) {
389			mp_all_content_change(currentTarget);
390		}
391	});
392	$(document).on('change', '.mpStyle select[data-collapse-target]', function () {
393		let currentTarget = $(this);
394		let value = currentTarget.val();
395		currentTarget.find('option').each(function () {
396			if ($(this).attr('data-option-target-multi')) {
397				let target_ids = $(this).data('option-target-multi');
398				target_ids = target_ids.toString().split(" ");
399				target_ids.forEach(function (target_id) {
400					let target = $('[data-collapse="' + target_id + '"]');
401					target.slideUp(350).removeClass('mActive');
402				});
403			} else {
404				let target_id = $(this).data('option-target');
405				let target = $('[data-collapse="' + target_id + '"]');
406				target.slideUp('fast').removeClass('mActive');
407			}
408		}).promise().done(function () {
409			currentTarget.find('option').each(function () {
410				let current_value = $(this).val();
411				if (current_value === value) {
412					if ($(this).attr('data-option-target-multi')) {
413						let target_ids = $(this).data('option-target-multi');
414						target_ids = target_ids.toString().split(" ");
415						target_ids.forEach(function (target_id) {
416							let target = $('[data-collapse="' + target_id + '"]');
417							target.slideDown(350).removeClass('mActive');
418						});
419					} else {
420						let target_id = $(this).data('option-target');
421						let target = $('[data-collapse="' + target_id + '"]');
422						target.slideDown(350).removeClass('mActive');
423					}
424				}
425			});
426		});
427	});
428	function target_close(close_id, target_id) {
429		$('body').find('[data-close="' + close_id + '"]:not([data-collapse="' + target_id + '"])').slide
429Up(250);
430		return true;
431	}
432	function target_collapse(target, $this) {
433		if ($this.is('[type="radio"]')) {
434			target.slideDown(250);
435		} else {
436			target.each(function () {
437				$(this).slideToggle(250).toggleClass('mActive');
438			});
439		}
440		return true;
441	}
442
443}(jQuery));
444//=====================================================================Group Check box==========//
445(function ($) {
446	"use strict";
447	$(document).on('click', '.mpStyle .groupCheckBox .customCheckboxLabel', function () {
448		let parent = $(this).closest('.groupCheckBox');
449		let value = '';
450		let separator = ',';
451		parent.find(' input[type="checkbox"]').each(function () {
452			if ($(this).is(":checked")) {
453				let currentValue = $(this).attr('data-checked');
454				value = value + (value ? separator : '') + currentValue;
455			}
456		}).promise().done(function () {
457			parent.find('input[type="hidden"]').val(value);
458		});
459	});
460
461}(jQuery));
462
463
464//==============================================================Modal / Popup==========//
465(function ($) {
466	"use strict";
467	$(document).on('click', '.mpStyle [data-target-popup]', function () {
468		let target = $(this).attr('data-active-popup', '').data('target-popup');
469		$('body').addClass('noScroll').find('[data-popup="' + target + '"]').addClass('in').promise().done(function () {
470			loadBgImage();
471			return true;
472		});
473	});
474	$(document).on('click', 'div.mpPopup  .popupClose', function () {
475		$(this).closest('[data-popup]').removeClass('in');
476		$('body').removeClass('noScroll').find('[data-active-popup]').removeAttr('data-active-popup');
477		return true;
478	});
479}(jQuery));
480//==============================================================Slider=================//
481(function ($) {
482	"use strict";
483	//=================initial call============//
484	$('.superSlider').each(function () {
485		sliderItemActive($(this), 1);
486	});
487	//==============Slider===================//
488	$(document).on('click', '.superSlider [data-slide-target]', function () {
489		if (!$(this).hasClass('activeSlide')) {
490			let activeItem = $(this).data('slide-target');
491			let parent = $(this).closest('.superSlider');
492			sliderItemActive(parent, activeItem);
493			parent.find('[data-slide-target]').removeClass('activeSlide');
494			$(this).addClass('activeSlide');
495		}
496	});
497	$(document).on('click', '.superSlider .iconIndicator', function () {
498		let parent = $(this).closest('.superSlider');
499		let activeItem = parseInt(parent.find('.sliderAllItem').first().find('.sliderItem.activeSlide').data('slide-index'));
500		if ($(this).hasClass('nextItem')) {
501			++activeItem;
502		} else {
503			--activeItem;
504		}
505		sliderItemActive(parent, activeItem);
506	});
507	function sliderItemActive(parent, activeItem) {
508		let itemLength = parent.find('.sliderAllItem').first().find('[data-slide-index]').length;
509		let currentItem = getSliderItem(parent, activeItem);
510		let activeCurrent = parseInt(parent.find('.sliderAllItem').first().find('.sliderItem.activeSlide').data('slide-index'));
511		let i = 1;
512		for (i; i <= itemLength; i++) {
513			let target = parent.find('.sliderAllItem').first().find('[data-slide-index="' + i + '"]').first();
514			if (i < currentItem && currentItem !== 1) {
515				sliderClassControl(target, currentItem, activeCurrent, 'prevSlider', 'nextSlider');
516			}
517			if (i === currentItem) {
518				parent.find('.sliderAllItem').first().find('[data-slide-index="' + currentItem + '"]').removeClass('prevSlider nextSlider').addClass('activeSlide');
519			}
520			if (i > currentItem && currentItem !== itemLength) {
521				sliderClassControl(target, currentItem, activeCurrent, 'nextSlider', 'prevSlider');
522			}
523			if (i === itemLength && itemLength > 1) {
524				if (currentItem === 1) {
525					target = parent.find('.sliderAllItem').first().find('[data-slide-index="' + itemLength + '"]');
526					sliderClassControl(target, currentItem, activeCurrent, 'prevSlider', 'nextSlider');
527				}
528				if (currentItem === itemLength) {
529					target = parent.find('.sliderAllItem').first().find('[data-slide-index="1"]');
530					sliderClassControl(target, currentItem, activeCurrent, 'nextSlider', 'prevSlider');
531				}
532			}
533		}
534	}
535	function sliderClassControl(target, currentItem, activeCurrent, add_class, remove_class) {
536		if (target.hasClass('activeSlide')) {
537			if (currentItem > activeCurrent) {
538				target.removeClass('activeSlide').addClass(add_class);
539			} else {
540				target.removeClass('activeSlide').removeClass(remove_class).addClass(add_class);
541			}
542		} else if (target.hasClass(remove_class)) {
543			target.removeClass(remove_class).delay(600).addClass(add_class);
544		} else {
545			if (!target.hasClass(add_class)) {
546				target.addClass(add_class);
547			}
548		}
549	}
550	function getSliderItem(parent, activeItem) {
551		let itemLength = parent.find('.sliderAllItem').first().find('[data-sli
551de-index]').length;
552		activeItem = activeItem < 1 ? itemLength : activeItem;
553		activeItem = activeItem > itemLength ? 1 : activeItem;
554		return activeItem;
555	}
556	//popup
557	$(document).on('click', '.superSlider [data-target-popup]', function () {
558		let target = $(this).data('target-popup');
559		let activeItem = $(this).data('slide-index');
560		$('body').addClass('noScroll').find('[data-popup="' + target + '"]').addClass('in').promise().done(function () {
561			sliderItemActive($(this), activeItem);
562			loadBgImage();
563		});
564	});
565	$(document).on('click', '.superSlider .popupClose', function () {
566		$(this).closest('[data-popup]').removeClass('in');
567		$('body').removeClass('noScroll');
568	});
569}(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.