PageSourceSearch

https://www.chestnutpark.com/modules/register_popup_vow/js/register_popup_vow.js

js chestnutpark.com collected 2026-09-26 03:36:44 UTC 5,272 bytes, 148 lines download raw bytes

1/**
2 * This scripts popup a registration form.
3 */
4var is_superbox_loaded_register_vow = false;
5var search_criteria=1;
6jQuery(document).ready(function() {
7	$('.vow-link').click(function (event) {
8		//search_criteria_vow = get_search_criteria_vow();
9		//alert(seacrh_criteria);exit;
10			//first register the user and than save search
11			var search_criteria=$(this).attr('get_data');
12			jQuery(function(){
13				init_superbox_register_vow(search_criteria);
14			  });
15			get_register_form_popup_vow(event);
16		
17		    //These functions are in ProtectedPropertyDetails.js
18            start_superbox_controllers();
19	});
20	jQuery(function(){
21		    init_superbox_register_vow();
22	});
23});
24
25function register_redirect(){
26	$('.vow-container').hide();
27	parent.location.href = destination_to_vow;
28}
29/**
30 * Get registration form Popup.
31 */
32function get_register_form_popup_vow(event) {
33
34  if ( true == is_superbox_loaded_register_vow) {  
35      	
36    // Save the destination and load the form
37    var $target = jQuery(event.target);
38    var destination = '';
39    if ($target.is("img")) {
40      var $parent = $target.parent();
41      destination = $parent[0];
42
43      // Prevent multiple calls to this function from 'stacking' the registration URL again and again
44      var propertyURLPosition = destination.href.indexOf('destination=');
45      if (-1 != propertyURLPosition) {
46        destination.href = destination.href.substr(propertyURLPosition + 'destination='.length);
47      }
48
49      var page = window.location;
50      var form_url = page.protocol + "//" + page.host + "/protected/link/register" + "?destination=" + destination;
51      $parent[0].href = form_url;
52    }
53    else if ($target.is("a")) {
54      destination = $target[0].href;
55      // Prevent multiple calls to this function from 'stacking' the registration URL again and again
56      var propertyURLPosition = destination.indexOf('destination=');
57      if (-1 != propertyURLPosition) {
58        destination = destination.substr(propertyURLPosition + 'destination='.length);
59      }
60      
61      var page = window.location;
62      var form_url = page.protocol + "//" + page.host + "/vow/link/register" + "?destination=" + destination+'&search_criteria='+search_criteria;
63      $target[0].href = form_url;
64    }
65  }
66}
67
68/*
69 * Function to build search criteria ,eventually saved into database
70 */
71function get_search_criteria_vow(){
72	var search_criteria;
73	
74	var city_state_cntry = $('#gmap-location').val();
75	 var point=map.getCenter();
76	
77	 var city = city_state_cntry.split(',');
78	var city=city[0];
79	
80    var params = "latitude=" + point.lat() + ";longitude=" + point.lng();
81	
82	var price_from=$('#gmap-price-from').val();
83	var new_price_from = price_from.replace('$','');
84	price_from = new_price_from.replace(/\,/g,'');
85	var price_to=$('#gmap-price-to').val();
86	var new_price_to = price_to.replace('$','');
87	price_to = new_price_to.replace(/\,/g,'');
88	var bedrooms = $('#gmap-bedrooms').val();
89	var bathrooms = $('#gmap-bathrooms').val();
90	
91	var rent = ($('#gmap-rent').attr('checked') == true) ? 1:0; 
92	var sale = ($('#gmap-sale').attr('checked') == true) ? 1:0; 
93	var detached = $('.detached').hasClass('selected') ? 1:0; 
94	var semi =  $('.semidetached').hasClass('selected') ? 1:0; 
95	var condo =  $('.condo').hasClass('selected') ? 1:0; 
96	var townhomes = $('.townhomes').hasClass('selected') ? 1:0;
97	var other = $('.other').hasClass('selected') ? 1:0;
98	var zoom_level = map.getZoom();
99	var sort =$('#gmap-sort :selected').val();
100	
101	search_criteria = 'city='+city+';'+params+';price_from='+price_from+';price_to='+price_to+';bedrooms='+bedrooms
102	+';bathrooms='+bathrooms+';for_rent='+rent+';for_sale='+sale
103	+';detached='+detached+';semidetached='+semi+';condo='+condo+';townhomes='+townhomes+';other='+other+';property_sort='+sort+';zoom_level='+zoom_level+';map_page='+1;
104	return search_criteria;
105	//city=Mississauga,latNE=43.59444108750369,latSW=43.56335210532192,lngNE=-79.62736129760742,lngSW=-79.68915939331055,price_from=5000,price_to=$30,000,bedrooms=3,bathrooms=5,rent=0,sale=1,detached=1,semi=0,condo=0,townhomes=1,other=0,sort=price_asc
106	
107}
108
109/**
110 * Initialize superbox
111 * @param search_cri is the parameter use to set global variable search_criteria
112 */
113function init_superbox_register_vow(search_cri) {
114	search_criteria=search_cri;
115  if (false == is_superbox_loaded_register_vow) { 
116	
117    jQuery('.vow-container a[data-op!="register"]').attr('rel', 'superbox[iframe][' + 620 + 'x' + 400 + ']');
118    try {
119    jQuery.superbox();
120    is_superbox_loaded_register_vow = true;
121    }
122    catch(e) {
123    	
124    }
125  }
126}
127
128/**
129 * Gets an array of elements that should be tagged with the superbox
130 * Also tries to call the superbox_elements_by_theme() function to allow each theme to modify / add to the array
131 * The returned array is structured as follows:
132 * 
133 * array[0] = {selector: element_selector, width: width_of_superbox, height: height_of_superbox}
134 * 
135 */
136function superbox_elements_register_vow() {
137  var elements = new Array(); // Holds the elements
138  var default_width = 620;  // Default width of the superbox window
139  var default_height = 400; // Default height of the superbox window
140  
141  elements.push({'selector': '.vow-container a', 'width': default_width, 'height': default_height});
142  return elements;  
143}
144
145
146
147
148

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.