PageSourceSearch

https://www.1stbmgrealty.com/modules/RETS_property/js/lead_form_groups.js

js 1stbmgrealty.com collected 2026-10-08 17:42:39 UTC 8,633 bytes, 203 lines download raw bytes

1 $( document ).ready(function() {
2  
3    $(".group_suggestion_option").chosen();
4    
5     	$('body').append('<div id="dripOverlay"></div>');
6   
7    function resizeInput() {
8   	//Check if length needs to be reset for field.
9   	if($(this).val().length < 1){
10   	   	$(this).attr('size', 1); 
11   	}
12    //If user has no input or choices
13    if ( $(this).val().length < 1 && $('.chosen-choices .search-choice').length < 1){
14    	$(this).removeAttr('size');
15    	$(this).removeAttr('style');
16    }
17    else if( $(this).val().length<1 ) { 
18    //If user has a choice but no new input
19    	$(this).attr('size', 1); 
20    }
21    //Resize input to size of input +-
22    else
23      {
24        $(this).attr('size', $(this).val().length);
25      }
26    };
27    // Call resize function above to resize input dynamically based on user input.
28    $('.chosen-container .chosen-choices li.search-field input[type=text]').keyup(resizeInput).focusout(resizeInput).each(resizeInput);
29   //alert(drip_group_option_selected);
30   
31    $('.drip-group-container-wrapper .form-checkbox').click(function(event) {
32	  var drip_group_option_selected = this.value;
33	  var drip_group_container_id_str = $( this ).closest( "div.drip-group-container" ).attr( "id" );
34	  var id_arr = drip_group_container_id_str.split('-');
35	  var micro_sec_id = id_arr[3];
36	  var no_of_option_selected = parseInt($('#drip-group-container-'+micro_sec_id+' input[type="checkbox"]:checked').length);
37	  if(no_of_option_selected < 3 ){
38	  	 var is_checked = '';
39	  	 var i = 1;
40	  	 if(no_of_option_selected == 2){
41	  	 	 $('#drip-group-container-'+micro_sec_id+' input[type="checkbox"]:checked').each(function(idx, elem) {
42		   		is_checked += $(this).attr('value');
43		   		if(i != 2)
44		   		is_checked += '_';
45		   		
46		   		i++;
47		 	 });
48		 	 if(is_checked != ''){
49		 	 	
50		 	   var element_attr = is_checked.replace(/_/g, '-');
51		 	   var element_attr =  element_attr.toLowerCase();
52    		   show_hide_group_elements_effect(is_checked,micro_sec_id);
53		       process_show_hide_elements(micro_sec_id);
54     		   $( "#drip-"+element_attr+"-subgroup-container-"+micro_sec_id).show();
55		 	 }
56	  	 }
57	  	
58	  	 else{
59	  	 	 drip_group_option_selected = '';
60	  	 	 if($('#drip-group-container-'+micro_sec_id+' input[type="checkbox"]:checked').length > 0){
61		  		 drip_group_option_selected = $('#drip-group-container-'+micro_sec_id+' input[type="checkbox"]:checked').attr('value');
62			     show_hide_group_elements_effect(drip_group_option_selected,micro_sec_id);
63		  	 }
64		  	 else{
65		  	 	$('#drip-group-container-'+micro_sec_id).removeClass('buy sell rent other');
66		  	 	process_show_hide_elements(micro_sec_id);
67		  	 }	
68			 
69	   } 
70    }
71    else{
72    	var action_element = $(this).attr("id");
73    	$('#drip-group-container-'+micro_sec_id+' #'+action_element).attr('checked', false); // Unchecks it
74    	//alert('Please pick a maximum of 2 categories');
75    	
76   
77         $('#dripOverlay').html('<div id="dripMessageBox"><div id="dripTitle"><a href="javascript:void(0);" class="closeDripBox"></a></div><p>Please pick a maximum of 2 categories</p></div>');
78         
79         $('#dripOverlay').fadeIn('slow');
80         
81         	$('#dripMessageBox .closeDripBox').click(function(){
82		      $('#dripOverlay').fadeOut('slow');
83        	});
84        	
85        	
86         $(document).mouseup(function (e){							 
87            if (!$('#dripMessageBox').is(e.target) 
88             && ($('#dripMessageBox').has(e.target).length === 0))
89         {
90          $('#dripOverlay').fadeOut('slow');
91        }
92      });
93
94    }
95	});
96	
97
98	
99	function process_show_hide_elements(micro_sec){
100		 $( "#drip-buyer-subgroup-container-"+micro_sec).hide();
101	     $( "#drip-seller-subgroup-container-"+micro_sec).hide();
102	     $( "#drip-renter-subgroup-container-"+micro_sec).hide();
103	     $( "#drip-other-subgroup-container-"+micro_sec).hide();
104	     
105	     $( "#drip-buyer-seller-subgroup-container-"+micro_sec).hide();
106	     $( "#drip-buyer-renter-subgroup-container-"+micro_sec).hide();
107	     $( "#drip-buyer-other-subgroup-container-"+micro_sec).hide();
108	     $( "#drip-seller-renter-subgroup-container-"+micro_sec).hide();
109	     $( "#drip-seller-other-subgroup-container-"+micro_sec).hide();
110	     $( "#drip-renter-other-subgroup-container-"+micro_sec).hide();
111	}
112	
113	function show_hide_group_elements_effect(drip_group_option_selected,micro_sec_id){
114		 if(drip_group_option_selected=='SELLER'){ //seller
115		 	   $('#drip-group-container-'+micro_sec_id).removeClass('buy sell rent other');
116		       $('#drip-group-container-'+micro_sec_id).addClass('sell');
117		       process_show_hide_elements(micro_sec_id);
118			   $( "#drip-seller-subgroup-container-"+micro_sec_id).show();
119	     }else if(drip_group_option_selected=='BUYER'){ //buyer
120	     	   $('#drip-group-container-'+micro_sec_id).removeClass('buy sell rent other');
121		       $('#drip-group-container-'+micro_sec_id).addClass('buy');
122		       process_show_hide_elements(micro_sec_id);
123   		       $( "#drip-buyer-subgroup-container-"+micro_sec_id).show();
124	     }else if(drip_group_option_selected=='RENTER'){ //renter
125	     	   $('#drip-group-container-'+micro_sec_id).removeClass('buy sell rent other');
126		       $('#drip-group-container-'+micro_sec_id).addClass('rent');
127		       process_show_hide_elements(micro_sec_id);
128    		   $( "#drip-renter-subgroup-container-"+micro_sec_id).show();
129	     }
130	     else if(drip_group_option_selected=='OTHER'){ //renter
131	     	   $('#drip-group-container-'+micro_sec_id).removeClass('buy sell rent other');
132		       $('#drip-group-container-'+micro_sec_id).addClass('other');
133		       process_show_hide_elements(micro_sec_id);
134   		       $( "#drip-other-subgroup-container-"+micro_sec_id).show();
135	     }
136	     else if(drip_group_option_selected=='BUYER_SELLER'){ //renter
137	     	 	$('#drip-group-container-'+micro_sec_id).removeClass('buy sell rent other');
138    		    $('#drip-group-container-'+micro_sec_id).addClass('buy sell');
139	     }	
140	     else if(drip_group_option_selected=='BUYER_RENTER'){ //renter
141	     	 	$('#drip-group-container-'+micro_sec_id).removeClass('buy sell rent other');
142    		    $('#drip-group-container-'+micro_sec_id).addClass('buy rent');
143	     }
144	     else if(drip_group_option_selected=='BUYER_OTHER'){ //renter
145	     	 	$('#drip-group-container-'+micro_sec_id).removeClass('buy sell rent other');
146    		    $('#drip-group-container-'+micro_sec_id).addClass('buy other');
147	     }
148	     else if(drip_group_option_selected=='SELLER_RENTER'){ //renter
149	     	 	$('#drip-group-container-'+micro_sec_id).removeClass('buy sell rent other');
150    		    $('#drip-group-container-'+micro_sec_id).addClass('sell rent');
151	     }
152	     else if(drip_group_option_selected=='SELLER_OTHER'){ //renter
153	     	 	$('#drip-group-container-'+micro_sec_id).removeClass('buy sell rent other');
154    		    $('#drip-group-container-'+micro_sec_id).addClass('sell other');
155	     }
156	     else if(drip_group_option_selected=='RENTER_OTHER'){ //renter
157	     	 	$('#drip-group-container-'+micro_sec_id).removeClass('buy sell rent other');
158    		    $('#drip-group-container-'+micro_sec_id).addClass('rent other');
159	     }
160	}
161	window.addEventListener('message', function (e) {
162		if (e.data !== 'custom form submit') {
163			return;
164		}
165		const formContainers = [
166			document.querySelector('#customForm_get_form'),
167			document.querySelector('#c_form_')
168		].filter(Boolean);
169		const formContainer = formContainers.find(function (container) {
170			const iframe = container.matches('iframe')? container: container.querySelector('iframe');
171			return iframe && iframe.contentWindow === e.source;
172		});
173		if (!formContainer) {
174			return;
175		}
176		setTimeout(function () {
177			const headerHeight = $('header').outerHeight() || 0;
178			const position =$(formContainer).offset().top - headerHeight - 30;
179			window.scrollTo({
180				top: position,
181				behavior: 'smooth'
182			});
183		}, 1000);
184	}, false);	
185});
186 
187function set_lead_group_micro(micro_sec,mode){ 
188    // do nothing
189}
190
191function toggleExtra(e) {
192    const parent = e.target.parentElement.parentElement;
193    const hiddenText = parent.querySelector(".property_extra .long_text");
194    const btnElm = parent.querySelector(".btn_read_more a");
195
196    if (hiddenText.classList.contains('hide')) {
197        hiddenText.classList.remove('hide');
198        btnElm.innerText = 'Show Less';
199    } else {
200        hiddenText.classList.add('hide');
201        btnElm.innerText = 'Show More';
202    }
203}

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.