You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
cosmopet.ae/wp-content copy/themes/woodmart/js/scripts/elements/openStreetMap.min.js

5 lines
5.9 KiB

!function(s){s.each(["frontend/element_ready/wd_open_street_map.default"],function(t,e){woodmartThemeModule.wdElementorAddAction(e,function(){woodmartThemeModule.wdOpenStreetMap()})}),woodmartThemeModule.wdOpenStreetMap=function(){if("undefined"!=typeof leaflet){const o=function(t,r){var e,o,t=t.attr("id");let a=r.hasOwnProperty("center")?r.center:null,i=r.hasOwnProperty("markers")?r.markers:[];void 0!==L.DomUtil.get(t)&&L.DomUtil.get(t)&&(L.DomUtil.get(t)._leaflet_id=null);const n=L.map(t,{scrollWheelZoom:r.hasOwnProperty("scrollWheelZoom")&&"yes"===r.scrollWheelZoom,zoomControl:r.hasOwnProperty("zoomControl")&&"yes"===r.zoomControl,dragging:r.hasOwnProperty("dragging")&&"yes"===r.dragging});if(a&&n.setView(a.split(","),r.zoom),r.hasOwnProperty("geoapify_tile")&&"osm-carto"!==r.geoapify_tile&&("custom-tile"!==r.geoapify_tile||r.hasOwnProperty("geoapify_custom_tile")&&0!==r.geoapify_custom_tile.length)){if("stamen-toner"===r.geoapify_tile)L.tileLayer("https://stamen-tiles.a.ssl.fastly.net/toner/{z}/{x}/{y}.png",{attribution:'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.',maxZoom:18}).addTo(n);else if("stamen-terrain"===r.geoapify_tile)L.tileLayer("https://stamen-tiles.a.ssl.fastly.net/terrain/{z}/{x}/{y}.jpg",{attribution:'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.',maxZoom:18}).addTo(n);else if("stamen-watercolor"===r.geoapify_tile)L.tileLayer("https://stamen-tiles.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg",{attribution:'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.',maxZoom:18}).addTo(n);else if("custom-tile"===r.geoapify_tile&&r.hasOwnProperty("geoapify_custom_tile")&&0!==r.geoapify_custom_tile.length){let t=r.geoapify_custom_tile;t=t.replaceAll("$",""),L.tileLayer(t,{attribution:`<a href="${r.osm_custom_attribution_url||null}" target="_blank"> ${r.osm_custom_attribution||null} </a> | © OpenStreetMap <a href="https://www.openstreetmap.org/copyright" target="_blank">contributors</a>`,maxZoom:18}).addTo(n)}}else L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',maxZoom:18}).addTo(n);(t=i)&&0<t.filter(function(t){return!isNaN(t.lat)&&!isNaN(t.lng)}).length||(t=51.50735,e=-.12776,i.push({lat:t,lng:e,marker:{button_text:"",button_url:"",marker_coords:{lat:t,lng:e},marker_description:"",marker_title:"",show_button:"no"}}),n.setView([t,e],r.zoom)),s.each(i,function(){let e=this.marker;if(e.hasOwnProperty("image")&&e.hasOwnProperty("image_size")&&(e.image.hasOwnProperty("url")&&0<e.image.url.length||"string"==typeof e.image&&0<e.image.length)){let t=null;e.image.hasOwnProperty("url")&&0<e.image.url.length?t=e.image.url:"string"==typeof e.image&&0<e.image.length&&(t=e.image),e.markerOptions={icon:L.icon({iconUrl:t,iconSize:e.image_size})}}else e.markerOptions={icon:L.icon({iconUrl:r.hasOwnProperty("iconUrl")?r.iconUrl:null,iconSize:r.hasOwnProperty("iconSize")?r.iconSize:[25,41]})}}),o=n,t=i,s.each(t,function(){let t=this.marker;var e=t.hasOwnProperty("markerOptions")?t.markerOptions:{};let r=L.marker([this.lat,this.lng],e),a=(r.addTo(o),'<div class="marker-tooltip">');if(this.marker.marker_title&&(a+=`<div class="marker-title"><h5 class="title">${this.marker.marker_title}</h5></div>`),a+='<div class="marker-content">',this.marker.marker_description&&(a+=`<div class="marker-description">${this.marker.marker_description}</div>`),"yes"===this.marker.show_button&&this.marker.button_text&&(e=this.marker.hasOwnProperty("button_url_target")&&this.marker.button_url_target?this.marker.button_url_target:"_blank",a+=`<div class="marker-button">
<a class="btn btn-color-primary btn-style-link" target="${e}" href='${this.marker.button_url}' role="button">
${this.marker.button_text}
</a>
</div>`),a+="</div></div>",this.marker.marker_title||this.marker.marker_description||this.marker.button_text&&this.marker.show_button)switch(this.marker.hasOwnProperty("marker_behavior")?this.marker.marker_behavior:null){case"popup":r.bindPopup(a);break;case"static_close_on":r.bindPopup(a,{closeOnClick:!1,autoClose:!1,closeOnEscapeKey:!1}).openPopup();break;case"static_close_off":r.bindPopup(a,{closeOnClick:!1,autoClose:!1,closeButton:!1,closeOnEscapeKey:!1}).openPopup();break;case"tooltip":r.bindTooltip(a,{})}}),setTimeout(function(){o.invalidateSize()},100)};s(".wd-osm-map-container").each(function(){let e=s(this),r=e.find(".wd-osm-map-wrapper"),a=r.data("settings");a&&(a.hasOwnProperty("init_type")&&"button"===a.init_type?e.find(".wd-init-map").on("click",function(t){t.preventDefault(),e.hasClass("wd-map-inited")||(e.addClass("wd-map-inited"),o(r,a))}):a.hasOwnProperty("init_type")&&"scroll"===a.init_type?woodmartThemeModule.$window.on("scroll",function(){a.hasOwnProperty("init_offset")&&window.innerHeight+woodmartThemeModule.$window.scrollTop()+parseInt(a.init_offset)>e.offset().top&&(e.hasClass("wd-map-inited")||(e.addClass("wd-map-inited"),o(r,a)))}):a.hasOwnProperty("init_type")&&"interaction"===a.init_type?woodmartThemeModule.$window.on("wdEventStarted",function(){e.hasClass("wd-map-inited")||(e.addClass("wd-map-inited"),o(r,a))}):o(r,a))})}},s(document).ready(function(){woodmartThemeModule.wdOpenStreetMap()})}(jQuery);