1var FWP_MAP=FWP_MAP||{};(function($){FWP_MAP.markersArray=[];FWP_MAP.markerLookup={};FWP_MAP.is_filtering=!1;FWP_MAP.is_zooming=!1;FWP_MAP.map_loaded=!1;FWP_MAP.get_post_markers=function(post_id){var output=[];if('undefined'!==typeof FWP_MAP.markerLookup[post_id]){var arrayOfIndexes=FWP_MAP.markerLookup[post_id];for(var i=0;i<arrayOfIndexes.length;i++){var index=FWP_MAP.markerLookup[post_id][i];output.push(FWP_MAP.markersArray[index])}} 2return output} 3FWP.hooks.addAction('facetwp/refresh/map',function($this,facet_name){var selected_values=[];if(FWP_MAP.is_filtering&&!FWP.is_popstate&&FWP_MAP.map_loaded){var currentZoom=FWP_MAP.map.getZoom();selected_values=FWP_MAP.map.getBounds().toUrlValue().split(',');selected_values.push(currentZoom.toString())}else if(FWP_MAP.is_filtering&&FWP.is_popstate===!0){FWP.loadFromHash();if(FWP.facets[facet_name]&&FWP.facets[facet_name].length>0){do_refresh_from_url(FWP.facets[facet_name])}else{FWP.is_popstate=undefined;$('.facetwp-map-filtering').trigger('click')}} 4FWP.facets[facet_name]=selected_values;FWP.frozen_facets[facet_name]='hard'});FWP.hooks.addAction('facetwp/reset',function(){$.each(FWP.facet_type,function(type,name){if('map'===type){FWP.frozen_facets[name]='hard'}})});FWP.hooks.addFilter('facetwp/selections/map',function(label,params){return FWP_JSON.map.resetText});function do_refresh(){if(FWP_MAP.is_filtering&&!FWP_MAP.is_zooming){FWP.autoload()} 5FWP_MAP.is_zooming=!1} 6function do_refresh_from_url(selected_values){const sw={lat:parseFloat(selected_values[0]),lng:parseFloat(selected_values[1])};const ne={lat:parseFloat(selected_values[2]),lng:parseFloat(selected_values[3])};const popstate_bounds=new google.maps.LatLngBounds(sw,ne);FWP_MAP.map.fitBounds(popstate_bounds);FWP_MAP.is_zooming=!0;google.maps.event.addListenerOnce(FWP_MAP.map,'bounds_changed',function(){FWP_MAP.map.setZoom(Number(selected_values[4]))})}
7$().on('click','.facetwp-map-filtering',function(){var $this=$(this);if($this.hasClass('enabled')){$this.text(FWP_JSON.map.filterText);FWP_MAP.is_filtering=!1;FWP.autoload()}else{$this.text(FWP_JSON.map.resetText);FWP_MAP.is_filtering=!0;FWP.autoload()} 8$this.toggleClass('enabled')});FWP_MAP.createIcon=function(icon){const imgTag=document.createElement("img");if('string'==typeof icon){imgTag.src=icon;return imgTag} 9if('string'==typeof icon.url){imgTag.src=icon.url;if(icon.scaledSize){if(icon.scaledSize.width)imgTag.width=icon.scaledSize.width;if(icon.scaledSize.height)imgTag.height=icon.scaledSize.height} 10return imgTag} 11return!1} 12FWP_MAP.init=async function(){if('undefined'===typeof FWP.settings.map||''===FWP.settings.map){return} 13if('object'!==typeof google||'object'!==typeof google.maps){return} 14var config=FWP.settings.map.config;const{Map,InfoWindow}=await google.maps.importLibrary("maps");const{AdvancedMarkerElement,PinElement}=await google.maps.importLibrary("marker");AdvancedMarkerElement.prototype.setIcon=function(icon){if(!icon){let pin=new PinElement();this.content=pin.element}else{newIcon=FWP_MAP.createIcon(icon);this.content=newIcon}} 15if(!FWP_MAP.map_loaded){FWP_MAP.map=new Map(document.getElementById('facetwp-map'),FWP.settings.map.init);FWP_MAP.infoWindow=new InfoWindow();FWP_MAP.map.addListener('dragend',function(){do_refresh()});FWP_MAP.map.addListener('zoom_changed',function(){do_refresh()});window.addEventListener('resize',FWP.helper.debounce(function(){var center=FWP_MAP.map.getCenter();google.maps.event.trigger(FWP_MAP.map,'resize');FWP_MAP.map.setCenter(center)},500));google.maps.event.addListener(FWP_MAP.map,'click',function(){FWP_MAP.infoWindow.close()});FWP_MAP.oms=new OverlappingMarkerSpiderfier(FWP_MAP.map,config.spiderfy);var selected_values=FWP.facets[FWP_JSON.map.facet_name];if(selected_values&&selected_values.length>0){FWP_MAP.is_filtering=!0;do_refresh_from_url(selected_values)} 16FWP_MAP.map_loaded=!0}else if('undefined'!==FWP.is_popstate&&!1===FWP.is_popstate){let mapHTML=FWP_MAP.map.getDiv();let mapContainer=document.getElementById('facetwp-map');let mapParent=mapContainer.parentElement;mapParent.replaceChild(mapHTML,mapContainer);clearOverlays()}else{clearOverlays()} 17FWP_MAP.bounds=new google.maps.LatLngBounds();FWP_MAP.contentCache={};$.each(FWP.settings.map.locations,function(obj,idx){const args={position:obj.position,zIndex:obj.zIndex,title:obj.title};args.gmpDraggable=obj.draggable??obj.gmpDraggable;let content=FWP.hooks.applyFilters('facetwp_map/marker/content',null,obj,PinElement);if(!content&&obj.markerHtml){content=document.createElement("div");content.innerHTML=obj.markerHtml} 18if(!content&&obj.icon){content=FWP_MAP.createIcon(obj.icon)} 19if(!content){const{label=''}=obj;const{glyphHtml='',pinClass='',...pinOptions}=obj.pinOptions||{};if(label){pinOptions.glyph=label.text;if(label.color)pinOptions.glyphColor=label.color} 20if(glyphHtml){const glyph=document.createElement("div");glyph.innerHTML=glyphHtml;pinOptions.glyph=glyph} 21let pin=new PinElement(pinOptions);if(pinClass){pin.element.classList.add(pinClass)} 22content=pin.element} 23args.content=content;const marker=new AdvancedMarkerElement(args);marker.post_id=obj.post_id;marker.infoWindowContent=obj.infoWindowContent;marker.clickable='undefined'!==typeof obj.clickable?obj.clickable:!0;var isProgrammaticClick=!1;google.maps.event.addListener(marker,'spider_click',function(){if(!1==marker.clickable){FWP.hooks.doAction('facetwp_map/marker/click',marker);return} 24if('undefined'!==typeof marker.infoWindowContent){FWP_MAP.infoWindow.setContent(marker.infoWindowContent)}else if('undefined'===typeof FWP_MAP.contentCache[marker.post_id]){FWP_MAP.infoWindow.setContent('Loading...');FWP_MAP.infoWindow.open(FWP_MAP.map,marker);return $.post(FWP_JSON.map.ajaxurl,{action:'facetwp_map_marker_content',facet_name:FWP_JSON.map.facet_name,post_id:marker.post_id},{dataType:'text',contentType:'application/x-www-form-urlencoded',done:(resp)=>{FWP_MAP.contentCache[marker.post_id]=resp;FWP_MAP.infoWindow.setContent(resp);FWP.hooks.doAction('facetwp_map/marker/click',marker);if(!isProgrammaticClick){isProgrammaticClick=!0;google.maps.event.trigger(marker,'click');isProgrammaticClick=!1}}})}else{var data=FWP_MAP.contentCache[marker.post_id];FWP_MAP.infoWindow.setContent(data)} 25FWP_MAP.infoWindow.open(FWP_MAP.map,marker);FWP.hooks.doAction('facetwp_map/marker/click',marker)});marker.content.addEventListener('mouseenter',function(e){FWP.hooks.doAction('facetwp_map/marker/mouseover',marker)});marker.content.addEventListener('mouseleave',function(e){FWP.hooks.doAction('facetwp_map/marker/mouseout',marker)});FWP_MAP.oms.addMarker(marker);FWP_MAP.markersArray.push(marker);FWP_MAP.bounds.extend(marker.position);
25if('undefined'!==typeof FWP_MAP.markerLookup[obj.post_id]){FWP_MAP.markerLookup[obj.post_id].push(idx)}else{FWP_MAP.markerLookup[obj.post_id]=[idx]} 26FWP.hooks.doAction('facetwp_map/marker/added',marker,obj)});var has_results=FWP.settings.map.locations.length>0;var fit_bounds=FWP.hooks.applyFilters('facetwp_map/fit_bounds',!FWP_MAP.is_filtering);if(fit_bounds&&has_results){FWP_MAP.map.fitBounds(FWP_MAP.bounds)}else if(!FWP_MAP.is_filtering&&(0!==config.default_lat||0!==config.default_lng)){FWP_MAP.map.setCenter({lat:parseFloat(config.default_lat),lng:parseFloat(config.default_lng)});FWP_MAP.is_zooming=!0;FWP_MAP.map.setZoom(config.default_zoom)} 27if('undefined'!=typeof markerClusterer&&'undefined'!==typeof config.cluster){var clusterargs={algorithmOptions:{maxZoom:config.cluster.maxZoom,minPoints:config.cluster.minimumClusterSize},};if(!1==config.cluster.zoomOnClick){clusterargs.onClusterClick=!1} 28clusterargs=Object.assign(FWP.hooks.applyFilters('facetwp_map/clusterer',clusterargs,config.cluster),{markers:FWP_MAP.markersArray,map:FWP_MAP.map});FWP_MAP.mc=new markerClusterer.MarkerClusterer(clusterargs)} 29$().trigger('facetwp-maps-loaded')};FWP.hooks.addFilter('facetwp_map/clusterer',function(clusterargs,clusterconfig){if(typeof clusterconfig.imagePath!=='undefined'&&clusterconfig.imagePath!==''&&typeof clusterconfig.imageExtension!=='undefined'&&clusterconfig.imageExtension!==''){var imageRenderer={render({count,position},stats){const sizes=[53,56,66,78,90];let i=0;var dv=count;while(dv!==0){dv=parseInt(dv/10,10);i++} 30i=Math.min(i,5);const size=sizes[i-1];const imgsrc=clusterconfig.imagePath+i+'.'+clusterconfig.imageExtension;const title=`Cluster of ${count} markers`;const zIndex=1000000+count;const pinImgString=` 31 <div style="position: relative;"> 32 <img src="${imgsrc}" width="${size}" height="${size}" alt="clustericon"/> 33 <span class="count" style="position: absolute; left: 0; top: 0; display: block; width: 100%; text-align: center; font-size: 11px; line-height:${size}px; color: #000000; font-weight: bold;">${count}</span> 34 </div>`;const parser=new DOMParser();const pinImg=parser.parseFromString(pinImgString,'text/html').body.firstChild;const clusterOptions={map:clusterconfig.map,position,zIndex,title,content:pinImg,};return new google.maps.marker.AdvancedMarkerElement(clusterOptions)}} 35clusterargs.renderer=imageRenderer}else if(typeof clusterconfig.styles!=='undefined'&&clusterconfig.styles!==''){var stylesRenderer={render({count,position},stats){let i=0;var dv=count;while(dv!==0){dv=parseInt(dv/10,10);i++} 36i=Math.min(i,5);const styles=clusterconfig.styles[i-1];const width=styles.width;const height=styles.height;const textColor=styles.textColor??'#000000';const textSize=styles.textSize??11;const imgsrc=styles.url;const title=`Cluster of ${count} markers`;const zIndex=1000000+count;const pinImgString=` 37 <div style="position: relative;"> 38 <img src="${imgsrc}" width="${width}" height="${height}" alt="clustericon"/> 39 <span class="count" style="position: absolute; left: 0; top: 0; display: block; width: 100%; text-align: center; font-size: ${textSize}px; line-height:${height}px; color: ${textColor}; font-weight: bold;">${count}</span> 40 </div>`;const parser=new DOMParser();const pinImg=parser.parseFromString(pinImgString,'text/html').body.firstChild;const clusterOptions={map:clusterconfig.map,position,zIndex,title,content:pinImg,};return new google.maps.marker.AdvancedMarkerElement(clusterOptions)}} 41clusterargs.renderer=stylesRenderer} 42return clusterargs});$().on('facetwp-loaded',function(){FWP_MAP.init()});function clearOverlays(){FWP_MAP.oms.removeAllMarkers();FWP_MAP.markersArray=[];FWP_MAP.markerLookup={};if('undefined'!==typeof FWP_MAP.mc){FWP_MAP.mc.clearMarkers()}}})(fUtil)
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.