PageSourceSearch

https://langdevelopmentgroup.com/wp-content/plugins/real-estate-ma…/front/js/search-property.js?ver=6.4.12

js langdevelopmentgroup.com collected 2026-10-05 22:13:50 UTC 13,694 bytes, 420 lines download raw bytes

1jQuery(document).ready(function($) {
2	if (typeof $('.rem-select2-field').select2 === "function") { 
3		$('.rem-select2-field').select2({placeholder: $(this).data('placeholder')});
4	    $('.select2-container').width('100%');
5	}
6	$('.ich-settings-main-wrap .image-fill').each(function(index, el) {
7		jQuery(this).imagefill();
8	});
9
10	if ($('.search-options .wcp-eq-height').length) {
11		$('.search-options .wcp-eq-height > div').matchHeight({byRow: false});
12	}
13
14	$('ul.page-numbers').addClass('pagination');
15	$('.page-numbers.current').closest('li').addClass('active');
16	
17	$('.search-property-form').submit(function(event) {
18		event.preventDefault();
19		$(this).data('offset', parseInt(rem_ob.offset));
20		var s_wrap = $(this).closest('.ich-settings-main-wrap');
21		var results_cont = '';
22		if ($(this).data('resselector') != '') {
23			selectorTest = $(this).data('resselector');
24			if ( selectorTest.indexOf('.') != 0 && selectorTest.indexOf('#') != 0 ){
25				if ( $("." + selectorTest).length )
26				{
27					results_cont = $("." + selectorTest);
28				} else if ( $("#" + selectorTest).length ) {
29					results_cont = $("#" + selectorTest);
30				}
31			} else {
32				if ( $(selectorTest).length ){
33					results_cont = $(selectorTest);
34				}
35			}
36		}
37
38		if ( results_cont == '' || typeof results_cont === "undefined" ){
39			results_cont = s_wrap.find('.searched-properties');
40		}
41		s_wrap.find('.searched-properties').html('');
42		s_wrap.find('.loader').show();
43
44	    var ajaxurl = $(this).data('ajaxurl');
45	    var formData = $(this).serializeArray();
46
47		 
48	    function arrayClean(thisArray, thisName) {
49	    	
50		    $.each(thisArray, function(index, item) {
51		        if (item != undefined ) {
52
53			        if (item.name == thisName) {
54			            formData.splice( index, 1);      
55			        }
56		        };
57		    });
58		}
59	    var fields = $(".rem-field-hide select").map(function() {
60        	return $(this).attr('name');
61       	}).get();
62	    $.each( fields, function(index, key){
63	    	arrayClean( formData, key);
64	    });
65
66	    $.post(ajaxurl, formData, function(resp) {
67			s_wrap.find('.loader').hide();
68	    	results_cont.html(resp);
69	    	if (s_wrap.data('autoscroll') == 'enable') {
70			    $('html, body').animate({
71			        scrollTop: results_cont.offset().top
72			    }, 2000);
73	    	}
74			$('.ich-settings-main-wrap .image-fill').each(function(index, el) {
75				jQuery(this).imagefill();
76			});
77			
78			if ($('.search-property-form').data('offset') == '-1') {
79				$('.rem-load-more-wrap').hide();
80			}
81			if ($('.masonry-enabled').length) {
82				$('.searched-properties').imagesLoaded( function() {
83					$('.searched-properties > .row').masonry();
84				});
85			}
86			$('ul.page-numbers').addClass('pagination');
87			
88			$('.page-numbers.current').closest('li').addClass('active');
89	    });
90	}); 
91
92	if ($('.search-property-form').length > 0 && $('.search-property-form').data('offset') != '-1') {
93		
94		$('body').on('click', '.rem-load-more-wrap a.page-numbers', function(event) {
95			event.preventDefault();
96			var paged = $(this).text();
97			if($(this).hasClass('next')){
98				paged = parseInt($(this).closest('.pagination').find('.current').text()) + 1;
99			}
100			if($(this).hasClass('prev')){
101				paged = parseInt($(this).closest('.pagination').find('.current').text()) - 1;
102			}
103
104			var form = $('.search-property-form');
105			var s_wrap = $(form).closest('.ich-settings-main-wrap');
106			var results_cont = '';
107			if ($(form).data('resselector') != '') {
108				selectorTest = $(form).data('resselector');
109				if ( selectorTest.indexOf('.') != 0 && selectorTest.indexOf('#') != 0 ){
110					if ( $("." + selectorTest).length )
111					{
112						results_cont = $("." + selectorTest);
113					} else if ( $("#" + selectorTest).length ) {
114						results_cont = $("#" + selectorTest);
115					}
116				} else {
117					if ( $(selectorTest).length ){
118						results_cont = $(selectorTest);
119					}
120				}
121			}
122
123			if ( results_cont == '' || typeof results_cont === "undefined" ){
124				results_cont = s_wrap.find('.searched-properties');
125			}
126
127			results_cont.addClass('rem-loading-ajax');
128
129		    var ajaxurl = $(form).data('ajaxurl');
130		    var formData = $(form).serializeArray();
131
132			 
133		    function arrayClean(thisArray, thisName) {
134		    	
135			    $.each(thisArray, function(index, item) {
136			        if (item != undefined ) {
137
138				        if (item.name == thisName) {
139				            formData.splice( index, 1);      
140				        }
141			        };
142			    });
143			}
144		    var fields = $(".rem-field-hide select").map(function() {
145	        	return $(form).attr('name');
146	       	}).get();
147	       	
148		    $.each( fields, function(index, key){
149		    	arrayClean( formData, key);
150		    });
151		    var paged_obj = {
152		    	name : 'paged',
153		    	value : parseInt(paged)
154		    }
155		    formData.push(paged_obj);
156		    
157		    $.post(ajaxurl, formData, function(resp) {
158		    	results_cont.html(resp);
159				$('.ich-settings-main-wrap .image-fill').each(function(index, el) {
160					jQuery(this).imagefill();
161				});
162
163				setTimeout(function() {
164					if ($('.masonry-enabled').length) {
165						$('.searched-properties').imagesLoaded( function() {
166							$('.searched-properties > .row').masonry();
167						});
168					}
169				}, 500);
170
171				$('ul.page-numbers').addClass('pagination');
172				$('.page-numbers.current').closest('li').addClass('active');
173				results_cont.removeClass('rem-loading-ajax');
174		    });
175		});
176	}
177
178	if (jQuery('.labelauty-unchecked-image').length == 0 && jQuery(".labelauty").length) {
179		jQuery(".labelauty").labelauty();
180	}
181
182	var $filter = jQuery('.filter', '#rem-search-box');
183
184	jQuery('.botton-options', '#rem-search-box').on('click', function(){
185		hideSearcher();
186	});
187
188	function hideSearcher(navigatorMap){
189
190		if(navigatorMap==true){
191			$searcher.slideUp(500);
192		} else {
193			$searcher.slideToggle(500);
194		}
195		return false;
196	}
197
198	jQuery(".set-searcher", '#rem-search-box').on('click', hideSearcher);
199
200	jQuery(".more-button", '#rem-search-box').on('click', function(){
201		$filter.toggleClass('hide-filter');
202		return false;
203	});
204
205	if ($('.search-container.auto-complete').length > 0) {
206		$('.search-container.auto-complete input[type=text]').autocomplete({
207		    source: function (request, response) {
208		    	var element_id = $(this.element).attr('id');
209		    	var ajax_url = $('#search-property').data('ajaxurl');
210		    	var data = {
211		    		action: 'rem_search_autocomplete',
212		    		field: element_id,
213		    		search: request.term
214		    	}
215		    	$.post(ajax_url, data, function(resp) {
216		    		if (resp != '') {
217		    			response( JSON.parse(resp) );	
218		    		}
219		    	});
220		    }
221		});		
222	}
223
224	if ($('.rem-widget-search.auto-complete').length > 0) {
225		$('.rem-widget-search.auto-complete input[type=text]').autocomplete({
226		    source: function (request, response) {
227		    	var element_id = $(this.element).attr('id');
228		    	var ajax_url = $('.rem-ajax-url').val();
229		    	var data = {
230		    		action: 'rem_search_autocomplete',
231		    		field: element_id,
232		    		search: request.term
233		    	}
234		    	$.post(ajax_url, data, function(resp) {
235		    		if (resp != '') {
236		    			response( JSON.parse(resp) );	
237		    		}
238		    	});
239		    }
240		});		
241	}
242	$('button[type="reset"]').on('click', function(event) {
243		$('.p-slide-wrap').each(function(index, el) {
244			$(this).find('.price-range').val([parseInt(rem_ob.price_min_default), parseInt(rem_ob.price_max_default) ]);
245		});
246
247		$('.slider-range-input').each(function(index, el) {
248			$(this).find('.price-range').val([ parseInt($(this).data('default_min')), parseInt($(this).data('default_max')) ]);
249		});
250
251		if (typeof $('.rem-select2-field').select2 === "function") { 
252			jQuery('.rem-select2-field').val([]).change();
253		}
254	});
255
256	rerender_price_ranges = function(element, type = '', initial = false){
257		if(!initial){
258			element.get(0).destroy();
259		}
260		element.noUiSlider({
261			start: [ parseInt(rem_ob['price_min_default'+type]), parseInt(rem_ob['price_max_default'+type]) ],
262			behaviour: 'drag',
263			direction: rem_ob.site_direction,
264			step: parseInt(rem_ob['price_step'+type]),
265			connect: true,
266			change: function(){
267			},
268			range: {
269				'min': parseInt(rem_ob['price_min'+type]),
270				'max': parseInt(rem_ob['price_max'+type])
271			},
272			format: wNumb({
273				decimals: parseInt(rem_ob.decimal_points),
274				mark: rem_ob.decimal_separator,
275				thousand: rem_ob.thousand_separator,
276			}),
277		});
278		var wrap = element.closest('.p-slide-wrap');
279		element.Link('lower').to( wrap.find('#price-value-min') );
280		element.Link('lower').to( wrap.find('#min-value') );
281		element.Link('upper').to( wrap.find('#price-value-max') );
282		element.Link('upper').to( wrap.find('#max-value') );
283	}
284
285	$('.p-slide-wrap').each(function(index, el) {
286		rerender_price_ranges($(this).find('.price-range'), '', true);
287	});
288
289	$('.rem-search-form-wrap').on('change', '[name='+rem_ob.price_range_name+']', function(event) {
290		event.preventDefault();
291		if ($(this).val() == rem_ob.price_range_value) {
292			rerender_price_ranges($(this).closest('.rem-search-form-wrap').find('.price-range'), '_r');
293		} else {
294			rerender_price_ranges($(this).closest('.rem-search-form-wrap').find('.price-range'));
295		}
296	});
297
298	$('.slider-range-input').each(function(index, el) {
299	    
300	    $(this).noUiSlider({
301	        start: [ parseInt($(this).data('default_min')), parseInt($(this).data('default_max')) ],
302	        behaviour: 'drag',
303	        direction: rem_ob.site_direction,
304	        step: 1,
305	        connect: true,
306	        range: {
307	            'min': parseInt($(this).data('min')),
308	            'max': parseInt($(this).data('max'))
309	        },
310			format: wNumb({
311				decimals: parseInt(rem_ob.range_decimal_points
312					),
313				mark: rem_ob.range_decimal_separator,
314				thousand: rem_ob.range_thousand_separator,
315			}),
316	    });
317	    $(this).Link('lower').to( $(this).siblings('.price-slider').find('.price-value-min') );
318	    $(this).Link('lower').to( $(this).siblings('.min-value') );
319	    $(this).Link('upper').to( $(this).siblings('.price-slider').find('.price-value-max') );
320	    $(this).Link('upper').to( $(this).siblings('.max-value') );
321	});
322
323
324	$('.price-slider').on('change', '.any-check', function(event) {
325		event.preventDefault();
326		var rangeWrapper = $(this).closest('.p-slide-wrap');
327		if ($(this).find('input').is(":checked")){
328			rangeWrapper.find('.noUi-base, span').css({
329				'opacity': '0.5',
330				'pointer-events': 'none'
331			});
332			rangeWrapper.find('.min-value').val('');
333			rangeWrapper.find('.max-value').val('');
334		} else {
335			rangeWrapper.find('.noUi-base, span').css({
336				'opacity': '1',
337				'pointer-events': 'inherit'
338			});
339			var min_val = rangeWrapper.find('.price-value-min').text();
340			var max_val = rangeWrapper.find('.price-value-max').text();
341			rangeWrapper.find('.min-value').val(min_val);
342			rangeWrapper.find('.max-value').val(max_val);
343		}
344	});
345	
346	$('.price-slider .any-check').each(function(index, checkbox) {
347		var rangeWrapper = $(this).closest('.p-slide-wrap');
348		if ($(checkbox).find('input').is(':checked')) {
349			rangeWrapper.find('.noUi-base, span').css({
350				'opacity': '0.5',
351				'pointer-events': 'none'
352			});
353			rangeWrapper.find('.min-value').val('');
354			rangeWrapper.find('.max-value').val('');
355		};
356	});
357
358	// price dropdown 
359	$('body').on('change', '.rem_price_dropdown', function(event) {
360		event.preventDefault();
361		/* Act on the event */
362		
363		var optionSelected = $("option:selected", this);
364		var min = optionSelected.data('min');
365		var max = optionSelected.data('max');
366		
367		$(this).siblings('.rem_price_dropdown_values').find('#min-value').val(min);
368		$(this).siblings('.rem_price_dropdown_values').find('#max-value').val(max);
369	});
370
371	$('.rem_ajax_search_property_form').change(function() {
372		var ajax_url = $('.rem-ajax-url').val();
373		var formData = $(this).serializeArray();
374		var result_area_id = $(this).data('result_area_id');
375		$(result_area_id).css({
376			'opacity': '.5'
377		});
378		
379		$.post(ajax_url, formData, function(resp) {
380			$(result_area_id).css({
381				'opacity': '1'
382			});
383	    	$(result_area_id).html(resp);
384			    $('html, body').animate({
385			        scrollTop: $(result_area_id).offset().top
386			    }, 2000);
387			$('.ich-settings-main-wrap .image-fill').each(function(index, el) {
388				jQuery(this).imagefill();
389			});
390			
391			if ($('.masonry-enabled').length) {
392				$('.searched-properties').imagesLoaded( function() {
393					$('.searched-properties > .row').masonry();
394				});
395			}
396			$(result_area_id).find('.rem-load-more-wrap').hide();
397	    });
398	});
399
400    if ($('.rem-states-list').length && $('.rem-countries-list').length) {
401        $('#rem-search-box').on('change', '.rem-countries-list', function(event) {
402            var currentTab = $(this).closest('.row');
403            var ajax_url = $('#search-property').data('ajaxurl');
404            event.preventDefault();
405            var data = {
406                action: 'rem_get_states',
407                country: $(this).val(),
408                nonce: rem_ob.nonce_states
409            }
410            $.post(ajax_url, data, function(resp) {
411                currentTab.find('.rem-states-list').html(resp);
412                var state = currentTab.find('.rem-states-list').data('state');
413                currentTab.find('.rem-states-list').val(state);
414            });
415        });
416        if ($('.rem-countries-list').val() != '') {
417	        $('.rem-countries-list').trigger('change');
418	    }
419    }
420});

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.