PageSourceSearch

https://www.aeropolis.es/espacios/wp-content/themes/wpresidence/js/google_js/maps_base.js

js aeropolis.es collected 2026-09-25 00:11:59 UTC 32,572 bytes, 1,136 lines download raw bytes

1/*global google, $, Modernizr, InfoBox, window, alert, setTimeout,mapbase_vars*/
2
3wp_estate_kind_of_map           =   parseInt(mapbase_vars.wp_estate_kind_of_map);
4var lealet_map_move_on_hover    =   0;
5var propertyMarker_submit       =   '';
6var leaflet_map_move_flag       =   0;    
7    
8var geolocation_search_used=0;
9
10window.wpestateInitMap = function () {
11
12}
13
14
15
16function wpresidence_map_general_start_map(page_map){
17    "use strict";
18    var zoom_level;
19    if(page_map=='prop'){
20        zoom_level=parseInt(googlecode_property_vars.page_custom_zoom, 10);
21    }else{
22        zoom_level=parseInt(googlecode_regular_vars.page_custom_zoom, 10);
23    }
24    
25    
26    if(jQuery('#wpestate_full_map_control_data').length >0 ){
27        zoom_level=jQuery('#wpestate_full_map_control_data').attr('data-zoom');
28    }
29    
30    
31    if(wp_estate_kind_of_map===1){
32        wpresidence_google_start_map(zoom_level);
33    }else if(wp_estate_kind_of_map===2){
34        wpresidence_leaflet_start_map(zoom_level);
35         
36       
37    } 
38}
39
40
41
42
43
44
45
46function wpresidence_leaflet_start_map(zoom_level){
47    "use strict";
48//   ready
49
50    if (typeof(curent_gview_long)==='undefined' || curent_gview_lat === '' || curent_gview_long === '0') {
51        if( typeof(googlecode_property_vars)!=='undefined' ){
52            curent_gview_lat = googlecode_property_vars.general_latitude;
53        }
54        
55        if( typeof(googlecode_regular_vars)!=='undefined' ){
56            curent_gview_lat = googlecode_regular_vars.general_latitude;
57        }
58    }
59
60    if ( typeof(curent_gview_long)==='undefined' || curent_gview_long === '' || curent_gview_long === '0') {
61        if( typeof(googlecode_property_vars)!=='undefined' ){
62            curent_gview_long = googlecode_property_vars.general_longitude;
63        }
64        if( typeof(googlecode_regular_vars)!=='undefined' ){
65            curent_gview_long = googlecode_regular_vars.general_longitude;
66        }
67    }
68    
69  
70   
71   
72    var mapCenter = L.latLng( curent_gview_lat,curent_gview_long );
73 
74    if (document.getElementById('googleMap')) {
75        map =  L.map( 'googleMap',{
76            center: mapCenter, 
77            zoom: zoom_level,
78            keepBuffer: 10
79            
80        }).on('load', function(e) {
81            jQuery('#gmap-loading').remove();
82        });
83        
84    
85       
86    } else if (document.getElementById('googleMapSlider')) {
87        map =  L.map( 'googleMapSlider',{
88            center: mapCenter, 
89            zoom: zoom_level
90        }).on('load', function(e) {
91            jQuery('#gmap-loading').remove();
92        });
93        
94    }else{
95        return;
96    }
97    
98 wpresidence_leaflet_initialize_map_common(map);
99   
100     
101    
102}
103
104
105
106function wpresidence_leaflet_initialize_map_common(map){
107
108    var tileLayer =  wpresidence_open_stret_tile_details();
109    map.addLayer( tileLayer );
110    
111    map.scrollWheelZoom.disable();
112    if ( Modernizr.mq('only all and (max-width: 768px)') ) {    
113        map.dragging.disable();
114    }
115   // map.touchZoom.disable();
116          
117    map.on('popupopen', function(e) {
118        lealet_map_move_on_hover=1;
119     
120        if( jQuery('#google_map_prop_list_wrapper').length==0 ){
121            var px = map.project(e.popup._latlng); // find the pixel location on the map where the popup anchor is
122            if( mapfunctions_vars.useprice === 'yes' ){
123           //    px.y -= 115; // find the height of the popup container, divide by 2, subtract from the Y axis of marker location
124            }else{
125              //  px.y -= 320/2; // find the height of the popup container, divide by 2, subtract from the Y axis of marker location
126            }
127            map.panTo(map.unproject(px),{animate: true}); // pan to new center
128        }
129        
130        lealet_map_move_on_hover=1;
131    });
132    
133    jQuery('#gmap-loading').remove();
134    map.on('load', function(e) {
135        jQuery('#gmap-loading').remove();
136    });
137    //if (Modernizr.mq('only all and (max-width: 1025px)')) {  }
138    
139
140   if ( Modernizr.mq('only all and (max-width: 768px)') ) {        
141            map.on('dblclick ', function(e) {
142                if (map.dragging.enabled()) {
143                     map.dragging.disable();
144                    //map.touchZoom.disable();
145                }else{
146                    map.dragging.enable();
147                    //map.touchZoom.enable();
148                }
149            });
150        }
151
152       
153  
154    
155    
156    
157    markers_cluster=L.markerClusterGroup({
158
159        iconCreateFunction: function(cluster) {
160		return L.divIcon({ html: '<div class="leaflet_cluster" style="background-image: url('+images['cloud_pin']+')">' + cluster.getChildCount() + '</div>' });
161	},       
162    });
163
164
165}
166
167
168function  wpresidence_leaflet_map_cluster(){
169    map.addLayer(markers_cluster);
170}
171
172function wprentals_map_general_map_pan_move(){
173    if(wp_estate_kind_of_map===1){
174        wprentals_google_map_pan_move();
175    }else if(wp_estate_kind_of_map===2){
176        wprentals_leaflet_map_pan_move();
177    }else if(wp_estate_kind_of_map===3){
178        
179    }   
180    
181 
182}
183
184
185function wpresidence_open_stret_tile_details(){
186      
187    //  tile.openstreetmap.se/hydda/full/{z}/{x}/{y}.png
188    //  tile.openstreetmap.se/hydda/full/{z}/{x}/{y}.png)
189    //  https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png
190    
191    
192    if( mapbase_vars.wp_estate_mapbox_api_key==='' ){
193        var tileLayer = L.tileLayer(  'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
194            attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
195        } );
196
197    }else{
198        var tileLayer = L.tileLayer( 'https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/256/{z}/{x}/{y}?access_token='+mapbase_vars.wp_estate_mapbox_api_key, {
199            attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
200            maxZoom: 18,
201            id: 'mapbox.streets',
202            accessToken: 'your.mapbox.access.token'
203            } 
204        );
205    }
206    return tileLayer;
207}
208
209
210function wpresidence_google_start_map(zoom_level){
211    "use strict";
212    var mapOptions, styles;
213    
214    
215    
216    if(jQuery('#googleMap').hasClass('full_height_map')){
217        var new_height = jQuery( window ).height() - jQuery('.master_header').height();
218        jQuery('#googleMap,#gmap_wrapper').css('height',new_height);
219    }
220    
221    
222    
223    if (typeof(curent_gview_long)==='undefined' || curent_gview_lat === ''  || curent_gview_lat === '0') {
224        if( typeof(googlecode_property_vars)!=='undefined' ){
225            curent_gview_lat = googlecode_property_vars.general_latitude;
226        }
227        
228        if( typeof(googlecode_regular_vars)!=='undefined' ){
229            curent_gview_lat = googlecode_regular_vars.general_latitude;
230        }
231    }
232
233    if ( typeof(curent_gview_long)==='undefined' || curent_gview_long === '' || curent_gview_long === '0') {
234        if( typeof(googlecode_property_vars)!=='undefined' ){
235            curent_gview_long = googlecode_property_vars.general_longitude;
236        }
237        if( typeof(googlecode_regular_vars)!=='undefined' ){
238            curent_gview_long = googlecode_regular_vars.general_longitude;
239        }
240    }
241    
242    if( typeof(googlecode_regular_vars)!=='undefined' ){
243        var map_type =googlecode_regular_vars.type.toLowerCase();
244    }else  if( typeof(googlecode_property_vars)!=='undefined' ){
245        var map_type =googlecode_property_vars.type.toLowerCase();
246    }
247   
248    
249 
250    var with_bound=0;
251    var mapOptions = {
252        flat:false,
253        noClear:false,
254        zoom: parseInt(zoom_level),
255        scrollwheel: false,
256        draggable: true,
257        center: new google.maps.LatLng(curent_gview_lat,curent_gview_long),
258        mapTypeId: map_type,
259        streetViewControl:false,
260        disableDefaultUI: true,
261        gestureHandling: 'cooperative'
262    };
263    
264     
265         
266         
267         
268 
269   
270 
271    if(  document.getElementById('googleMap') ){
272        map = new google.maps.Map(document.getElementById('googleMap'), mapOptions);
273    }else if( document.getElementById('googleMapSlider') ){
274        map = new google.maps.Map(document.getElementById('googleMapSlider'), mapOptions);
275    } else{
276        return;
277    }   
278 
279 
280 
281    google.maps.visualRefresh = true;
282    
283    if(mapfunctions_vars.show_g_search_status==='yes'){
284        wpestate_set_google_search(map);
285    }
286
287    
288    if(jQuery('#wpestate_full_map_control_data').length>0){
289        
290        var styles = ( jQuery('#wpestate_full_map_control_data').attr('data-map_style') );
291        map.setOptions({styles: styles});
292         
293    }
294    var styles ='';
295      
296    if(mapfunctions_vars.map_style !==''){
297        var styles = JSON.parse ( mapfunctions_vars.map_style );
298    }
299    
300    if(jQuery('#wpestate_full_map_control_data').length>0){
301        
302        if(map_style_shortcode !==''){
303            styles = (map_style_shortcode );
304        }
305            
306//        if(mapfunctions_vars.shortcode_map_style !==''){
307//            var styles = JSON.parse ( mapfunctions_vars.shortcode_map_style );
308//        }
309    }
310    
311  
312    if(styles!==''){
313       map.setOptions({styles: styles});
314    }
315    
316  
317  
318    google.maps.event.addListener(map, 'tilesloaded', function() {
319        jQuery('#gmap-loading').remove();
320    });
321
322
323}
324
325
326
327function wpresidence_map_general_set_markers(map, markers,with_bound){
328    "use strict";
329    wpresidence_google_setMarkers2(map, markers,with_bound);
330}
331
332
333
334function wpresidence_google_setMarkers2 (map, locations){
335    "use strict";
336    var map_open;          
337    var myLatLng;
338    var selected_id     =   parseInt( jQuery('#gmap_wrapper').attr('data-post_id') );
339    if( isNaN(selected_id) ){
340        selected_id     =   parseInt( jQuery('#googleMapSlider').attr('data-post_id'),10 );
341    }
342   
343    var open_height     =   parseInt(mapfunctions_vars.open_height,10);
344    var closed_height   =   parseInt(mapfunctions_vars.closed_height,10);
345    var boxText         =   document.createElement("div");
346    width_browser       =   jQuery(window).width();
347    
348    infobox_width   =   700;
349    vertical_pan    =   -215;
350    
351    if (width_browser<900){
352        infobox_width=500;
353    }
354    
355    if (width_browser<600){
356        infobox_width=400;
357    }
358    
359    if (width_browser<400){
360        infobox_width=200;
361    }
362    
363    
364    if(wp_estate_kind_of_map===1){
365        bounds = new google.maps.LatLngBounds();
366    }
367 
368 
369    
370     for (var i = 0; i < locations.length; i++) {
371        var beach                       =   locations[i];
372        var id                          =   beach[10];
373        var lat                         =   beach[1];
374        var lng                         =   beach[2];
375        var title                       =   decodeURIComponent ( beach[0] );
376        var pin                         =   beach[8];
377        var counter                     =   beach[3];
378        var image                       =   decodeURIComponent ( beach[4] );
379        var price                       =   decodeURIComponent ( beach[5] );
380        var single_first_type           =   decodeURIComponent ( beach[6] );          
381        var single_first_action         =   decodeURIComponent ( beach[7] );
382        var link                        =   decodeURIComponent ( beach[9] );
383        var cleanprice                  =   beach[11];
384        var rooms                       =   beach[12];
385        var baths                       =   beach[13];
386        var size                        =   beach[14];
387        var single_first_type_name      =   decodeURIComponent ( beach[
38715] );
388        var single_first_action_name    =   decodeURIComponent ( beach[16] );
389        var pin_price                   =   decodeURIComponent ( beach[17] );
390      
391           
392        
393        // found the property
394        if(selected_id===id){
395            found_id=i;
396        }
397        
398        if(wp_estate_kind_of_map===1){
399            wpestate_createMarker ( pin_price,size, i,id,lat,lng,pin,title,counter,image,price,single_first_type,single_first_action,link,rooms,baths,cleanprice,single_first_type_name, single_first_action_name);
400        }else if(wp_estate_kind_of_map===2){
401
402            wpresidence_createMarker_leaflet ( pin_price,size, i,id,lat,lng,pin,title,counter,image,price,single_first_type,single_first_action,link,rooms,baths,cleanprice,single_first_type_name, single_first_action_name);
403  
404        }
405      
406    }//end for
407    
408
409}
410
411
412jQuery(document).ready(function ($) {
413    "use strict";
414      wpestate_hover_color_on_click();
415   
416    });
417
418
419function wpestate_hover_color_on_click(){
420 
421    jQuery('#googleMap .openstreet_price_marker').on("click",function(){
422        jQuery('.openstreet_price_marker').removeClass('openstreet_price_marker_on_click');
423        jQuery(this).addClass('openstreet_price_marker_on_click');
424    });
425}
426
427
428function wpresidence_map_general_cluster(){
429    "use strict";
430      
431    if(wp_estate_kind_of_map===1){
432        wpestate_map_cluster();
433    }else if(wp_estate_kind_of_map===2){
434        wpresidence_leaflet_map_cluster();
435    }
436   
437}
438
439function wpresidence_map_general_fit_to_bounds(with_bound){
440    "use strict";
441    if(geolocation_search_used===1){
442        geolocation_search_used=0;
443        return;
444    }
445    
446    if(wp_estate_kind_of_map===1){
447        wpresidence_google_fit_to_bounds(with_bound);
448    }else if(wp_estate_kind_of_map===2){
449        wpresidence_leaflet_fit_to_bounds(with_bound);
450    }
451  
452}
453
454
455function wpresidence_map_panorama(){
456    "use strict";
457    
458    if( parseInt(mapbase_vars.wp_estate_kind_of_map) == 2){
459        return;
460    }
461    var viewPlace=new google.maps.LatLng(curent_gview_lat,curent_gview_long);
462    
463    panorama = map.getStreetView();
464    panorama.setPosition(viewPlace);
465    heading  = parseInt(googlecode_property_vars.camera_angle);
466
467    panorama.setPov(/** @type {google.maps.StreetViewPov} */({
468        heading: heading,
469        pitch: 0
470    }));
471  
472    google.maps.event.addListener(panorama, "closeclick", function() {
473        jQuery('#gmap-next,#gmap-prev ,#geolocation-button,#gmapzoomminus,#gmapzoomplus').show();
474        jQuery('#street-view').removeClass('mapcontrolon');
475    });
476    
477}
478
479
480
481function wpresidence_google_fit_to_bounds(with_bound){
482    "use strict";
483      
484    if (document.getElementById('google_map_prop_list')) {
485       
486       
487    }else if (document.getElementById('googleMap')) {
488        if(with_bound===1){
489            if (typeof( bounds) !== 'undefined' && !bounds.isEmpty()) {
490
491                wpestate_fit_bounds(bounds);
492            }else{
493                wpestate_fit_bounds_nolsit();
494            }
495        }     
496    }
497}
498
499
500
501
502
503function wpresidence_map_general_spiderfy(){
504    "use strict";
505    
506    if(wp_estate_kind_of_map===1){
507        if( !jQuery('body').hasClass('single-estate_property') ){
508            oms = new OverlappingMarkerSpiderfier(map, {markersWontMove: true, markersWontHide: true,keepSpiderfied :true,legWeight:2});
509            wpestate_setOms(gmarkers); 
510        }
511    }else if(wp_estate_kind_of_map===2){
512        // no school no job no problem
513    }   
514}
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531function wpresidence_leaflet_fit_to_bounds(with_bound){
532
533    if(with_bound===1){
534        if(typeof (bounds_list) !== "undefined" ){
535            if (bounds_list.isValid()) {       
536                    wpestate_fit_bounds_leaflet(bounds_list);
537            }else{
538             
539                wpestate_fit_bounds_nolsit_leaflet();
540            }
541        }else{
542       
543        }
544    }
545} 
546
547
548
549
550
551
552function wpestate_fit_bounds_leaflet(bounds){
553   
554    is_fit_bounds_zoom=1;  
555
556    if(placeCircle!=''){
557        map.fitBounds(placeCircle.getBounds());// placecircle is google geolocation 
558    }else{
559        if(gmarkers.length===1){
560            var center = gmarkers[0].getLatLng();
561            map.panTo(center);
562            map.setZoom(10);
563            is_fit_bounds_zoom=0;  
564   
565        }else{
566  
567           map.fitBounds(bounds);
568                    
569           setTimeout(function(){
570            map.fitBounds(bounds);
571           },500)
572
573
574        }
575    }
576
577    
578}
579
580
581function wprentals_leaflet_map_pan_move(){
582    if (googlecode_regular_vars.on_demand_pins==='yes' && mapfunctions_vars.is_tax!=1 && mapfunctions_vars.is_property_list==='1'){      
583        map.on('moveend', function(e) {
584            wpestate_ondenamd_map_moved_leaflet();
585        });
586        
587    }
588}
589
590
591
592
593
594
595
596
597
598function wprentals_google_map_pan_move(){
599    if (googlecode_regular_vars.on_demand_pins==='yes' && mapfunctions_vars.is_tax!=1 && mapfunctions_vars.is_property_list==='1'){
600        map.addListener('idle', function() {
601            wpestate_ondenamd_map_moved();
602        });  
603    }
604}
605
606
607
608function wpresidence_createMarker_leaflet ( pin_price,size, i,id,lat,lng,pin,title,counter,image,price,single_first_type,single_first_action,link,rooms,baths,cleanprice,single_first_type_name, single_first_action_name){
609    "use strict";
610            
611
612    var infoboxWrapper = document.createElement( "div" );
613    infoboxWrapper.className = 'leafinfobox-wrapper';
614    var infobox = "";
615        
616    var poss=0;
617    var infobox_class=" price_infobox ";
618    
619    price=price;
620    var price2=price;
621    var my_custom_curr_pos     =   parseFloat( wpestate_getCookie_map('my_custom_curr_pos'));
622    if (!isNaN(my_custom_curr_pos) && my_custom_curr_pos !== -1) {
623        var converted_price= wpestate_get_price_currency(cleanprice,cleanprice);
624        var testRE = price.match('</span>(.*)<span class=');
625        if (testRE !== null ){
626            price2=price.replace(testRE[1],converted_price);
627        }
628    }
629    
630    
631    
632    if( mapfunctions_vars.useprice === 'yes' ){
633        infobox_class =' openstreet_map_price_infobox ';
634    } 
635
636                                
637    var info_image='';        
638    if (image === '') {
639        info_image =  '<img width="400" height="161" src="'+mapfunctions_vars.path + '/idxdefault.jpg'+'" class="attachment-property_map1 size-property_map1 wp-post-image" alt="">';
640    } else {
641        info_image = image;
642    }
643    
644    var category        = decodeURIComponent(single_first_type.replace(/-/g, ' '));
645    var action          = decodeURIComponent(single_first_action.replace(/-/g, ' '));
646    var category_name   = decodeURIComponent(single_first_type_name.replace(/-/g, ' '));
647    var action_name     = decodeURIComponent(single_first_action_name.replace(/-/g, ' '));
648
649    var in_type = mapfunctions_vars.in_text;
650    if (category === '' || action === '') {
651        in_type = " ";
652    }
653    in_type = " / ";
654    var  infoguest,inforooms;
655    
656    var infobaths; 
657    if(baths!='' && baths!=0){
658        infobaths ='<span id="infobath">'+baths+' '+mapfunctions_vars.ba+'</span>';
659    }else{
660        infobaths =''; 
661    }
662        
663        
664    var inforooms;
665    if(rooms!='' && rooms!=0 ){
666        inforooms='<span id="inforoom">'+rooms+' '+mapfunctions_vars.bd+'</span>';
667    }else{
668        inforooms=''; 
669    }
670           
671    var infosize;
672    if(size!=''){
673        infosize ='<span id="infosize">'+size+'</span>';
674    }else{
675        infosize=''; 
676    }
677   
678    var title=  title.substr(0, 30);
679    if(title.length > 30){
680        title=title+"...";
681    }
682    
683   infobox +=  wpestate_generate_infobox_leaflet(infobox_class,title,link,info_image,price,cleanprice,infosize,infobaths,inforooms);
684     
685   var  markerOptions = {
686        riseOnHover: true
687    };
688    
689    var markerCenter    =   L.latLng( lat, lng );
690    var propertyMarker  =   '';
691    
692    
693    
694    if( mapfunctions_vars.useprice === 'yes' ){
695        
696        var price2=price;
697        var my_custom_curr_pos     =   parseFloat( wpestate_getCookie_map('my_custom_curr_pos'));
698        if (!isNaN(my_custom_curr_pos) && my_custom_curr_pos !== -1) {
699            var converted_price= wpestate_get_price_currency(cleanprice,cleanprice);
700            var testRE = price.match('</span>(.*)<span class=');
701            if (testRE !== null ){
702                price2=price.replace(testRE[1],converted_price);
703            }
704        }
705      
706      
707        var price_pin_class= 'wpestate_marker openstreet_price_marker '+wpestate_makeSafeForCSS(single_first_type_name.trim() )+' '+wpestate_makeSafeForCSS(single_first_action_name.trim()); 
708
709        var pin_price_marker = '<div class="'+price_pin_class+'">';
710        if (typeof(price) !== 'undefined') {
711            if( mapfunctions_vars.use_price_pins_full_price==='no'){
712                pin_price_marker +='<div class="interior_pin_price">'+pin_price+'</div>';
713            }else{
714                
715                pin_price_marker +='<div class="interior_pin_price">'+price2+'</div>';
716            }
717        }
718        pin_price_marker += '</div>';
719        
720
721
722        var myIcon = L.divIcon({ 
723            className:'someclass',
724            iconSize: new L.Point(0, 0), 
725            html: pin_price_marker
726        });
727        propertyMarker  = L.marker( markerCenter, {icon: myIcon} );
728
729    }else{    
730       var markerImage     = {
731            iconUrl: wprentals_custompin_leaflet(pin),
732            iconSize: [44, 50],
733            iconAnchor: [20, 50],
734            popupAnchor: [1, -50]
735        };
736        markerOptions.icon  = L.icon( markerImage );
737        propertyMarker      = L.marker( markerCenter, markerOptions );
738    }
739   
740    propertyMarker.idul =   id;
741    propertyMarker.pin  =   pin;
742   
743    if (mapfunctions_vars.user_cluster === 'yes') {
744        markers_cluster.addLayer(propertyMarker);
745    }else{
746        propertyMarker.addTo( map );
747    }
748    
749    gmarkers.push(propertyMarker);
750
751
752    if(typeof (bounds_list) !== "undefined" ){
753        if(bounds_list.isValid() ){         
754            bounds_list.extend(propertyMarker.getLatLng());
755        }else{
756             bounds_list = L.latLngBounds( propertyMarker.getLatLng(),propertyMarker.getLatLng() );
757        }
758    }else{     
759        bounds_list = L.latLngBounds( propertyMarker.getLatLng(),propertyMarker.getLatLng() );
760    }
761    
762    infoboxWrapper.innerHTML = infobox;
763    propertyMarker.bindPopup( infobox );
764    
765
766   
767}
768
769
770
771
772
773
774
775
776
777
778
779function wprentals_custompinchild_leaflet(image) {
780    "use strict";
781    var custom_img;
782    var extension='';
783    var ratio = jQuery(window).dense('devicePixelRatio');
784    
785    if(ratio>1){
786        extension='_2x';
787    }
788    
789    if (images['userpin'] === '') {
790        custom_img = mapfunctions_vars.path + '/' + 'userpin' +extension+ '.png';
791    } else {
792        custom_img = images['userpin'];
793        if(ratio>1){
794            custom_img=wpestate_get_custom_retina_pin(custom_img);
795        }
796    }
797
798
799    
800    return custom_img;;
801}
802
803function wprentals_custompin_leaflet(image) {
804    "use strict";
805    if( mapfunctions_vars.useprice === 'yes' ){
806        return mapfunctions_vars.path + '/pixel.png';
807    }
808    
809    var custom_img  =   '';
810    var extension   =   '';
811    var ratio       =   jQuery(window).dense('devicePixelRatio');
812  
813    if(ratio>1){
814        extension='_2x';
815    }
816       
817    if(mapfunctions_vars.use_single_image_pin==='no'){
818
819        if (image !== '') {
820            if (images[image] === '') {
821                custom_img = mapfunctions_vars.path + '/' + image + extension + '.png';
822            } else {
823                custom_img = images[image];
824                if(ratio>1){
825                    custom_img=wpestate_get_custom_retina_pin(custom_img);
826                }
827            }
828        } else {
829            custom_img = images['single_pin'];
830        }
831    }else{
832        if(ratio>1){
833            custom_img= wpestate_get_custom_retina_pin(  images['single_pin'] );
834        }else{
835            custom_img= images['single_pin']; 
836        }
837    }
838        
839        
840
841    if (typeof (custom_img) === 'undefined') {
842        custom_img =images['single_pin'];
843    }
844    return custom_img;
845}
846
847function wprentals_map_resize(){
848    if(wp_estate_kind_of_map===1){
849        google.maps.event.trigger(map, "resize");
850    }else if(wp_estate_kind_of_map===2){
851         map.invalidateSize();
852    }else if(wp_estate_kind_of_map===3){
853        
854    }   
855}
856
857
858
859
860
861
862
863
864
865
866
867
868function wprentals_initialize_map_submit_leaflet(){
869  
870    
871    var listing_lat = jQuery('#property_latitude').val();
872    var listing_lon = jQuery('#property_longitude').val();
873
874    if (listing_lat === '' || listing_lat === 0 || listing_lat === '0') {
875        listing_lat = google_map_submit_vars.general_latitude;
876    }
877
878    if (listing_lon === '' || listing_lon === 0 || listing_lon === '0') {
879        listing_lon = google_map_submit_vars.general_longitude;
880    }
881    
882    var mapCenter = L.latLng( listing_lat,listing_lon );
883
884
885    if (document.getElementById('googleMapsubmit')) {
886        map =  L.map( 'googleMapsubmit',{
887            center: mapCenter, 
888            zoom: 17
889        }).on('load', function(e) {
890           
891        });
892        map_intern = 1;
893    
894
895
896        var tileLayer =  wpresidence_open_stret_tile_details();
897
898        map.addLayer( tileLayer );
899        map.on('click', function(e){
900            map.removeLayer( propertyMarker_submit )
901            var markerCenter        =   L.latLng( e.latlng);
902            propertyMarker_submit   =   L.marker(e.latlng).addTo(map);;
903            propertyMarker_submit.bindPopup('<div class="submit_leaflet_admin">Latitude: ' + e.latlng.lat + ' Longitude: ' + e.latlng.lng+'</div>').openPopup();
904            jQuery("#property_latitude").val ( e.latlng.lat) ;
905            jQuery("#property_longitude").val ( e.latlng.lng) ;
906         
907           
908        });
909
910
911        var markerCenter        =   L.latLng( listing_lat,listing_lon );
912        propertyMarker_submit   =   L.marker( markerCenter ).addTo(map);
913        propertyMarker_submit.bindPopup('<div class="submit_leaflet_admin">Latitude: ' + listing_lat + ' Longitude: ' + listing_lon+'</div>');
914     
915        setTimeout(function(){       propertyMarker_submit.openPopup(); }, 600);   
916   }
917}
918
919
920
921
922
923
924function wpresidence_map_resise(){
925    if(wp_estate_kind_of_map===1){
926        google.maps.event.addListenerOnce(map, 'idle', function() {
927            setTimeout(function(){google.maps.event.trigger(map, 'resize'); }, 600);        
928        });
929
930    }else if(wp_estate_kind_of_map===2){
931        map.invalidateSize();
932        setTimeout(function(){ map.invalidateSize(); }, 600);   
933    }
934}
935
936
937
938function wpresidence_initialize_map_contact_leaflet(){
939    "use strict";
940
941    var mapCenter = L.latLng( mapbase_vars.hq_latitude, mapbase_vars.hq_longitude );
942       map =  L.map( 'googleMap',{
943           center: mapCenter, 
944           zoom: parseInt(mapbase_vars.page_custom_zoom, 10),
945       });
946
947        var tileLayer =  wpresidence_open_stret_tile_details();
948        map.addLayer( tileLayer );
949        
950        map.scrollWheelZoom.disable();
951        if ( Modernizr.mq('only all and (max-width: 768px)') ) {    
952            map.dragging.disable();
953        }
954        //map.touchZoom.disable();
955        
956        
957    
958        jQuery('#gmap-loading').remove();
959
960        map.on('popupopen', function(e) {
961
962            var px = map.project(e.popup._latlng); // find the pixel location on the map where the popup anchor is
963            if( mapfunctions_vars.useprice === 'yes' ){
964               px.y -= 115;
964 // find the height of the popup container, divide by 2, subtract from the Y axis of marker location
965            }else{
966                px.y -= 120/2; // find the height of the popup container, divide by 2, subtract from the Y axis of marker location
967            }
968            map.panTo(map.unproject(px),{animate: true}); // pan to new center
969        });
970
971        var markerCenter    =   L.latLng( mapbase_vars.hq_latitude, mapbase_vars.hq_longitude );
972        var markerImage     = {
973            iconUrl: images['single_pin'],
974            iconSize: [44, 50],
975            iconAnchor: [20, 50],
976            popupAnchor: [1, -50]
977        };
978        var markerOptions = {
979            riseOnHover: true
980        };
981       // var infobox = '<div class="info_details contact_info_details leaflet_contact"><h2 id="contactinfobox">' +  mapbase_vars.title+ '</h2><div class="contactaddr">' + mapbase_vars.address + '</div></div>'
982
983
984       markerOptions.icon  = L.icon( markerImage );
985       var propertyMarker      = L.marker( markerCenter, markerOptions );
986     //  propertyMarker.bindPopup( infobox );
987       propertyMarker.addTo( map );
988
989       propertyMarker.fire('click');
990       
991             
992        if ( Modernizr.mq('only all and (max-width: 768px)') ) {        
993            map.on('dblclick ', function(e) {
994                if (map.dragging.enabled()) {
995                     map.dragging.disable();
996                    //map.touchZoom.disable();
997                }else{
998                    map.dragging.enable();
999                    //map.touchZoom.enable();
1000                }
1001            });
1002        }
1003
1004
1005}
1006
1007
1008
1009
1010function wpresidence_initialize_map_contact(){
1011    "use strict";
1012    if(!document.getElementById('googleMap') ){
1013        return;
1014    }
1015    var mapOptions = {
1016        zoom: parseInt(mapbase_vars.page_custom_zoom),
1017        scrollwheel: false,
1018        center: new google.maps.LatLng(mapbase_vars.hq_latitude, mapbase_vars.hq_longitude),
1019        mapTypeId: mapbase_vars.type.toLowerCase(),
1020        streetViewControl:false,
1021        disableDefaultUI: true,
1022        gestureHandling: 'cooperative'
1023    };
1024
1025    map = new google.maps.Map(document.getElementById('googleMap'), mapOptions);
1026
1027    
1028
1029    google.maps.event.addListener(map, 'tilesloaded', function() {
1030        jQuery('#gmap-loading').remove();
1031    });
1032
1033
1034    var styles ='';
1035    if(mapfunctions_vars.map_style !==''){
1036       styles = JSON.parse ( mapfunctions_vars.map_style );
1037     
1038    }
1039    
1040    if(jQuery('#wpestate_full_map_control_data').length>0){
1041        if(map_style_shortcode !==''){
1042            styles = (map_style_shortcode );
1043        }
1044         if(mapfunctions_vars.shortcode_map_style !==''){}
1045    }
1046      map.setOptions({styles: styles});
1047    
1048    pins=mapbase_vars.markers;
1049    markers = jQuery.parseJSON(pins);
1050    wpestate_setMarkers_contact(map, markers);
1051    //google.maps.event.trigger(gmarkers[0], 'click');
1052
1053  
1054}
1055
1056 ////////////////////////////////////////////////////////////////////
1057 /// custom pin function
1058 //////////////////////////////////////////////////////////////////////
1059 
1060function wpestate_custompincontact(image){
1061    "use strict";
1062    image = {
1063        url:  images['single_pin'],
1064        size: new google.maps.Size(59, 59),
1065        origin: new google.maps.Point(0,0),
1066        anchor: new google.maps.Point(16,59 )
1067   };
1068   return image;
1069 }
1070  
1071 ////////////////////////////////////////////////////////////////////
1072 /// set markers function
1073 //////////////////////////////////////////////////////////////////////
1074 
1075
1076function wpestate_setMarkers_contact(map, beach) {
1077    "use strict";
1078    var shape = {
1079        coord: [1, 1, 1, 38, 38, 59, 59 , 1],
1080        type: 'poly'
1081    };
1082    var title;
1083    var boxText = document.createElement("div");
1084    var myOptions = {
1085                      content: boxText,
1086                      disableAutoPan: true,
1087                      maxWidth: 500,
1088                      pixelOffset: new google.maps.Size(-90, -210),
1089                      zIndex: null,
1090                      closeBoxMargin: "-13px 0px 0px 0px",
1091                      closeBoxURL: "",
1092                      draggable: true,
1093                      infoBoxClearance: new google.maps.Size(1, 1),
1094                      isHidden: false,
1095                      pane: "floatPane",
1096                      enableEventPropagation: false
1097              };              
1098    infoBox = new InfoBox(myOptions);         
1099                
1100
1101   
1102
1103    var myLatLng = new google.maps.LatLng(mapbase_vars.hq_latitude, mapbase_vars.hq_longitude);
1104    var marker = new google.maps.Marker({
1105        position: myLatLng,
1106        map: map,
1107        icon: wpestate_custompincontact(beach[8]),
1108        shape: shape,
1109        title: decodeURIComponent(  beach[0].replace(/\+/g,' ')),
1110        zIndex: 1,
1111        image:beach[4],
1112        price:beach[5],
1113        type:beach[6],
1114        type2:beach[7],
1115        infoWindowIndex : 0 
1116    });
1117
1118    gmarkers.push(marker);
1119
1120
1121//    google.maps.event.addListener(marker, 'click', function() { 
1122//        first_time=0;
1123//        title = this.title;
1124//        infoBox.setContent('<div class="info_details contact_info_details"><span id="infocloser" onClick=\'javascript:infoBox.close();\' ></span><h2 id="contactinfobox">'+title+'</h2><div class="contactaddr">'+mapbase_vars.address+'</div></div>' );
1125//  
1126//        infoBox.open(map, this);    
1127//        map.setCenter(this.position);      
1128//        map.panBy(0,-120);
1129//        
1130//        wpestate_close_adv_search();
1131//    });
1132
1133
1134}// end setMarkers
1135
1136  

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.