PageSourceSearch

https://asterholidays.com/wp-content/themes/wprentals/js/ajaxcalls.js?ver=1.0

js asterholidays.com collected 2026-10-10 02:08:49 UTC 91,803 bytes, 2,428 lines download raw bytes

1/*global $, jQuery, ajaxcalls_vars, document,placeCircle,google,wpestate_lazy_load_carousel_property_unit, control_vars, window, control_vars, wpestate_start_filtering, wpestate_login_via_facebook, wpestate_login_via_google, wpestate_login_via_google, wpestate_enable_actions_modal, wpestate_show_login_form, wpestate_add_remove_favorite, wpestate_hover_action_pin, wpestate_return_hover_action_pin, wpestate_restart_js_after_ajax, wpestate_set_filter_pins, map, mapfunctions_vars, wpestate_get_custom_value*/
2
3//////////////////////////////////////////////////////////////////////////////////////////////
4/// ajax filtering on header search ; jslint checked
5////////////////////////////////////////////////////////////////////////////////////////////
6
7function wpestate_start_filtering_ajax_map(newpage,pan_ne_lat, pan_ne_long, pan_sw_lat,pan_sv_long,move_map) {
8    "use strict";
9   
10    is_fit_bounds_zoom=1;
11    map_geo_first_load=1;
12    external_action_ondemand=1;
13
14    var ajaxurl,all_fields,all_checkers,city,area,country,property_admin_area,stype,search_location_filter_autointernal,all_checkers,postid,keyword_search;
15
16    all_fields=new Array();
17    ajaxcalls_vars.adv_search_what_half.forEach( function(element) {
18
19        if(element==='property_price' || element==='property_price_v2'  ){
20            all_fields.push({element:'price_low',value: parseInt(jQuery('#price_low').val(), 10)});
21            all_fields.push({element:'price_max',value:parseInt(jQuery('#price_max').val(), 10) });
22        }else if(element==='property_beds_baths'   ){
23            
24            var componentsbeds = jQuery('.wpresidence-componentsbeds').val();
25            var componentsbaths = jQuery('.wpresidence-componentsbaths').val();
26
27            all_fields.push({element:'componentsbeds',value: parseInt(componentsbeds, 10)});
28            all_fields.push({element:'componentsbaths',value:parseInt(componentsbaths, 10) });
29
30        }else if(element==='guest_no'){    
31            if(jQuery('.advanced_search_form_wrapper .guest_no_hidden').length>0){
32              
33                all_fields.push({ element:element.toLowerCase(),value:jQuery('.advanced_search_form_wrapper .guest_no_hidden').val() });
34            }else{
35                all_fields.push({element:element.toLowerCase(),value:jQuery('#'+element.toLowerCase()).val() });
36            }
37        }else{
38            all_fields.push({element:element.toLowerCase(),value:jQuery('#'+element.toLowerCase()).val() });
39        }
40    });
41
42
43    if(ajaxcalls_vars.adv_search_type==='type4'){
44    
45        all_fields.push({element:'property_category',value:jQuery('#property_category').val() });
46        all_fields.push({element:'property_action_category',value:jQuery('#property_action_category').val() });
47    }
48
49    if(jQuery('#search_location_city').length >0){
50        city                    =   jQuery('#search_location_city').val();
51    }
52    if(jQuery('#advanced_city').length >0){
53        city                    =   jQuery('#advanced_city').val();
54    }
55
56    if(jQuery('#advanced_cityhalf').length >0){
57        city                    =   jQuery('#advanced_cityhalf').val();
58    }
59
60
61    if(jQuery('#search_location_area').length>0){
62        area                    =   jQuery('#search_location_area').val();
63    }
64    if(jQuery('#advanced_area').length>0){
65        area                    =   jQuery('#advanced_area').val();
66    }
67    if(jQuery('#advanced_areahalf').length>0){
68        area                    =   jQuery('#advanced_areahalf').val();
69    }
70
71
72
73
74    if(jQuery('#search_location_country').length>0){
75        country                    =   jQuery('#search_location_country').val();
76    }
77
78    if(jQuery('#advanced_country').length>0){
79        country                    =   jQuery('#advanced_country').val();
80    }
81    if(jQuery('#advanced_countryhalf').length>0){
82        country                    =   jQuery('#advanced_countryhalf').val();
83    }
84
85
86
87
88    property_admin_area     =   jQuery('#property_admin_area').val();
89    if(jQuery('#property_admin_areahalf').length>0){
90        property_admin_area                    =   jQuery('#property_admin_areahalf').val();
91    }
92
93    stype                   =   jQuery('#stype').val();
94    search_location_filter_autointernal =   jQuery('#search_location_autointernal').val();
95    if(jQuery('#search_locationhalf_autointernal').length>0){
96        search_location_filter_autointernal                    =   jQuery('#search_locationhalf_autointernal').val();
97    }
98
99
100
101    all_checkers = '';
102    jQuery('.extended_search_check_wrapper input[type="checkbox"]').each(function () {
103        if (jQuery(this).is(":checked")) {
104            all_checkers = all_checkers + "," + jQuery(this).attr("data-label-search");
105        }
106    });
107
108
109
110    postid      =   parseInt(jQuery('#adv-search-1').attr('data-postid'), 10);
111    if ( isNaN(postid) ){
112        postid      =   parseInt(jQuery('#adv_extended_options_text_adv').attr('data-pageid'), 10);
113    }
114
115
116
117    if( jQuery('#keyword_search').length > 0 ){
118        keyword_search          = jQuery('#keyword_search').val();
119    }
120
121
122    var geo_lat     =   '';
123    var geo_long    =   '';
124    var geo_rad     =   '';
125    if( jQuery("#geolocation_search").length > 0){
126        geo_lat     =   jQuery('#geolocation_lat').val();
127        geo_long    =   jQuery('#geolocation_long').val();
128        geo_rad     =   jQuery('#geolocation_radius').val();
129
130    }
131
132
133    ajaxurl     =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
134    jQuery('#google_map_prop_list_sidebar #listing_ajax_container').empty();
135    jQuery('#google_map_prop_list_sidebar #listing_loader').show();
136
137    var nonce = jQuery('#wprentals_ajax_filtering').val();
138    jQuery.ajax({
139        type: 'POST',
140        url: ajaxurl,
141        dataType: 'json',
142        data: {
143            'action'                :   'wpestate_custom_ondemand_pin_load_new',
144            'search_location'       :   search_location_filter_autointernal,
145            'all_fields'            :   all_fields,
146            'stype'                 :   stype,
147            'advanced_city'         :   city,
148            'advanced_area'         :   area,
149            'advanced_country'      :   country,
150            'property_admin_area'   :   property_admin_area,
151            'all_checkers'          :   all_checkers,
152            'newpage'               :   newpage,
153            'postid'                :   postid,
154            'keyword_search'        :   keyword_search,
155            'geo_lat'               :   geo_lat,
156            'geo_long'              :   geo_long,
157            'geo_rad'               :   geo_rad,
158            'pan_ne_lat'            :   pan_ne_lat,
159            'pan_ne_long'           :   pan_ne_long,
160            'pan_sw_lat'            :   pan_sw_lat,
161            'pan_sv_long'           :   pan_sv_long,
162            'move_map'              :   move_map,
163            'security'              :   nonce,
164
165        },
166        success: function (data) {
167      
168
169            jQuery('#advanced_search_map_list').removeClass('movetofixed');
170            jQuery('#listing_loader').hide();
171            jQuery('.listing_loader_title').show();
172            jQuery('#google_map_prop_list_sidebar #listing_ajax_container').empty().append(data.response);
173            jQuery('.pagination_nojax').remove();
174
175            wpestate_restart_js_after_ajax();
176            wpestate_lazy_load_carousel_property_unit();
177            var  new_markers = jQuery.parseJSON(data.markers);
178            if (infoBox !== null) {
179                infoBox.close();
180            }
181
182           
183            if(typeof(move_map)!=='undefined'){          
184             
185                wpestate_set_filter_pins_ondemand(map, new_markers);
186            }else{
187       
188               wpestate_set_filter_pins(map, new_markers);
189            }
190
191            is_fit_bounds_zoom=0;
192
193            if( jQuery("#geolocation_search").length > 0 && initial_geolocation_circle_flag === 0){
194                var place_lat = jQuery('#geolocation_lat').val();
195                var place_lng = jQuery('#geolocation_long').val();
196
197             
198                if(place_lat!=='' && place_lng!==''){
199                    initial_geolocation_circle_flag=1;
200                    wpestate_geolocation_marker(place_lat,place_lng);
201                     if (googlecode_regular_vars.on_demand_pins==='no'){
202                        initial_geolocation_circle_flag=0;
203                     }
204        
205                }
206            }
207
208
209        },
210        error: function (errorThrown) {}
211    });//end ajax
212}
213
214
215
216
217
218
219
220
221function wpestate_geolocation_marker (place_lat, place_lng){
222    var place_radius;
223
224
225    if(control_vars.geo_radius_measure==='miles'){
226        place_radius =parseInt( jQuery('#geolocation_radius').val(),10)*1609.34 ;
227    }else{
228        place_radius =parseInt( jQuery('#geolocation_radius').val(),10)*1000 ;
229    }
230
231    if(wprentals_map_type===1){
232        var place_position=new google.maps.LatLng(place_lat, place_lng);
233        map.setCenter(place_position);
234
235        if(placeCircle!=''){
236            placeCircle.setMap(null);
237            placeCircle='';
238        }
239
240        marker = new google.maps.Marker({
241            map: map,
242            position:  place_position,
243            icon: mapfunctions_vars.path+'/poi/location.png'
244        });
245
246
247        var populationOptions = {
248            strokeColor: '#67cfd8',
249            strokeOpacity: 0.6,
250            strokeWeight: 1,
251            fillColor: '#1CA8DD',
252            fillOpacity: 0.2,
253            map: map,
254            center: place_position,
255            radius: parseInt(place_radius,10)
256        };
257
258        placeCircle = new google.maps.Circle(populationOptions);
259        map.fitBounds(placeCircle.getBounds());
260
261
262    }else if(wprentals_map_type===2){
263        var markerCenter    =   L.latLng(place_lat, place_lng );
264        map.panTo(markerCenter);
265        if(map.hasLayer(circleLayer)){
266            map.removeLayer(circleLayer);
267        }
268
269
270        var markerImage = {
271                iconUrl:  mapfunctions_vars.path+'/poi/location.png',
272                iconSize: [28, 38],
273                iconAnchor: [10, 19],
274                popupAnchor: [1, -18]
275            };
276        var  markerOptions = {
277            riseOnHover: true
278        };
279        if(map.hasLayer(circleLayer)){
280            map.removeLayer(circleLayer);
281        }
282        circleLayer=L.featureGroup();
283        markerOptions.icon = L.icon( markerImage );
284        L.marker( markerCenter, markerOptions ).addTo( map );
285        placeCircle= L.circle( markerCenter, parseInt(place_radius,10) ).addTo(circleLayer);
286
287
288        map.addLayer(circleLayer);
289        map.fitBounds(placeCircle.getBounds());
290    }
291}
292
293
294
295
296
297
298
299
300
301
302
303
304function wpestate_get_custom_value(slug){
305    /*ok*/
306    var value;
307    var is_drop=0;
308    if(slug === 'adv_categ' || slug === 'adv_actions' ||  slug === 'advanced_city' ||  slug === 'advanced_area'  ||  slug === 'county-state'){
309        value = jQuery('#'+slug).attr('data-value');
310    } else if(slug === 'property_price' && mapfunctions_vars.slider_price==='yes'){
311        value = jQuery('#price_low').val();
312    }else if(slug === 'property-country'){
313        value = jQuery('#advanced_country').attr('data-value');
314    }else{
315
316        if( jQuery('#'+slug).hasClass('filter_menu_trigger') ){
317            value = jQuery('#'+slug).attr('data-value');
318            is_drop=1;
319        }else{
320            value = jQuery('#half-'+slug).val() ;
321
322        }
323    }
324
325
326    if (typeof(value)!=='undefined'&& is_drop===0){
327      //  value=  value .replace(" ","-");
328    }
329
330    return value;
331
332}
333
334
335
336
337
338
339//////////////////////////////////////////////////////////////////////////////////////////////
340/// ajax filtering on header search ; jslint checked
341////////////////////////////////////////////////////////////////////////////////////////////
342function wpestate_start_filtering_ajax(newpage) {
343    "use strict";
344    var action, guest_no, country, check_out, check_in, category, city, area, rooms, baths, min_price, price_max, ajaxurl, postid;
345    action      =   jQuery('#adv_actions').attr('data-value');
346    category    =   jQuery('#adv_categ').attr('data-value');
347    city        =   jQuery('#advanced_city').attr('data-value');
348    area        =   jQuery('#advanced_area').attr('data-value');
349    country     =   jQuery('#advanced_country').attr('data-value');
350    rooms       =   parseInt(jQuery('#adv_rooms').val(), 10);
351    baths       =   parseInt(jQuery('#adv_bath').val(), 10);
352    min_price   =   parseInt(jQuery('#price_low').val(), 10);
353    price_max   =   parseInt(jQuery('#price_max').val(), 10);
354    postid      =   parseInt(jQuery('#adv-search-1').attr('data-postid'), 10);
355
356
357    check_in    =   jQuery('#check_in').val();
358    check_out   =   jQuery('#check_out').val();
359    guest_no    =   jQuery('#guest_no_main').val();
360
361    ajaxurl     =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
362    jQuery('#listing_ajax_container').empty();
363    jQuery('.listing_loader_title').show();
364    jQuery('#internal-loader').show();
365    var nonce = jQuery('#wprentals_ajax_filtering').val();
366    jQuery.ajax({
367        type: 'POST',
368        url: ajaxurl,
369        data: {
370            'action'            :   'wpestate_ajax_filter_listings_search',
371            'action_values'     :   action,
372            'category_values'   :   category,
373            'city'              :   city,
374            'area'              :   area,
375            'advanced_rooms'    :   rooms,
376            'advanced_bath'     :   baths,
377            'price_low'         :   min_price,
378            'price_max'         :   price_max,
379            'newpage'           :   newpage,
380            'postid'            :   postid,
381            'check_in'          :   check_in,
382            'check_out'         :   check_out,
383            'guest_no'          :   guest_no,
384            'country'           :   country,
385            'security'          :   nonce,
386        },
387        success: function (data) {
388
389            jQuery('#internal-loader,#listing_loader').hide();
390            jQuery('#listing_ajax_container').addClass('load_from_ajax').empty().append(data);
391            wpestate_restart_js_after_ajax();
392
393        },
394        error: function (errorThrown) {
395
396        }
397    });//end ajax
398}
399
400
401
402
403////////////////////////////////////////////////////////////////////////////////////////////
404/// redo js after ajax calls - jslint checked
405////////////////////////////////////////////////////////////////////////////////////////////
406function wpestate_restart_js_after_ajax() {
407    "use strict";
408    var newpage, post_id, post_image, to_add, icon, already_in, i, bLazy;
409
410    //bLazy = new Blazy();
411    //bLazy.revalidate();
412
413
414    wpestate_open_property_card_setup();
415
416
417    jQuery('#google_map_prop_list_sidebar .listing_wrapper').unbind('mouseenter');
418    jQuery('#google_map_prop_list_sidebar .listing_wrapper').unbind('mouseleave');
419
420    jQuery("#google_map_prop_list_sidebar .listing_wrapper").on("mouseenter", function(event) {
421      var listing_id = jQuery(this).attr('data-listid');
422      wpestate_hover_action_pin(listing_id);
423    })
424
425    jQuery("#google_map_prop_list_sidebar .listing_wrapper").on("mouseleave", function(event) {
426      var listing_id = jQuery(this).attr('data-listid');
427      wpestate_return_hover_action_pin(listing_id);
428    })
429
430
431
432
433    jQuery('.prop-compare:first-of-type').remove();
434    jQuery('.pagination_ajax_search a').on('click',function (event) {
435        event.preventDefault();
436        newpage = parseInt(jQuery(this).attr('data-future'), 10);
437        document.getElementById('scrollhere').scrollIntoView();
438        wpestate_start_filtering_ajax(newpage);
439    });
440
441    jQuery('.pagination_ajax a').on('click',function (event) {
442        event.preventDefault();
443        newpage = parseInt(jQuery(this).attr('data-future'), 10);
444        document.getElementById('scrollhere').scrollIntoView();
445        wpestate_start_filtering(newpage);
446    });
447
448
449
450    jQuery('.pagination_ajax_search_home a').on('click',function (event) {
451
452        event.preventDefault();
453 
454        newpage = parseInt(jQuery(this).attr('data-future'), 10);
455        document.getElementById('scrollhere').scrollIntoView();
456
457        if (googlecode_regular_vars.on_demand_pins==='yes' && map_is_moved===1){
458            external_action_ondemand=1;
459            wpestate_reload_pins_onmap(newpage);
460        }else{
461            wpestate_start_filtering_ajax_map(newpage);
462        }
463    });
464
465
466
467    already_in = [];
468    jQuery('.compare-action').on('click',function (e) {
469        e.preventDefault();
470        e.stopPropagation();
471        jQuery('.prop-compare').show();
472        post_id = jQuery(this).attr('data-pid');
473
474        for (i = 0; i < already_in.length; i++) {
475            if (already_in[i] === post_id) {
476                return;
477            }
478        }
479
480        already_in.push(post_id);
481        post_image = jQuery(this).attr('data-pimage');
482        to_add = '<div class="items_compare ajax_compare" style="display:none;"><img src="' + post_image + '"  class="img-responsive"><input type="hidden" value="' + post_id + '" name="selected_id[]" /></div>';
483        jQuery('div.items_compare:first-child').css('background', 'red');
484        if (parseInt(jQuery('.items_compare').length, 10) > 3) {
485            jQuery('.items_compare:first').remove();
486        }
487        jQuery('#submit_compare').before(to_add);
488        jQuery('.items_compare').fadeIn(800);
489    });
490
491    jQuery('#submit_compare').on('click',function () {
492        jQuery('#form_compare').trigger('submit');
493    });
494
495    jQuery('.icon-fav').on('click',function (event) {
496        event.stopPropagation();
497        icon = jQuery(this);
498        wpestate_add_remove_favorite(icon);
499    });
500
501
502
503
504    jQuery(".share_list, .icon-fav, .compare-action").on("mouseenter", function(event) {
505        jQuery(this).tooltip('show');
506    });
507    jQuery(".share_list, .icon-fav, .compare-action").on("mouseleave", function(event) {
508        jQuery(this).tooltip('hide');
509    });
510
511
512    jQuery('.share_list').on('click',function () {
513        var sharediv = jQuery(this).parent().find('.share_unit');
514        sharediv.toggle();
515        jQuery(this).toggleClass('share_on');
516    });
517
518     wpestate_lazy_load_carousel_property_unit();
519}
520
521////////////////////////////////////////////////////////////////////////////////////////////
522/// add remove from favorite-jslint checked
523////////////////////////////////////////////////////////////////////////////////////////////
524function wpestate_add_remove_favorite(icon) {
525    "use strict";
526    var post_id, securitypass, ajaxurl;
527    post_id         =  icon.attr('data-postid');
528    securitypass    =  jQuery('#security-pass').val();
529    ajaxurl         =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
530
531    if (parseInt(ajaxcalls_vars.userid, 10) === 0) {
532        wpestate_show_login_form(1, 1, 0);
533    } else {
534        icon.toggleClass('icon-fav-off');
535        icon.toggleClass('icon-fav-on');
536        var nonce = jQuery('#wprentals_ajax_filtering').val();
537        jQuery.ajax({
538            type: 'POST',
539            url: ajaxurl,
540            dataType: 'json',
541            data: {
542                'action'            :   'wpestate_ajax_add_fav',
543                'post_id'           :   post_id,
544                'security'          :   nonce
545            },
546            success: function (data) {
547                if (data.added) {
548                    icon.removeClass('icon-fav-off').addClass('icon-fav-on');
549                    icon.attr('data-original-title',ajaxcalls_vars.remove_favorite);
550                } else {
551
552                    icon.removeClass('icon-fav-on').addClass('icon-fav-off');
553                    icon.attr('data-original-title',ajaxcalls_vars.add_favorite_unit);
554                    if(jQuery('.favorite_dashboard_property_list').length>0){
555                      icon.parents('.dasboard-prop-listing').remove();
556                    }
557
558                }
559            },
560            error: function (errorThrown) {
561            }
562        });//end ajax
563    }// end login use
564}
565
566////////////////////////////////////////////////////////////////////////////////////////////
567/// resend listing for approval-jslint checked
568////////////////////////////////////////////////////////////////////////////////////////////
569function wpestate_resend_for_approval(prop_id, selected_div) {
570    "use strict";
571    var ajaxurl, normal_list_no;
572    ajaxurl   =   control_vars.admin_url + 'admin-ajax.php';
573    var nonce = jQuery('#wprentals_property_actions').val();
574    jQuery.ajax({
575        type: 'POST',
576        url: ajaxurl,
577        data: {
578            'action'        :   'wpestate_ajax_resend_for_approval',
579            'propid'        :   prop_id,
580            'security'      :   nonce
581        },
582        success: function (data) {
583            if (data === 'pending') {
584                selected_div.parent().empty().append('<span class="featured_prop">Sent for approval</span>');
585                normal_list_no    =  parseInt(jQuery('#normal_list_no').text(), 10);
586                jQuery('#normal_list_no').text(normal_list_no - 1);
587            } else {
588                selected_div.parent().empty().append(data);
589            }
590        },
591        error: function (errorThrown) {
592
593        }
594    });//end ajax
595}
596
597////////////////////////////////////////////////////////////////////////////////////////////
598/// make property featured-jslint checked
599////////////////////////////////////////////////////////////////////////////////////////////
600function wpestate_make_prop_featured(prop_id, selectedspan) {
601    "use strict";
602    var ajaxurl      =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
603    var nonce = jQuery('#wprentals_property_actions').val();
604    jQuery.ajax({
605        type: 'POST',
606        url: ajaxurl,
607        data: {
608            'action'        :   'wpestate_ajax_make_prop_featured',
609            'propid'        :   prop_id,
610            'security'      :   nonce,
611        },
612        success: function (data) {
613            if (data.trim() === 'done') {
614                selectedspan.empty().html('<span class="label label-success is_featured">' + ajaxcalls_vars.prop_featured + '</span>');
615                selectedspan.removeClass('dashboad-tooltip');
616                var featured_list_no = parseInt(jQuery('#featured_list_no').text(), 10);
617                jQuery('#featured_list_no').text(featured_list_no - 1);
618            } else {
619                selectedspan.empty().removeClass('make_featured').addClass('featured_exp').removeClass('dashboad-tooltip').text(ajaxcalls_vars.no_prop_featured);
620            }
621        },
622        error: function (errorThrown) {
623        }
624
625    });//end ajax
626}
627
628////////////////////////////////////////////////////////////////////////////////////////////
629/// pay package via paypal recuring-jslint checked
630////////////////////////////////////////////////////////////////////////////////////////////
631function wpestate_recuring_pay_pack_via_paypal() {
632    "use strict";
633    var ajaxurl, packName, packId;
634    ajaxurl      =   control_vars.admin_url + 'admin-ajax.php';
635    packName     =   jQuery('#pack_select :selected').text();
636    packId       =   jQuery('#pack_select :selected').val();
637    var nonce    =   jQuery('#wprentals_payments_actions').val();
638
639
640    jQuery.ajax({
641        type: 'POST',
642        url: ajaxurl,
643        data: {
644            'action'        :   'wpestate_ajax_paypal_pack_recuring_generation_rest_api',
645            'packName'      :   packName,
646            'packId'        :   packId,
647            'security'      :   nonce,
648        },
649        success: function (data) {
650
651            window.location.href = data;
652        },
653        error: function (errorThrown) {
654        }
655    });//end ajax
656}
657
658////////////////////////////////////////////////////////////////////////////////////////////
659/// pay package via paypal-jslint checked
660////////////////////////////////////////////////////////////////////////////////////////////
661function wpestate_pay_pack_via_paypal() {
662    "use strict";
663    var  ajaxurl, packName, packId;
664    ajaxurl     =   control_vars.admin_url + 'admin-ajax.php';
665    packName    =   jQuery('#pack_select :selected').text();
666    packId      =   jQuery('#pack_select :selected').val();
667    var nonce   = jQuery('#wprentals_payments_actions').val();
668    jQuery.ajax({
669        type: 'POST',
670        url: ajaxurl,
671        data: {
672            'action'        :   'wpestate_ajax_paypal_pack_generation',
673            'packName'      :   packName,
674            'packId'        :   packId,
675            'security'      :   nonce
676        },
677        success: function (data) {
678
679            window.location.href = data;
680        },
681        error: function (errorThrown) {
682        }
683    });//end ajax
684
685}
686////////////////////////////////////////////////////////////////////////////////////////////
687/// listing pay -jslint checked
688////////////////////////////////////////////////////////////////////////////////////////////
689function wpestate_listing_pay(prop_id, selected_div, is_featured, is_upgrade) {
690    "use strict";
691    var ajaxurl      =   control_vars.admin_url + 'admin-ajax.php';
692     var nonce   = jQuery('#wprentals_payments_actions').val();
693    jQuery.ajax({
694        type: 'POST',
695        url: ajaxurl,
696        data: {
697            'action'        :   'wpestate_ajax_listing_pay',
698            'propid'        :   prop_id,
699            'is_featured'   :   is_featured,
700            'is_upgrade'    :   is_upgrade,
701            'security'      :   nonce
702        },
703        success: function (data) {
704            window.location.href = data;
705        },
706        error: function (errorThrown) {
707        }
708    });//end ajax
709}
710
711////////////////////////////////////////////////////////////////////////////////////////////
712/// start filtering -jslint checked
713////////////////////////////////////////////////////////////////////////////////////////////
714function wpestate_start_filtering(newpage) {
715    "use strict";
716
717    jQuery('#grid_view').addClass('icon_selected');
718    jQuery('#list_view').removeClass('icon_selected');
719    var action, category, city, area, order, ajaxurl, page_id;
720    // get action vars
721    action = jQuery('#a_filter_action').attr('data-value');
722    // get category
723    category = jQuery('#a_filter_categ').attr('data-value');
724    // get city
725    city = jQuery('#a_filter_cities').attr('data-value');
726    // get area
727    area = jQuery('#a_filter_areas').attr('data-value');
728    // get order
729    order = jQuery('#a_filter_order').attr('data-value');
730    ajaxurl =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
731    page_id =   jQuery('#page_idx').val();
732    var is_archive='';
733
734    if(jQuery('body').hasClass('archive') && jQuery('#primary').hasClass('none') ){    
735        is_archive='yes';
736    }
737
738    jQuery('#listing_ajax_container').empty();
739    jQuery('#listing_loader').show();
740
741    var nonce = jQuery('#wprentals_ajax_filtering').val();
742
743    jQuery.ajax({
744        type: 'POST',
745        url: ajaxurl,
746        data: {
747            'action'            :   'wpestate_ajax_filter_listings',
748            'action_values'     :   action,
749            'category_values'   :   category,
750            'city'              :   city,
751            'area'              :   area,
752            'order'             :   order,
753            'newpage'           :   newpage,
754            'page_id'           :   page_id,
755            'is_archive'        :   is_archive,
756            'security'          :   nonce
757        },
758        success: function (data) {
759            jQuery('#listing_loader').hide();
760            jQuery('#listing_ajax_container').empty().append(data);
761            jQuery('.pagination_nojax').hide();
762            wpestate_restart_js_after_ajax();
763            wpestate_lazy_load_carousel_property_unit();
764            //var bLazy = new Blazy();
765            //bLazy.revalidate();
766        },
767        error: function (errorThrown) {
768
769        }
770    });//end ajax
771}
772
773////////////////////////////////////////////////////////////////////////////////////////////
774/// show login form on fav login-jslint checked
775////////////////////////////////////////////////////////////////////////////////////////////
776function wpestate_show_login_form(type, ispop, propid) {
777    "use strict";
778
779    if(parseInt(type,10)===1){
780        jQuery('#ajax_login_div').show();
781        jQuery('#ajax_register_div').hide();
782        jQuery('#forgot-pass-div_mod').hide();
783      
784    }else{
785         jQuery('#ajax_login_div').hide();
786         jQuery('#ajax_register_div').show();
787         jQuery('#forgot-pass-div_mod').hide();
788     }
789
790    //ispop=9 modal is open from booking - hide socila login
791
792    if(parseInt(ispop,10)===9){
793        jQuery('#loginmodal .login-links').hide();
794    }
795
796    jQuery('#loginmodal').modal();
797    wpestate_enable_actions_modal();
798}
799
800////////////////////////////////////////////////////////////////////////////////////////////
801/// change pass on profile-jslint checked
802////////////////////////////////////////////////////////////////////////////////////////////
803function wpestate_change_pass_profile() {
804    "use strict";
805    var oldpass, newpass, renewpass, securitypass, ajaxurl;
806    oldpass         =  jQuery('#oldpass').val();
807    newpass         =  jQuery('#newpass').val();
808    renewpass       =  jQuery('#renewpass').val();
809    securitypass    =  jQuery('#security-pass').val();
810    ajaxurl         =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
811
812    jQuery.ajax({
813        type: 'POST',
814        url: ajaxurl,
815        data: {
816            'action'            :   'wpestate_ajax_update_pass',
817            'oldpass'           :   oldpass,
818            'newpass'           :   newpass,
819            'renewpass'         :   renewpass,
820            'security-pass'     :   securitypass
821        },
822        success: function (data) {
823            jQuery('#profile_pass').empty().append('<div class="login-alert">
823' + data + '<div>');
824            jQuery('#oldpass, #newpass, #renewpass').val('');
825        },
826        error: function (errorThrown) {
827        }
828    });
829}
830
831
832////////////////////////////////////////////////////////////////////////////////////////////
833/// user register via widget-jslint checked
834////////////////////////////////////////////////////////////////////////////////////////////
835function wpestate_register_wd() {
836    "use strict";
837    var user_pass,user_pass_retype,capthca, user_login_register, user_email_register, nonce, ajaxurl,user_type,user_phone;
838    user_login_register =  jQuery('#user_login_register_wd').val();
839    user_email_register =  jQuery('#user_email_register_wd').val();
840    nonce               =  jQuery('#wpestate_ajax_log_reg').val();
841    user_pass           =   jQuery('#user_password_wd').val();
842    user_pass_retype    =   jQuery('#user_password_retype_wd').val();
843    user_phone          =   jQuery('#user_phone_register_wd').val();
844    ajaxurl             =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
845    user_type           =   jQuery("input[name=acc_type]:checked").val();
846
847    if (!jQuery('#user_terms_register_wd').is(":checked")) {
848        jQuery('#register_message_area_wd').empty().append('<div class="login-alert alert_err">' + control_vars.terms_cond + '</div>');
849        return;
850    }
851
852    capthca='';
853    if(control_vars.usecaptcha==='yes'){
854            capthca= grecaptcha.getResponse(
855                widgetId3
856            );
857    }
858
859    jQuery.ajax({
860        type: 'POST',
861        url: ajaxurl,
862        dataType: 'json',
863        data: {
864            'action'                    :   'wpestate_ajax_register_form',
865            'user_login_register'       :   user_login_register,
866            'user_email_register'       :   user_email_register,
867            'user_type'                 :   user_type,
868            'tipul'                     :   2,
869            'capthca'                   :   capthca,
870            'user_pass'                 :   user_pass,
871            'user_pass_retype'          :   user_pass_retype,
872            'user_phone'                :   user_phone,
873            'security'                  :   nonce,
874        },
875
876        success: function (data) {
877            if (data.register === true) {
878                jQuery('#register_message_area_wd').empty().append('<div class="login-alert">' + data.message + '</div>');
879            }else{
880                jQuery('#register_message_area_wd').empty().append('<div class="alert_err login-alert">' + data.message + '</div>');
881            }
882            jQuery('#user_login_register_wd').val('');
883            jQuery('#user_email_register_wd').val('');
884        },
885        error: function (errorThrown) {
886        }
887    });
888}
889
890
891
892
893////////////////////////////////////////////////////////////////////////////////////////////
894/// user register via widget-jslint checked
895////////////////////////////////////////////////////////////////////////////////////////////
896function wpestate_register_wd_mobile() {
897    "use strict";
898    var user_pass,user_pass_retype,capthca,user_login_register, user_email_register, nonce, ajaxurl,user_type,user_phone;
899    user_login_register =  jQuery('#user_login_register_wd_mobile').val();
900    user_email_register =  jQuery('#user_email_register_wd_mobile').val();
901    nonce               =  jQuery('#wpestate_ajax_log_reg').val();
902    ajaxurl             =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
903    user_type           =  jQuery("input[name=acc_type]:checked").val();
904    user_pass           =  jQuery('#user_password_wd_mobile').val();
905    user_pass_retype    =  jQuery('#user_password_retype_wd_mobile').val();
906    user_phone          =  jQuery('#user_phone_register_wd_mobile').val();
907
908    if (!jQuery('#user_terms_register_wd_mobile').is(":checked")) {
909        jQuery('#register_message_area_wd_mobile').empty().append('<div class="login-alert alert_err">' + control_vars.terms_cond + '</div>');
910        return;
911    }
912
913    capthca='';
914    if(control_vars.usecaptcha==='yes'){
915        capthca= grecaptcha.getResponse(
916            widgetId2
917        );
918    }
919
920    jQuery.ajax({
921        type: 'POST',
922        url: ajaxurl,
923        dataType: 'json',
924        data: {
925            'action'                    :   'wpestate_ajax_register_form',
926            'user_login_register'       :   user_login_register,
927            'user_email_register'       :   user_email_register,
928            'security-register'         :   nonce,
929            'user_type'                 :   user_type,
930            'tipul'                     :   1,
931            'capthca'                   :   capthca,
932            'user_pass'                 :   user_pass,
933            'user_pass_retype'          :   user_pass_retype,
934            'user_phone'                :   user_phone,
935            'security'                  :   nonce,
936        },
937
938        success: function (data) {
939            if (data.register === true) {
940                jQuery('#register_message_area_wd_mobile').empty().append('<div class="login-alert">' + data.message + '</div>');
941            }else{
942                jQuery('#register_message_area_wd_mobile').empty().append('<div class="alert_err login-alert">' + data.message + '</div>');
943            }
944            jQuery('#user_login_register_wd_mobile').val('');
945            jQuery('#user_email_register_wd_mobile').val('');
946        },
947        error: function (errorThrown) {
948        }
949    });
950}
951
952
953////////////////////////////////////////////////////////////////////////////////////////////
954/// on ready -jslint checked
955////////////////////////////////////////////////////////////////////////////////////////////
956function wpestate_forgot(type) {
957    "use strict";
958    var  forgot_email, securityforgot, postid, ajaxurl;
959    postid                =  jQuery('#postid').val();
960    ajaxurl               =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
961
962    if (type === 1) {
963        forgot_email          =  jQuery('#forgot_email_mod').val();
964        securityforgot        =  jQuery('#security-login-forgot_wd').val();
965    }
966    if (type === 2) {
967        forgot_email          =  jQuery('#forgot_email_mod').val();
968        securityforgot        =  jQuery('#security-forgot').val();
969    }
970    if (type === 3) {
971        forgot_email          =  jQuery('#forgot_email').val();
972        securityforgot        =  jQuery('#security-login-forgot_wd').val();
973    }
974
975    if (type === 4) {
976        forgot_email          =  jQuery('#forgot_email_mobile').val();
977        securityforgot        =  jQuery('#security-login-forgot_wd_mobile').val();
978    }
979   var nonce               =  jQuery('#wpestate_ajax_log_reg').val();
980
981   jQuery('#forgot_pass_area').empty();
982    jQuery.ajax({
983        type: 'POST',
984        url: ajaxurl,
985        data: {
986            'action'            :   'wpestate_ajax_forgot_pass',
987            'forgot_email'      :   forgot_email,
988            'security-forgot'   :   securityforgot,
989            'postid'            :   postid,
990            'type'              :   type,
991            'security'          :   nonce
992        },
993
994        success: function (data) {
995            if (type === 1) {
996                jQuery('#forgot_email_mod').val('');
997                jQuery('#forgot_pass_area_shortcode').empty().append('<div class="login-alert">' + data + '<div>');
998            }
999            if (type === 2) {
1000                jQuery('#forgot_email').val('');
1001                jQuery('#forgot_pass_area').empty().append('<div class="login-alert">' + data + '<div>');
1002                 jQuery('#forgot_pass_area_shortcode').empty().append('<div class="login-alert">' + data + '<div>');
1003            }
1004            if (type === 3) {
1005                jQuery('#forgot_email_shortcode').val('');
1006                jQuery('#forgot_pass_area').empty().append('<div class="login-alert">' + data + '<div>');
1007            }
1008            if (type === 4) {
1009                jQuery('#forgot_email_mobile').val('');
1010                jQuery('#forgot_pass_area_shortcode_wd_mobile').empty().append('<div class="login-alert">' + data + '<div>');
1011            }
1012        },
1013        error: function (errorThrown) {
1014        }
1015    });
1016}
1017
1018////////////////////////////////////////////////////////////////////////////////////////////
1019/// on ready-jslint checked
1020////////////////////////////////////////////////////////////////////////////////////////////
1021function wpestate_login_wd() {
1022    "use strict";
1023    var login_user, login_pwd, ispop, ajaxurl, security;
1024
1025    login_user          =  jQuery('#login_user_wd').val();
1026    login_pwd           =  jQuery('#login_pwd_wd').val();
1027    security            =  jQuery('#security-login-wd').val();
1028    ispop               =  jQuery('#loginpop_wd').val();
1029    ajaxurl             =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
1030     var nonce               =  jQuery('#wpestate_ajax_log_reg').val();
1031    jQuery('#login_message_area_wd').empty().append('<div class="login-alert">' + ajaxcalls_vars.login_loading + '</div>');
1032    jQuery.ajax({
1033        type: 'POST',
1034        dataType: 'json',
1035        url: ajaxurl,
1036        data: {
1037            'action'            :   'wpestate_ajax_loginx_form',
1038            'login_user'        :   login_user,
1039            'login_pwd'         :   login_pwd,
1040            'ispop'             :   ispop,
1041            'security-login'    :   security,
1042            'propid'            :   0,
1043            'tipul'             :   2,
1044            'security'          :   nonce,
1045        },
1046
1047        success: function (data) {
1048            jQuery('#login_message_area_wd').empty().append('<div class="login-alert">' + data.message + '<div>');
1049            if (data.loggedin === true) {
1050                if (parseInt(data.ispop, 10) === 1) {
1051                    ajaxcalls_vars.userid = data.newuser;
1052                    jQuery('#ajax_login_container').remove();
1053                } else {
1054                    if(jQuery('body').hasClass('single-estate_property') ){
1055                       location.reload();
1056                    }else{
1057                        document.location.href = ajaxcalls_vars.login_redirect;
1058                    }
1059                }
1060                jQuery('#user_not_logged_in').hide();
1061                jQuery('#user_logged_in').show();
1062            } else {
1063                jQuery('#login_user').val('');
1064                jQuery('#login_pwd').val('');
1065            }
1066        },
1067        error: function (errorThrown) {
1068        }
1069    });
1070}
1071
1072////////////////////////////////////////////////////////////////////////////////////////////
1073/// on ready-jslint checked
1074////////////////////////////////////////////////////////////////////////////////////////////
1075function wpestate_login_wd_mobile() {
1076    "use strict";
1077    var login_user, login_pwd, ispop, ajaxurl, security;
1078
1079    login_user          =  jQuery('#login_user_wd_mobile').val();
1080    login_pwd           =  jQuery('#login_pwd_wd_mobile').val();
1081    security            =  jQuery('#security-login-mobile').val();
1082    ispop               =  jQuery('#loginpop_mobile').val();
1083    ajaxurl             =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
1084    var nonce               =  jQuery('#wpestate_ajax_log_reg').val();
1085    jQuery('#login_message_area_wd_mobile').empty().append('<div class="login-alert">' + ajaxcalls_vars.login_loading + '</div>');
1086    jQuery.ajax({
1087        type: 'POST',
1088        dataType: 'json',
1089        url: ajaxurl,
1090        data: {
1091            'action'            :   'wpestate_ajax_loginx_form',
1092            'login_user'        :   login_user,
1093            'login_pwd'         :   login_pwd,
1094            'ispop'             :   ispop,
1095            'security-login'    :   security,
1096            'propid'            :   0,
1097            'tipul'             :   1,
1098            'security'          :   nonce
1099        },
1100
1101        success: function (data) {
1102
1103
1104
1105
1106            if (data.loggedin === true) {
1107
1108
1109                if (parseInt(data.ispop, 10) === 1) {
1110
1111                    ajaxcalls_vars.userid = data.newuser;
1112                    jQuery('#loginmodal').modal('hide');
1113
1114                    if(jQuery('body').hasClass('single-estate_property') ){
1115                        location.reload();
1116                    }else{
1117                        if(ajaxcalls_vars.redirect_users==='yes'){
1118                            location.reload();
1119                        }else{
1120                            if( ajaxcalls_vars.redirect_custom_link===''){
1121                                document.location.href = ajaxcalls_vars.login_redirect;
1122                            }else{
1123                                document.location.href =ajaxcalls_vars.redirect_custom_link;
1124                            }
1125                        }
1126                    }
1127
1128                } else {
1129                    if(data.newlink!==''){
1130                        if(jQuery('body').hasClass('page-template-user_dashboard_add_step1') ){
1131                            document.location.href = data.newlink;
1132                        }else if(jQuery('body').hasClass('single-estate_property') ){
1133                            location.reload();
1134                        }else{
1135                            if(ajaxcalls_vars.redirect_users==='yes'){
1136                                location.reload();
1137                            }else{
1138                                if( ajaxcalls_vars.redirect_custom_link===''){
1139                                    document.location.href = data.newlink;
1140                                }else{
1141                                    document.location.href =ajaxcalls_vars.redirect_custom_link;
1142                                }
1143                            }
1144
1145                        }
1146                    }else{
1147
1148                        if(jQuery('body').hasClass('single-estate_property') ){
1149                            location.reload();
1150                        }else{
1151                            if(ajaxcalls_vars.redirect_users==='yes'){
1152                                location.reload();
1153                            }else{
1154                                if( ajaxcalls_vars.redirect_custom_link===''){
1155                                    document.location.href = ajaxcalls_vars.login_redirect;
1156                                }else{
1157                                    document.location.href =ajaxcalls_vars.redirect_custom_link;
1158                                }
1159                            }
1160                        }
1161                    }
1162
1163                }
1164                jQuery('#user_not_logged_in').hide();
1165                jQuery('#user_logged_in').show();
1166
1167
1168
1169            } else {
1170                jQuery('#login_message_area_wd_mobile').empty().append('<div class="login-alert alert_err">' + data.message + '<div>');
1171                jQuery('#login_user').val('');
1172                jQuery('#login_pwd').val('');
1173            }
1174        },
1175        error: function (errorThrown) {
1176
1177        }
1178    });
1179}
1180////////////////////////////////////////////////////////////////////////////////////////////
1181/// on ready-jslint checked
1182////////////////////////////////////////////////////////////////////////////////////////////
1183function wpestate_login_topbar() {
1184    "use strict";
1185    var login_user, login_pwd, ispop, ajaxurl, security;
1186
1187    login_user          =  jQuery('#login_user_topbar').val();
1188    login_pwd           =  jQuery('#login_pwd_topbar').val();
1189    security            =  jQuery('#security-login-topbar').val();
1190    ajaxurl             =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
1191    var nonce               =  jQuery('#wpestate_ajax_log_reg').val();
1192    jQuery('#login_message_area_topbar').empty().append('<div class="login-alert">' + ajaxcalls_vars.login_loading + '</div>');
1193    jQuery.ajax({
1194        type: 'POST',
1195        dataType: 'json',
1196        url: ajaxurl,
1197        data: {
1198            'action'            :   'wpestate_ajax_loginx_form_topbar',
1199            'login_user'        :   login_user,
1200            'login_pwd'         :   login_pwd,
1201            'security'          :   nonce
1202        },
1203
1204        success: function (data) {
1205            jQuery('#login_message_area_topbar').empty().append('<div class="login-alert">' + data.message + '<div>');
1206            if (data.loggedin === true) {
1207                if(jQuery('body').hasClass('single-estate_property') ){
1208                    location.reload();
1209                }else{
1210                    document.location.href = ajaxcalls_vars.login_redirect;
1211                }
1212            } else {
1213                jQuery('#login_user').val('');
1214                jQuery('#login_pwd').val('');
1215            }
1216        },
1217        error: function (errorThrown) {
1218        }
1219    });
1220}
1221
1222
1223
1224////////////////////////////////////////////////////////////////////////////////
1225// enable actions modal -jslint checked
1226////////////////////////////////////////////////////////////////////////////////
1227function wpestate_enable_actions_modal() {
1228    "use strict";
1229
1230
1231    jQuery('#loginmodal').on('hidden.bs.modal', function (e) {
1232        if( jQuery('body').hasClass('page-template-user_dashboard_add_step1')  ){
1233            window.location.href = ajaxcalls_vars.home;
1234        }
1235    });
1236    
1237    jQuery('#loginmodal').on('shown.bs.modal', function () {
1238        if( jQuery('#ajax_register_div').css('display')==='flex'){
1239              jQuery('#user_login_register').focus();
1240        }else{
1241              jQuery('#login_user').focus();
1242        }
1243      
1244    });
1245
1246    jQuery('#closeadvancedlogin').on('click',function () {
1247        jQuery('#ajax_login_container').remove();
1248        jQuery('#cover').remove();
1249    });
1250
1251    jQuery('#reveal_register').on('click',function () {
1252        jQuery('#ajax_login_div').fadeOut(400, function () {
1253            jQuery('#ajax_login_div').removeClass('show');
1254            jQuery('#ajax_register_div').removeClass('hidden');
1255            jQuery('#ajax_register_div').fadeIn();
1256               jQuery('#user_login_register').focus();
1257        });
1258    });
1259
1260    jQuery('#reveal_login').on('click',function () {
1261        jQuery('#ajax_register_div').fadeOut(400, function () {
1262            jQuery('#ajax_register_div').removeClass('show');
1263            jQuery('#ajax_login_div').removeClass('hidden');
1264            jQuery('#ajax_login_div').fadeIn();
1265            jQuery('#login_user').focus();
1266        });
1267    });
1268
1269    jQuery('#forgot_password_mod').on('click',function (event) {
1270        event.preventDefault();
1271        jQuery("#ajax_login_div").removeClass('show').hide();
1272        jQuery("#forgot-pass-div_mod").show();
1273        jQuery('#forgot_email_mod').focus();
1274        
1275    });
1276
1277
1278
1279    jQuery('#return_login_mod').on('click',function (event) {
1280        event.preventDefault();
1281        jQuery("#forgot-pass-div_mod").hide();
1282        jQuery("#ajax_login_div").show();
1283         jQuery('#login_user').focus();
1284    });
1285
1286  
1287        
1288       
1289}
1290
1291////////////////////////////////////////////////////////////////////////////////
1292// register function -jslint checked
1293////////////////////////////////////////////////////////////////////////////////
1294function wpestate_register() {
1295    "use strict";
1296
1297    var user_pass,user_pass_retype,capthca,user_login_register, user_email_register, nonce, ajaxurl,propid, user_type,user_phone;
1298    user_login_register =   jQuery('#user_login_register').val();
1299    user_email_register =   jQuery('#user_email_register').val();
1300    nonce               =   jQuery('#security-register').val();
1301    ajaxurl             =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1302    propid              =   jQuery('#wp-login-but').attr('data-mixval');
1303    user_type           =   jQuery("input[name=acc_type]:checked").val();
1304    user_pass           =   jQuery('#user_password').val();
1305    user_pass_retype    =   jQuery('#user_password_retype').val();
1306    user_phone          =   jQuery('#user_phone_register').val();
1307
1308    capthca='';
1309    if(control_vars.usecaptcha==='yes'){
1310       capthca= grecaptcha.getResponse(
1311           widgetId1
1312       );
1313    }
1314
1315
1316    if ( !jQuery('#user_terms_register_sh').is(":checked") ) {
1317        jQuery('#register_message_area').empty().append('<div class="alert_err login-alert">' + control_vars.terms_cond + '</div>');
1318        grecaptcha.reset();
1319        return;
1320    }
1321
1322 
1323
1324
1325    var nonce               =  jQuery('#wpestate_ajax_log_reg').val();
1326
1327    jQuery.ajax({
1328        type: 'POST',
1329        url: ajaxurl,
1330        dataType: 'json',
1331        data: {
1332            'action'                    :   'wpestate_ajax_register_form',
1333            'user_login_register'       :   user_login_register,
1334            'user_email_register'       :   user_email_register,
1335            'security-register'         :   nonce,
1336            'propid'                    :   propid,
1337            'user_type'                 :   user_type,
1338            'capthca'                   :   capthca,
1339            'user_pass'                 :   user_pass,
1340            'user_pass_retype'          :   user_pass_retype,
1341            'user_phone'                :   user_phone,
1342            'security'                  :   nonce,
1343        },
1344        success: function (data) {
1345
1346            // This outputs the result of the ajax request
1347            if (data.register === true) {
1348                jQuery('#register_message_area').empty().append('<div class="login-alert">' + data.message + '</div>');
1349                setTimeout(function(){ jQuery('#reveal_login').trigger('click') }, 1500);
1350            }else{
1351                jQuery('#register_message_area').empty().append('<div class="alert_err login-alert">' + data.message + '</div>');
1352                grecaptcha.reset();
1353            }
1354            jQuery('#user_login_register').val('');
1355            jQuery('#user_email_register').val('');
1356        },
1357        error: function (errorThrown) {
1358
1359        }
1360    });
1361}
1362
1363////////////////////////////////////////////////////////////////////////////////
1364// register function -jslint checked
1365////////////////////////////////////////////////////////////////////////////////
1366function wpestate_register_sh() {
1367    "use strict";
1368    var capthca,user_pass,user_pass_retype,user_login_register, user_email_register, nonce, ajaxurl,propid, user_type,user_phone;
1369    user_login_register =   jQuery('#user_login_register_sh').val();
1370    user_email_register =   jQuery('#user_email_register_sh').val();
1371
1372    ajaxurl             =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1373    propid              =   jQuery('#wp-login-but').attr('data-mixval');
1374    user_type           =   jQuery("input[name=acc_type_sh]:checked").val();
1375    user_pass           =   jQuery('#user_password_sh').val();
1376    user_pass_retype    =   jQuery('#user_password_retype_sh').val();
1377    user_phone          =   jQuery('#user_phone_register_sh').val();
1378
1379    if ( !jQuery('#user_terms_register_sh_sh').is(":checked") ) {
1380        jQuery('#register_message_area_sh').empty().append('<div class="alert_err login-alert">' + control_vars.terms_cond + '</div>');
1381        return;
1382    }
1383
1384
1385    capthca='';
1386    if(control_vars.usecaptcha==='yes'){
1387        capthca= grecaptcha.getResponse(
1388            widgetId4
1389        );
1390    }
1391    var nonce               =  jQuery('#wpestate_ajax_log_reg').val();
1392    jQuery.ajax({
1393        type: 'POST',
1394        url: ajaxurl,
1395        dataType: 'json',
1396        data: {
1397            'action'                    :   'wpestate_ajax_register_form',
1398            'user_login_register'       :   user_login_register,
1399            'user_email_register'       :   user_email_register,
1400            'security-register'         :   nonce,
1401            'propid'                    :   propid,
1402            'user_type'                 :   user_type,
1403            'capthca'                   :   capthca,
1404            'user_pass'                 :   user_pass,
1405            'user_pass_retype'          :   user_pass_retype,
1406            'user_phone'                :   user_phone,
1407            'security'                  :   nonce,
1408        },
1409        success: function (data) {
1410            // This outputs the result of the ajax request
1411            if (data.register === true) {
1412                jQuery('#register_message_area_sh').empty().append('<div class="login-alert">' + data.message + '</div>');
1413            }else{
1414                jQuery('#register_message_area_sh').empty().append('<div class="alert_err login-alert">' + data.message + '</div>');
1415            }
1416            jQuery('#user_login_register_sh').val('');
1417            jQuery('#user_email_register_sh').val('');
1418        },
1419        error: function (errorThrown) {
1420
1421        }
1422    });
1423}
1424
1425
1426////////////////////////////////////////////////////////////////////////////////
1427// login function -jslint checked
1428////////////////////////////////////////////////////////////////////////////////
1429function wpestate_login() {
1430    "use strict";
1431    var login_user, login_pwd, security, ispop, ajaxurl,propid;
1432    login_user          =  jQuery('#login_user').val();
1433    login_pwd           =  jQuery('#login_pwd').val();
1434    ispop               =  jQuery('#loginpop').val();
1435    ajaxurl             =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
1436    propid              =  jQuery('#wp-login-but').attr('data-mixval');
1437    propid              =  parseInt(propid,10);
1438
1439    jQuery('#login_message_area').empty().removeClass('alert_err').append('<div class="login-alert">' + ajaxcalls_vars.login_loading + '</div>');
1440    var nonce               =  jQuery('#wpestate_ajax_log_reg').val();
1441    jQuery.ajax({
1442        type: 'POST',
1443        dataType: 'json',
1444        url: ajaxurl,
1445        data: {
1446            'action'            :   'wpestate_ajax_loginx_form',
1447            'login_user'        :   login_user,
1448            'login_pwd'         :   login_pwd,
1449            'ispop'             :   ispop,
1450            'propid'            :   propid,
1451            'security'          :   nonce,
1452        },
1453        success: function (data) {
1454
1455
1456
1457            if (data.loggedin === true) {
1458                jQuery('#login_message_area').empty().append('<div class="login-alert">' + data.message + '<div>');
1459
1460
1461
1462
1463                if (parseInt(data.ispop, 10) === 1) {
1464
1465                    ajaxcalls_vars.userid = data.newuser;
1466                    jQuery('#loginmodal').modal('hide');
1467
1468                    if(jQuery('body').hasClass('single-estate_property') ){
1469                        location.reload();
1470                    }else{
1471                        if(ajaxcalls_vars.redirect_users==='yes'){
1472                            location.reload();
1473                        }else{
1474                            if( ajaxcalls_vars.redirect_custom_link===''){
1475                                document.location.href = ajaxcalls_vars.login_redirect;
1476                            }else{
1477                                document.location.href =ajaxcalls_vars.redirect_custom_link;
1478                            }
1479                        }
1480                    }
1481
1482                } else {
1483                    if(data.newlink!==''){
1484                        if(jQuery('body').hasClass('page-template-user_dashboard_add_step1') ){
1485                            document.location.href = data.newlink;
1486                        }else if(jQuery('body').hasClass('single-estate_property') ){
1487                            location.reload();
1488                        }else{
1489                            if(ajaxcalls_vars.redirect_users==='yes'){
1490                                location.reload();
1491                            }else{
1492                                if( ajaxcalls_vars.redirect_custom_link===''){
1493                                    document.location.href = data.newlink;
1494                                }else{
1495                                    document.location.href =ajaxcalls_vars.redirect_custom_link;
1496                                }
1497                            }
1498
1499                        }
1500                    }else{
1501
1502                        if(jQuery('body').hasClass('single-estate_property') ){
1503                            location.reload();
1504                        }else{
1505                            if(ajaxcalls_vars.redirect_users==='yes'){
1506                                location.reload();
1507                            }else{
1508                                if( ajaxcalls_vars.redirect_custom_link===''){
1509                                    document.location.href = ajaxcalls_vars.login_redirect;
1510                                }else{
1511                                    document.location.href =ajaxcalls_vars.redirect_custom_link;
1512                                }
1513                            }
1514                        }
1515                    }
1516
1517                }
1518                jQuery('#user_not_logged_in').hide();
1519                jQuery('#user_logged_in').show();
1520
1521
1522
1523            } else {
1524                jQuery('#login_message_area').empty().addClass('alert_err').append('<div class="login-alert">
1524' + data.message + '<div>');
1525                jQuery('#login_user').val('');
1526                jQuery('#login_pwd').val('');
1527            }
1528        },
1529        error: function (errorThrown) {
1530
1531        }
1532    });
1533}
1534function wpestate_login_sh() {
1535    "use strict";
1536    var login_user, login_pwd, security, ispop, ajaxurl,propid;
1537    login_user          =  jQuery('#login_user_sh').val();
1538    login_pwd           =  jQuery('#login_pwd_sh').val();
1539    ispop               =  jQuery('#loginpop').val();
1540    ajaxurl             =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
1541    propid              =  jQuery('#wp-login-but').attr('data-mixval');
1542    propid              =  parseInt(propid,10);
1543
1544    jQuery('#login_message_area').empty().removeClass('alert_err').append('<div class="login-alert">' + ajaxcalls_vars.login_loading + '</div>');
1545    var nonce               =  jQuery('#wpestate_ajax_log_reg').val();
1546    jQuery.ajax({
1547        type: 'POST',
1548        dataType: 'json',
1549        url: ajaxurl,
1550        data: {
1551            'action'            :   'wpestate_ajax_loginx_form',
1552            'login_user'        :   login_user,
1553            'login_pwd'         :   login_pwd,
1554            'ispop'             :   ispop,
1555            'propid'            :   propid,
1556            'security'          :   nonce
1557        },
1558        success: function (data) {
1559
1560
1561
1562            if (data.loggedin === true) {
1563                jQuery('#login_message_area_sh').empty().append('<div class="login-alert">' + data.message + '<div>');
1564                if (parseInt(data.ispop, 10) === 1) {
1565                    ajaxcalls_vars.userid = data.newuser;
1566                    jQuery('#loginmodal').modal('hide');
1567                   // wprentals_update_menu_bar(data.newuser);
1568
1569                    if(jQuery('body').hasClass('single-estate_property') ){
1570                        location.reload();
1571                    }else{
1572                       
1573                        if( ajaxcalls_vars.redirect_custom_link===''){
1574                            document.location.href = ajaxcalls_vars.login_redirect;
1575                        }else{
1576                            document.location.href =ajaxcalls_vars.redirect_custom_link;
1577                        }
1578
1579                    }
1580                } else {
1581                    if(data.newlink!==''){
1582
1583                        if(jQuery('body').hasClass('single-estate_property') ){
1584                            location.reload();
1585                        }else{
1586                            document.location.href = data.newlink;
1587                        }
1588
1589                    }else{
1590                        if(jQuery('body').hasClass('single-estate_property') ){
1591                           location.reload();
1592                        }else{
1593                            if( ajaxcalls_vars.redirect_custom_link===''){
1594                                document.location.href = ajaxcalls_vars.login_redirect;
1595                            }else{
1596                                document.location.href =ajaxcalls_vars.redirect_custom_link;
1597                            }
1598                        }
1599                    }
1600
1601                }
1602                jQuery('#user_not_logged_in').hide();
1603                jQuery('#user_logged_in').show();
1604            } else {
1605                jQuery('#login_message_area_sh').empty().addClass('alert_err').append('<div class="login-alert">' + data.message + '<div>');
1606                jQuery('#login_user_sh').val('');
1607                jQuery('#login_pwd_sh').val('');
1608            }
1609        },
1610        error: function (errorThrown) {
1611
1612        }
1613    });
1614}
1615
1616
1617
1618
1619////////////////////////////////////////////////////////////////////////////////
1620// update bar after login -jslint checked
1621////////////////////////////////////////////////////////////////////////////////
1622function wprentals_update_menu_bar(newuser) {
1623    "use strict";
1624    var usericon, ajaxurl;
1625    ajaxurl =   control_vars.admin_url + 'admin-ajax.php';
1626    var nonce = jQuery('#wprentals_ajax_filtering').val();
1627    jQuery.ajax({
1628        type: 'POST',
1629        dataType: 'json',
1630        url: ajaxurl,
1631        data: {
1632            'action'            :   "wpestate_update_menu_bar",
1633            'newuser'           :    newuser
1634        },
1635        success: function (data) {
1636            jQuery('#user_menu_u').addClass('user_loged');
1637            jQuery('#user_menu_u').empty().append(data.premenu);
1638            jQuery('#user_menu_u').after(data.menu);
1639        },
1640        error: function (errorThrown) {
1641        }
1642    });//end ajax
1643}
1644
1645////////////////////////////////////////////////////////////////////////////////////////////
1646/// on ready -jslint checked
1647////////////////////////////////////////////////////////////////////////////////////////////
1648jQuery(document).ready(function ($) {
1649    "use strict";
1650
1651    $('.wpestate_social_login').on('click',function(){
1652       var ajaxurl         =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1653       var social_type     = $(this).attr('data-social');
1654       var nonce           = $(this).parent().find('.wpestate_social_login_nonce').val();
1655        $.ajax({
1656            type: 'POST',
1657            url: ajaxurl,
1658            data: {
1659                'action'       :   'wpestate_social_login_generate_link',
1660                'social_type'  :    social_type,
1661                'nonce'        :    nonce
1662
1663            },
1664            success: function (data) {
1665               window.location.href = data;
1666            },
1667            error: function (errorThrown) {
1668            }
1669        });
1670
1671    });
1672
1673
1674
1675
1676    $('.disable_listing').on('click',function () {
1677        var prop_id = $(this).attr('data-postid');
1678        var ajaxurl         =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1679        var nonce = jQuery('#wprentals_property_actions').val();
1680
1681        $.ajax({
1682            type: 'POST',
1683            url: ajaxurl,
1684            data: {
1685                'action'       :   'wpestate_disable_listing',
1686                'prop_id'      :   prop_id,
1687                'security'     :    nonce
1688
1689            },
1690            success: function (data) {
1691                location.reload();
1692            },
1693            error: function (errorThrown) {
1694            }
1695        });
1696    });
1697
1698
1699    ///////////////////////////////////////////////////////////////////////////////////////////
1700    //// stripe cancel
1701    ///////////////////////////////////////////////////////////////////////////////////////////
1702    $('#stripe_cancel').on('click',function(){
1703        var stripe_user_id, ajaxurl;
1704        stripe_user_id    =   $(this).attr('data-stripeid');
1705        ajaxurl         =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1706        $('#stripe_cancel').text(ajaxcalls_vars.saving);
1707
1708         var nonce = jQuery('#wprentals_stripe_cancel').val();
1709
1710        $.ajax({
1711            type: 'POST',
1712            url: ajaxurl,
1713            data: {
1714                'action'                  :   'wpestate_cancel_stripe',
1715                'stripe_customer_id'      :   stripe_user_id,
1716                'security'                :   nonce
1717
1718            },
1719            success: function (data) {
1720                $('#stripe_cancel').text(ajaxcalls_vars.stripecancel);
1721            },
1722            error: function (errorThrown) {
1723            }
1724        });
1725    });
1726
1727    ////////////////////////////////////////////////////////////////////////////////////////////
1728    /// resend for approval
1729    ///////////////////////////////////////////////////////////////////////////////////////////
1730    $('.resend_pending').on('click',function () {
1731        var prop_id = $(this).attr('data-listingid');
1732        wpestate_resend_for_approval(prop_id, $(this));
1733    });
1734
1735    ///////////////////////////////////////////////////////////////////////////////////////////
1736    ////////  set featured inside membership
1737    ///////////////////////////////////////////////////////////////////////////////////////////
1738    $('.make_featured').on('click',function () {
1739        var prop_id = $(this).attr('data-postid');
1740        wpestate_make_prop_featured(prop_id, $(this));
1741        $(this).unbind( "click" );
1742    });
1743
1744
1745    jQuery('#wpestate_stripe_booking_recurring').on('click',function(){
1746
1747        var modalid=jQuery(this).attr('data-modalid');
1748        jQuery('#'+modalid).show();
1749        jQuery('#'+modalid+' .wpestate_stripe_form_1').show();
1750
1751        wpestate_start_stripe(1,modalid);
1752    });
1753
1754
1755    ///////////////////////////////////////////////////////////////////////////////////////////
1756    ////////  pack upgrade via paypal
1757    ///////////////////////////////////////////////////////////////////////////////////////////
1758    $('#pick_pack').on('click',function () {
1759         $(this).text(ajaxcalls_vars.processing);
1760        if ($('#pack_recuring').is(':checked')) {
1761            wpestate_recuring_pay_pack_via_paypal();
1762        } else {
1763            wpestate_pay_pack_via_paypal();
1764        }
1765    });
1766
1767    ///////////////////////////////////////////////////////////////////////////////////////////
1768    //////// listing pay via paypal
1769    ///////////////////////////////////////////////////////////////////////////////////////////
1770    $('.listing_submit_normal').on('click',function () {
1771        var prop_id, featured_checker, is_featured, is_upgrade;
1772        prop_id = $(this).attr('data-listingid');
1773        featured_checker = $(this).parent().find('input');
1774        is_featured = 0;
1775        is_upgrade = 0;
1776
1777        if (featured_checker.prop('checked')) {
1778            is_featured = 1;
1779        } else {
1780            is_featured = 0;
1781        }
1782
1783        wpestate_listing_pay(prop_id, $(this), is_featured, is_upgrade);
1784    });
1785
1786
1787    jQuery('.woo_pay_submit').on('click',function () {
1788        var pay_paypal, prop_id, book_id, invoice_id, is_featured, is_upgrade,ajaxurl,depozit,is_submit;
1789        prop_id     =   jQuery(this).attr('data-propid');
1790        depozit     =   jQuery(this).attr('data-deposit');
1791        is_featured =   jQuery(this).attr('data-is_featured');
1792        var pack_id      =  jQuery('#pack_select').val();
1793        is_upgrade  =   0;
1794        is_submit   =   1;
1795
1796        if (jQuery('.pack-wrapper').length > 0) {
1797            is_submit = 0;
1798        }
1799  
1800
1801        ajaxurl     =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1802        jQuery.ajax({
1803                type: 'POST',
1804                url: ajaxurl,
1805                data: {
1806                    'action'        :   'wpestate_woo_pay',
1807                    'propid'        :   prop_id,
1808                    'depozit'       :   depozit,
1809                    'is_submit'     :   is_submit,
1810                    'pack_id'       : pack_id,
1811                    'is_featured'   :   is_featured
1812                },
1813                success: function (data) {
1814
1815                    if(data!==false){
1816                        window.location.href= dashboard_vars.checkout_url;
1817                    }
1818                },
1819                error: function (errorThrown) {}
1820        });//end ajax
1821    });
1822
1823
1824
1825
1826    $('.listing_upgrade').on('click',function () {
1827        var is_upgrade, is_featured, prop_id;
1828        is_upgrade = 1;
1829        is_featured = 0;
1830        prop_id = $(this).attr('data-listingid');
1831        wpestate_listing_pay(prop_id, $(this), is_featured, is_upgrade);
1832    });
1833
1834
1835
1836     ///////////////////////////////////////////////////////////////////////////////////////////
1837    /////// Contact page  + ajax call on contact
1838    ///////////////////////////////////////////////////////////////////////////////////////////
1839    $('#agent_submit_contact').on('click',function () {
1840        var contact_name, contact_email, contact_website, contact_coment, agent_email, property_id, nonce, ajaxurl;
1841        contact_name    =   $('#contact_name').val();
1842        contact_email   =   $('#contact_email').val();
1843        contact_website =   $('#contact_website').val();
1844        contact_coment  =   $('#agent_comment').val();
1845
1846
1847        nonce           =   $('#agent_property_ajax_nonce').val();
1848        ajaxurl         =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1849
1850        $('#alert-agent-contact').empty().removeClass('alert_err').append(ajaxcalls_vars.sending);
1851
1852        if(ajaxcalls_vars.use_gdpr==='yes'){
1853            if ( !$('#wpestate_agree_gdpr').is(':checked') ){
1854                $("#alert-agent-contact").empty().append(ajaxcalls_vars.gdpr_terms);
1855                return;
1856            }
1857        }
1858
1859        $.ajax({
1860            type: 'POST',
1861            dataType: 'json',
1862            url: ajaxurl,
1863            data: {
1864                'action'    :   'wpestate_ajax_agent_contact_page',
1865                'name'      :   contact_name,
1866                'email'     :   contact_email,
1867                'website'   :   contact_website,
1868                'comment'   :   contact_coment,
1869
1870                'nonce'     :   nonce
1871            },
1872            success: function (data) {
1873               // This outputs the result of the ajax request
1874                if (data.sent) {
1875                    $('#contact_name').val('');
1876                    $('#contact_email').val('');
1877                    $('#contact_website').val('');
1878                    $('#agent_comment').val('');
1879                    $('#alert-agent-contact').empty().append(data.response);
1880                }else{
1881                    $('#alert-agent-contact').empty().addClass('alert_err').append(data.response);
1882                }
1883
1884            },
1885            error: function (errorThrown) {
1886            }
1887        });
1888    });
1889
1890
1891    ///////////////////////////////////////////////////////////////////////////////////////////
1892    ////////  property listing listing
1893    ////////////////////////////////////////////////////////////////////////////////////////////
1894
1895    $('.listing_filters_head li').on('click',function () {
1896        var pick, value, parent;
1897        pick = $(this).text();
1898        value = $(this).attr('data-value');
1899        parent = $(this).parent().parent();
1900        parent.find('.filter_menu_trigger').text(pick).append('<span class="caret caret_filter"></span>').attr('data-value', value);
1901        wpestate_start_filtering(1);
1902    });
1903
1904    ///////////////////////////////////////////////////////////////////////////////////////////
1905    ////////  property listing listing
1906    ////////////////////////////////////////////////////////////////////////////////////////////
1907
1908    $('.booking_form_request li').on('click',function () {
1909        var pick, value, parent;
1910        pick = $(this).text();
1911        value = $(this).attr('data-value');
1912        parent = $(this).parent().parent();
1913        parent.find('.filter_menu_trigger').text(pick).append('<span class="caret caret_filter"></span>').attr('data-value', value);
1914
1915    });
1916
1917
1918    ///////////////////////////////////////////////////////////////////////////////////////////
1919    ////////  Ajax add to favorites on listing
1920    ////////////////////////////////////////////////////////////////////////////////////////////
1921    $('.icon-fav').on('click',function (event) {
1922        event.stopPropagation();
1923        var icon = $(this);
1924        wpestate_add_remove_favorite(icon);
1925    });
1926
1927    // remove from fav listing on user profile
1928    $('.icon-fav-on-remove').on('click',function () {
1929      if(jQuery('.favorite_dashboard_property_list').length===0 ){
1930        $(this).parent().parent().parent().parent().remove();
1931      }
1932
1933    });
1934
1935    ///////////////////////////////////////////////////////////////////////////////////////////
1936    ////////  Ajax add to favorites on propr
1937    ////////////////////////////////////////////////////////////////////////////////////////////
1938    $('#add_favorites').on('click',function () {
1939        var post_id, securitypass, ajaxurl;
1940
1941        post_id         =  $('#add_favorites').attr('data-postid');
1942        securitypass    =  $('#security-pass').val();
1943        ajaxurl         =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
1944
1945        if (parseInt(ajaxcalls_vars.userid, 10)  === 0) {
1946            wpestate_show_login_form(1,1,0);
1947        } else {
1948            $('#add_favorites').text(ajaxcalls_vars.saving);
1949             var nonce = jQuery('#wprentals_ajax_filtering').val();
1950            $.ajax({
1951                type: 'POST',
1952                url: ajaxurl,
1953                dataType: 'json',
1954                data: {
1955                    'action'            :   'wpestate_ajax_add_fav',
1956                    'post_id'           :    post_id,
1957                    'security'          :    nonce,
1958                },
1959                success: function (data) {
1960                    if (data.added) {
1961                        $('#add_favorites').html(ajaxcalls_vars.favorite).removeClass('isnotfavorite').addClass('isfavorite');
1962                    } else {
1963                        $('#add_favorites').html(ajaxcalls_vars.add_favorite).removeClass('isfavorite').addClass('isnotfavorite');
1964                    }
1965                },
1966                error: function (errorThrown) {
1967                }
1968            }); //end ajax
1969        }// end check login
1970    });
1971
1972
1973    ////////////////////////////////////////////////////////////////////////////////
1974    // register calls and functions
1975    ////////////////////////////////////////////////////////////////////////////////
1976    $('#wp-submit-register').on('click',function () {
1977        wpestate_register();
1978    });
1979
1980    $('#user_email_register, #user_login_register').keydown(function (e) {
1981        if (e.keyCode === 13 ) {
1982            e.preventDefault();
1983            wpestate_register();
1984        }
1985    });
1986
1987
1988    ////////////////////////////////////////////////////////////////////////////////
1989    // register calls shortcode
1990    ////////////////////////////////////////////////////////////////////////////////
1991    $('#wp-submit-register_sh').on('click',function () {
1992        wpestate_register_sh();
1993    });
1994
1995    $('#user_email_register_sh, #user_login_register_sh').keydown(function (e) {
1996        if (e.keyCode === 13 ) {
1997            e.preventDefault();
1998            wpestate_register_sh();
1999        }
2000    });
2001
2002
2003
2004
2005
2006  ///////////////////////////////////////////////////////////////////////////////////////////
2007    ////////  WIDGET Register mobile
2008    ////////////////////////////////////////////////////////////////////////////////////////////
2009    $('#wp-submit-register_wd_mobile').on('click',function () {
2010        wpestate_register_wd_mobile();
2011    });
2012
2013
2014
2015    $('#user_email_register_wd_mobile, #user_login_register_wd_mobile').keydown(function (e) {
2016        if (e.keyCode === 13) {
2017            e.preventDefault();
2018            wpestate_register_wd_mobile();
2019        }
2020    });
2021
2022    ///////////////////////////////////////////////////////////////////////////////////////////
2023    ////////  WIDGET Register ajax
2024    ////////////////////////////////////////////////////////////////////////////////////////////
2025    $('#wp-submit-register_wd').on('click',function () {
2026        wpestate_register_wd();
2027    });
2028
2029
2030
2031    $('#user_email_register_wd, #user_login_register_wd').keydown(function (e) {
2032        if (e.keyCode === 13) {
2033            e.preventDefault();
2034            wpestate_register_wd();
2035        }
2036    });
2037
2038    ///////////////////////////////////////////////////////////////////////////////////////////
2039    ////////  login/forgot password  actions
2040    ////////////////////////////////////////////////////////////////////////////////////////////
2041    $('#forgot_pass').on('click',function (event) {
2042        event.preventDefault();
2043        $("#login-div").hide();
2044        $("#forgot-pass-div").show();
2045    });
2046
2047    $('#return_login').on('click',function (event) {
2048        event.preventDefault();
2049        $("#forgot-pass-div").hide();
2050        $("#login-div").show();
2051    });
2052
2053
2054
2055
2056    ///////////////////////////////////////////////////////////////////////////////////////////
2057    ////////  forgot pass
2058    ////////////////////////////////////////////////////////////////////////////////////////////
2059    $('#wp-forgot-but_mod').on('click',function () {
2060        wpestate_forgot(2);
2061    });
2062
2063
2064    $('#wp-forgot-but').on('click',function () {
2065        wpestate_forgot(3);
2066    });
2067
2068    $('#forgot_email').keydown(function (e) {
2069        if (e.keyCode === 13) {
2070            e.preventDefault();
2071            wpestate_forgot(2);
2072        }
2073    });
2074
2075
2076    ///////////////////////////////////////////////////////////////////////////////////////////
2077    //////// TOPBAR  login/forgot password  actions
2078    ////////////////////////////////////////////////////////////////////////////////////////////
2079    $('#widget_register_topbar').on('click',function (event) {
2080        event.preventDefault();
2081        $('#login-div_topbar').hide();
2082        $('#register-div-topbar').show();
2083        $('#login-div-title-topbar').hide();
2084        $('#register-div-title-topbar').show();
2085    });
2086
2087    $('#widget_login_topbar').on('click',function (event) {
2088        event.preventDefault();
2089        $('#login-div_topbar').show();
2090        $('#register-div-topbar').hide();
2091        $('#login-div-title-topbar').show();
2092        $('#register-div-title-topbar').hide();
2093    });
2094
2095
2096    ///////////////////////////////////////////////////////////////////////////////////////////
2097    //////// WIDGET  login/forgot password  actions
2098    ////////////////////////////////////////////////////////////////////////////////////////////
2099    $('#widget_register_sw').on('click',function (event) {
2100        event.preventDefault();
2101        $('.loginwd_sidebar #login-div').hide();
2102        $('.loginwd_sidebar #register-div').show();
2103        $('.loginwd_sidebar #login-div-title').hide();
2104        $('.loginwd_sidebar #register-div-title').show();
2105    });
2106
2107    $('#widget_login_sw').on('click',function (event) {
2108        event.preventDefault();
2109        $('.loginwd_sidebar #register-div').hide();
2110        $('.loginwd_sidebar #login-div').show();
2111        $('.loginwd_sidebar #register-div-title').hide();
2112        $('.loginwd_sidebar #login-div-title').show();
2113    });
2114
2115    $('#widget_register_mobile').on('click',function (event) {
2116        event.preventDefault();
2117        $('.login_sidebar_mobile #login-div-mobile').hide();
2118        $('.login_sidebar_mobile #register-div-mobile').show();
2119        $('.login_sidebar_mobile #login-div-title-mobile').hide();
2120        $('.login_sidebar_mobile #register-div-title-mobile').show();
2121        jQuery('#user_login_register_wd_mobile').focus();
2122    });
2123
2124
2125    $('#widget_login_sw_mobile').on('click',function (event) {
2126        event.preventDefault();
2127        $('.login_sidebar_mobile #register-div-mobile').hide();
2128        $('.login_sidebar_mobile #login-div-mobile').show();
2129        $('.login_sidebar_mobile #register-div-title-mobile').hide();
2130        $('.login_sidebar_mobile #login-div-title-mobile').show();
2131        jQuery('#login_user_wd_mobile').focus();
2132    });
2133
2134
2135    ///////////////////////////////////////////////////////////////////////////////////////////
2136    ////////  login  ajax
2137    ////////////////////////////////////////////////////////////////////////////////////////////
2138    $('#wp-login-but').on('click',function () {
2139        wpestate_login();
2140    });
2141
2142    $('#login_pwd, #login_user').keydown(function (e) {
2143        if (e.keyCode === 13) {
2144            e.preventDefault();
2145            wpestate_login();
2146        }
2147    });
2148
2149
2150     ///////////////////////////////////////////////////////////////////////////////////////////
2151    ////////  login  shortcode
2152    ////////////////////////////////////////////////////////////////////////////////////////////
2153    $('#wp-login-but_sh').on('click',function () {
2154        wpestate_login_sh();
2155    });
2156
2157    $('#login_pwd_sh, #login_user_sh').keydown(function (e) {
2158        if (e.keyCode === 13) {
2159            e.preventDefault();
2160            wpestate_login_sh();
2161        }
2162    });
2163
2164
2165
2166    ///////////////////////////////////////////////////////////////////////////////////////////
2167    ////////  Mobile login  ajax
2168    ////////////////////////////////////////////////////////////////////////////////////////////
2169    $('#wp-login-but-wd-mobile').on('click',function () {
2170        wpestate_login_wd_mobile();
2171    });
2172
2173    $('#login_pwd_wd_mobile, #login_user_wd_mobile').keydown(function (e) {
2174        if (e.keyCode === 13) {
2175            e.preventDefault();
2176            wpestate_login_wd_mobile();
2177        }
2178    });
2179
2180
2181    $('#forgot_pass_widget_mobile').on('click',function (e) {
2182        e.preventDefault();
2183        $('#mobile_forgot_wrapper').show();
2184        $('#login-div-title-mobile,#login-div-mobile').hide();
2185        jQuery('#forgot_email_mobile').focus();
2186    });
2187
2188    $('#return_login_shortcode_mobile').on('click',function(e){
2189        e.preventDefault();
2190        $('#login-div-title-mobile,#login-div-mobile').show();
2191        $('#mobile_forgot_wrapper').hide();
2192        jQuery('#login_user_wd_mobile').focus();
2193    });
2194
2195    $('#wp-forgot-but_mobile').on('click',function(e){
2196        e.preventDefault();
2197         wpestate_forgot(4);
2198    });
2199
2200
2201    ///////////////////////////////////////////////////////////////////////////////////////////
2202    ////////  WIDGET login  ajax
2203    ////////////////////////////////////////////////////////////////////////////////////////////
2204
2205    $('#wp-login-but-wd').on('click',function () {
2206        wpestate_login_wd();
2207    });
2208
2209    $('#login_pwd_wd, #login_user_wd').keydown(function (e) {
2210        if (e.keyCode === 13) {
2211            e.preventDefault();
2212            wpestate_login_wd();
2213        }
2214    });
2215
2216
2217    $('#forgot_pass_widget').on('click',function (e) {
2218        e.preventDefault();
2219        $('#forgot-div-title_shortcode,#forgot-pass-div_shortcode').show();
2220        $('#login-div-title,#login-div').hide();
2221    });
2222
2223    $('#return_login_shortcode').on('click',function(e){
2224        e.preventDefault();
2225        $('#login-div-title,#login-div').show();
2226        $('#forgot-div-title_shortcode,#forgot-pass-div_shortcode').hide();
2227    });
2228
2229    $('#wp-forgot-but_shortcode').on('click',function(e){
2230        e.preventDefault();
2231         wpestate_forgot(3);
2232    });
2233
2234    ///////////////////////////////////////////////////////////////////////////////////////////
2235    ////////  TOPBAR  login  ajax
2236    ////////////////////////////////////////////////////////////////////////////////////////////
2237
2238    $('#wp-login-but-topbar').on('click',function () {
2239        wpestate_login_topbar();
2240    });
2241
2242    $('#login_pwd_topbar, #login_user_topbar').keydown(function (e) {
2243        if (e.keyCode === 13) {
2244            e.preventDefault();
2245            wpestate_login_topbar();
2246        }
2247    });
2248
2249
2250    ///////////////////////////////////////////////////////////////////////////////////////////
2251    ////////  Ajax update password
2252    ////////////////////////////////////////////////////////////////////////////////////////////
2253    $('#oldpass, #newpass, #renewpass').keydown(function (e) {
2254        if (e.keyCode === 13) {
2255            e.preventDefault();
2256            wpestate_change_pass_profile();
2257        }
2258    });
2259
2260    $('#change_pass').on('click',function () {
2261        wpestate_change_pass_profile();
2262    });
2263
2264
2265
2266    ///////////////////////////////////////////////////////////////////////////////////////////
2267    ////////  Sms validation
2268    ////////////////////////////////////////////////////////////////////////////////////////////
2269
2270    $('#send_sms_pin').on('click',function(){
2271        var ajaxurl;
2272        ajaxurl         =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
2273        var nonce = jQuery('#wprentals_send_sms_nonce').val();
2274
2275        $.ajax({
2276            type: 'POST',
2277            url: ajaxurl,
2278            data: {
2279                'action'            :   'wpestate_send_valid_sms',
2280                'security'          :   nonce,
2281                },
2282            success: function (data) {
2283
2284                $('#sms_profile_message').empty().append('<div class="login-alert">' + data + '<div>');
2285            },
2286            error: function (errorThrown) {
2287
2288            }
2289        });
2290    });
2291
2292
2293    $('#validate_phone').on('click',function(){
2294        var ajaxurl,validate_phoneno;
2295        ajaxurl             =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
2296        validate_phoneno    = $('#validate_phoneno').val();
2297         var nonce = jQuery('#wprentals_send_sms_nonce').val();
2298        $.ajax({
2299            type: 'POST',
2300            url: ajaxurl,
2301            data: {
2302                'action'            :   'wpestate_validate_mobile',
2303                'validate_phoneno'  :   validate_phoneno,
2304                'security'          :   nonce
2305                },
2306            success: function (data) {
2307                $('#sms_profile_message').empty().append('<div class="login-alert">' + data + '<div>');
2308            },
2309            error: function (errorThrown) {
2310            }
2311        });
2312
2313    });
2314
2315    ///////////////////////////////////////////////////////////////////////////////////////////
2316    ////////  update profile
2317    ////////////////////////////////////////////////////////////////////////////////////////////
2318
2319    $('#update_profile').on('click',function () {
2320        var userwebsite,youtube,instagram,useridimageid,useridurl,payment_info,paypal_payments_to,live_in,i_speak, usermobile, userpinterest, userlinkedin, usertwitter, userfacebook, profile_image_url, profile_image_url_small, firstname, secondname, useremail, userphone, userskype, usertitle, description, ajaxurl, securityprofile, upload_picture, useridurl, useridimageid;
2321        firstname       =  $('#firstname').val();
2322        secondname      =  $('#secondname').val();
2323        useremail       =  $('#useremail').val();
2324        userphone       =  $('#userphone').val();
2325        usermobile      =  $('#usermobile').val();
2326        userskype       =  $('#userskype').val();
2327        userwebsite     =  $('#userwebsite').val();
2328
2329        description     =  $('#about_me').val();
2330        userfacebook    =  $('#userfacebook').val();
2331        usertwitter     =  $('#usertwitter').val();
2332        userlinkedin    =  $('#userlinkedin').val();
2333        userpinterest   =  $('#userpinterest').val();
2334
2335        instagram       =  $('#userinstagram').val();
2336        youtube         =  $('#useryoutube').val();
2337
2338        live_in         =  $('#live_in').val();
2339        i_speak         =  $('#i_speak').val();
2340
2341        paypal_payments_to  =  $('#paypal_payments_to').val();
2342        payment_info        =  $('#payment_info').val();
2343        ajaxurl         =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
2344        securityprofile =  $('#security-profile').val();
2345        upload_picture  =  $('#upload_picture').val();
2346        profile_image_url  = $('#profile-image').attr('data-profileurl');
2347        profile_image_url_small  = $('#profile-image').attr('data-smallprofileurl');
2348
2349        useridurl          = $('#user-id-image').attr('data-useridurl');
2350        useridimageid      = $('#user-id-image').attr('data-useridimageid');
2351
2352        $('#profile_message').empty().append('<div class="login-alert">' + ajaxcalls_vars.saving + '<div>');
2353        var nonce = jQuery('#wprentals_update_profile_nonce').val();
2354
2355
2356        $.ajax({
2357            type: 'POST',
2358            url: ajaxurl,
2359            data: {
2360                'action'            :   'wpestate_ajax_update_profile',
2361                'firstname'         :   firstname,
2362                'secondname'        :   secondname,
2363                'useremail'         :   useremail,
2364                'userphone'         :   userphone,
2365                'usermobile'        :   usermobile,
2366                'userskype'         :   userskype,
2367                'description'       :   description,
2368                'upload_picture'    :   upload_picture,
2369                'security-profile'  :   securityprofile,
2370                'profile_image_url' :   profile_image_url,
2371                'profile_image_url_small':profile_image_url_small,
2372                'user_id_url'       :   useridurl,
2373                'user_id_image_id'  :   useridimageid,
2374                'userfacebook'      :   userfacebook,
2375                'usertwitter'       :   usertwitter,
2376                'userlinkedin'      :   userlinkedin,
2377                'userpinterest'     :   userpinterest,
2378                'live_in'           :   live_in,
2379                'i_speak'           :   i_speak,
2380                'paypal_payments_to':   paypal_payments_to,
2381                'payment_info'      :   payment_info,
2382                'security'          :   nonce,
2383                'instagram'         :   instagram,
2384                'youtube'           :   youtube,
2385                'userwebsite'       :   userwebsite,
2386
2387            },
2388            success: function (data) {
2389
2390                $('#profile_message').empty().append('<div class="login-alert">
2390' + data + '<div>');
2391            },
2392            error: function (errorThrown) {
2393            }
2394        });
2395    });
2396
2397
2398
2399    $('#delete_profile').on('click',function () {
2400        var ajaxurl;
2401        ajaxurl         =  ajaxcalls_vars.admin_url + 'admin-ajax.php';
2402
2403        var result = confirm(ajaxcalls_vars.delete_account);
2404        if (result) {
2405             var nonce = jQuery('#wprentals_update_profile_nonce').val();
2406
2407            $.ajax({
2408                type: 'POST',
2409                url: ajaxurl,
2410                data: {
2411                    'action'       :   'wpestate_delete_profile',
2412                    'security'      :   nonce
2413                },
2414                success: function (data) {
2415                   window.location = '/';
2416                },
2417                error: function (errorThrown) {
2418
2419                }
2420            });
2421        }
2422    });
2423
2424//end delete profile
2425
2426
2427}); // end ready jquery
2428//End ready ********************************************************************

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.