← Back
Editing: single-listing-google-map.min.js
!function(){"use strict";var e={d:function(t,o){for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},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.js ***! \***********************************************************************/ e.r(t),e.d(t,{initSingleMap:function(){return n}});var o=jQuery;function n(){"undefined"!=typeof google&&google.maps&&google.maps.Marker&&google.maps.OverlayView&&google.maps.marker.AdvancedMarkerElement&&o(".directorist-single-map").length&&document.querySelectorAll(".directorist-single-map").forEach(function(e){var t,n,a,i='<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>"),r=document.createElement("div");function s(e){google.maps.Marker.apply(this,arguments),e.map_icon_label&&(this.MarkerLabel=new l({map:this.getMap(),marker:this,text:e.map_icon_label}),this.MarkerLabel.bindTo("position",this,"position"))}function l(e){this.setValues(e),this.div=document.createElement("div"),this.div.className="map-icon-label";var t=this;google.maps.event.addDomListener(this.div,"click",function(e){e.stopPropagation&&e.stopPropagation(),google.maps.event.trigger(t.marker,"click")})}r.className="atbd_map_shape",r.innerHTML=i,s.prototype=Object.create(google.maps.Marker.prototype),s.prototype.constructor=s,s.prototype.setMap=function(e){google.maps.Marker.prototype.setMap.call(this,e),this.MarkerLabel&&this.MarkerLabel.setMap(e)},l.prototype=Object.create(google.maps.OverlayView.prototype),l.prototype.constructor=l,l.prototype.onAdd=function(){var e=this.getPanes();e&&e.overlayImage.appendChild(this.div);var t=this;this.listeners=[google.maps.event.addListener(this,"position_changed",function(){t.draw()}),google.maps.event.addListener(this,"text_changed",function(){t.draw()}),google.maps.event.addListener(this,"zindex_changed",function(){t.draw()})]},l.prototype.onRemove=function(){this.div.parentNode&&this.div.parentNode.removeChild(this.div);for(var e=0;e<this.listeners.length;e++)google.maps.event.removeListener(this.listeners[e])},l.prototype.draw=function(){var e=this.getProjection();if(e){var t=e.fromLatLngToDivPixel(this.get("position"));if(t){var o=this.div;o.innerHTML=this.get("text")||"",o.style.zIndex=this.get("zIndex")||"0",o.style.position="absolute",o.style.display="block",o.style.left=t.x-o.offsetWidth/2+"px",o.style.top=t.y-o.offsetHeight+"px"}}};var p=JSON.parse(e.getAttribute("data-map")),d=parseFloat(p.default_latitude),c=parseFloat(p.default_longitude),g=parseFloat(p.manual_lat),m=parseFloat(p.manual_lng),u=parseInt(p.map_zoom_level),f=p.display_map_info,h=p.info_content;g=isNaN(g)?d:g,m=isNaN(m)?c:m,a={lat:g,lng:m},f&&(n=new google.maps.InfoWindow({content:h,maxWidth:400})),new google.maps.marker.AdvancedMarkerElement({map:t,position:a,content:r}).addListener("click",function(){f?f=!1:(n.close(),f=!0)}),function(){t=new google.maps.Map(e,{zoom:u,center:a,mapId:"single_listing_map"});var o=new google.maps.marker.AdvancedMarkerElement({map:t,position:a,content:r});f&&o.addListener("click",function(){n.getMap()?n.close():n.open(t,o)})}(),o(e).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(){n()}),o(window).on("elementor/frontend/init",function(){setTimeout(function(){o("body").hasClass("elementor-editor-active")&&n()},3e3)}),o("body").on("click",function(e){o("body").hasClass("elementor-editor-active")&&"A"!==e.target.nodeName&&"BUTTON"!==e.target.nodeName&&n()})}();
Save File
Cancel