← Back
Editing: single-listing-google-map-widget.min.js
!function(){"use strict";var e={d:function(t,o){for(var a in o)e.o(o,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:o[a]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={}; /*!******************************************************************************!*\ !*** ./assets/src/js/global/map-scripts/single-listing/google-map-widget.js ***! \******************************************************************************/ e.r(t),e.d(t,{initSingleMapWidget:function(){return a}});var o=jQuery;function a(){if("undefined"!=typeof google&&google.maps&&google.maps.Marker&&google.maps.OverlayView&&o("#gmap-widget").length){var e='<i class="directorist-icon-mask" aria-hidden="true" style="--directorist-icon: url(\''.concat(directorist.assets_url,"icons/font-awesome/svgs/solid/map-marker-alt.svg')\"></i>"),t=document.createElement("div");t.className="atbd_map_shape",t.innerHTML=e;function f(e){google.maps.Marker.apply(this,arguments),e.map_icon_label&&(this.MarkerLabel=new r({map:this.map,marker:this,text:e.map_icon_label}),this.MarkerLabel.bindTo("position",this,"position"))}!function(e,t){function o(){}o.prototype=t.prototype,e.superClass_=t.prototype,e.prototype=new o,e.prototype.constructor=e}(f,google.maps.Marker),f.prototype.setMap=function(){google.maps.Marker.prototype.setMap.apply(this,arguments),this.MarkerLabel&&this.MarkerLabel.setMap.apply(this.MarkerLabel,arguments)};var a,n,i,r=function(e){var t=this;this.setValues(e),this.div=document.createElement("div"),this.div.className="map-icon-label",google.maps.event.addListener(this.div,"click",function(e){e.stopPropagation&&e.stopPropagation(),google.maps.event.trigger(t.marker,"click")})};r.prototype=new google.maps.OverlayView,r.prototype.onAdd=function(){this.getPanes().overlayImage.appendChild(this.div);var e=this;this.listeners=[google.maps.event.addListener(this,"position_changed",function(){e.draw()}),google.maps.event.addListener(this,"text_changed",function(){e.draw()}),google.maps.event.addListener(this,"zindex_changed",function(){e.draw()})]},r.prototype.onRemove=function(){this.div.parentNode.removeChild(this.div);for(var e=0,t=this.listeners.length;e<t;++e)google.maps.event.removeListener(this.listeners[e])},r.prototype.draw=function(){var e=this.getProjection().fromLatLngToDivPixel(this.get("position")),t=this.div;this.div.innerHTML=this.get("text").toString(),t.style.zIndex=this.get("zIndex"),t.style.position="absolute",t.style.display="block",t.style.left=e.x-t.offsetWidth/2+"px",t.style.top=e.y-t.offsetHeight+"px"};var s=localized_data_widget.map_container_id?localized_data_widget.map_container_id:"gmap",l=parseFloat(localized_data_widget.default_latitude),d=parseFloat(localized_data_widget.default_longitude),p=parseFloat(localized_data_widget.manual_lat),c=parseFloat(localized_data_widget.manual_lng),g=parseInt(localized_data_widget.map_zoom_level),m=localized_data_widget.display_map_info,u=mapData.info_content;function h(){a=new google.maps.Map(document.getElementById(s),{zoom:g,center:i,mapId:"single_listing_map_widget"});var e=new google.maps.marker.AdvancedMarkerElement({map:a,position:i,content:t});m&&e.addListener("click",function(){n.getMap()?n.close():n.open(a,e)})}p=isNaN(p)?l:p,c=isNaN(c)?d:c,$manual_lat=o("#manual_lat"),$manual_lng=o("#manual_lng"),i={lat:p,lng:c},m&&(n=new google.maps.InfoWindow({content:u,maxWidth:400})),new google.maps.marker.AdvancedMarkerElement({map:a,position:i,content:t}).addListener("click",function(){m?m=!1:(n.close(),m=!0)}),o(document).ready(function(){h(),o("#gmap-widget").find("address").each(function(){var e=o(this).text(),t=o("<a>").attr({href:"https://maps.google.com/maps?q="+encodeURIComponent(e),target:"_blank",rel:"noopener noreferrer"}).text(e);o(this).empty().append(t)})})}}o(document).ready(function(){a()}),o(window).on("elementor/frontend/init",function(){setTimeout(function(){o("body").hasClass("elementor-editor-active")&&a()},3e3)}),o("body").on("click",function(e){o("body").hasClass("elementor-editor-active")&&"A"!==e.target.nodeName&&"BUTTON"!==e.target.nodeName&&a()})}();
Save File
Cancel