PageSourceSearch

https://medicalcardeg.com/wp-content/plugins/townhub-add-ons/assets/js/osm-map.js

js medicalcardeg.com collected 2026-10-02 01:36:09 UTC 7,636 bytes, 1 lines download raw bytes

1!function(e){"use strict";function t(){var t=[];return e("#listing-items .listing-item").length&&e("#listing-items .listing-item").each((function(){var n=decodeURIComponent(e(this).data("lmap"));try{t.push(JSON.parse(n))}catch(e){console.log(e)}})),t}function n(e,t,n){return!isNaN(t)&&t>=e&&t<=n}var o={target:"",center:[parseFloat(_townhub_add_ons.center_lng),parseFloat(_townhub_add_ons.center_lat)],zoom:parseInt(_townhub_add_ons.map_zoom),maxZoom:19,map:null,popup:null,olPopup:null,view:null,features:[],vectorSource:null,clusterSource:null,vectorLayer:null,layerRoute:null,extent:null,multiLineString:null,info_tmpl:_.template(e("#tmpl-map-info").length?e("#tmpl-map-info").html():"",{variable:"data",evaluate:/<#([\s\S]+?)#>/g,interpolate:/{{{([\s\S]+?)}}}/g,escape:/{{([^}]+?)}}(?!})/g}),styleCache:{},init:function(e,t){this.target=e,this.initLayerRoute(),this.initPopup(),this.initView(),this.initVectorSource(t),this.initCluster(),this.initVectorLayer(),this.initMap(),this.fitMap(),this.mapInteraction()},initMap:function(){var e={overlays:[this.popup],target:this.target,view:this.view,pixelRatio:1,layers:[new ol.layer.Tile({preload:3,source:new ol.source.OSM}),this.layerRoute,this.vectorLayer],loadTilesWhileAnimating:!0,interactions:ol.interaction.defaults.defaults({mouseWheelZoom:!1})};this.map=new ol.Map(e),window.listingsOSMMap=this.map;var t=new CustomEvent("listingsOSMMapInit",{detail:"mapInit"});window.dispatchEvent(t)},fitMap:function(){this.map.getView().fit(this.extent,{size:this.map.getSize(),duration:1e3}),window.dispatchEvent(new CustomEvent("listingsOSMMapLoaded",{detail:"hasListing"}))},toDefaultMap:function(){this.map.getView().animate({zoom:this.zoom,center:ol.proj.fromLonLat(this.center),duration:1e3}),window.dispatchEvent(new CustomEvent("listingsOSMMapLoaded",{detail:"noListing"}))},initView:function(){this.view=new ol.View({center:ol.proj.fromLonLat(this.center),zoom:this.zoom,maxZoom:this.maxZoom})},initPopup:function(){this.olPopup=document.getElementById("ol-popup"),this.popup=new ol.Overlay({element:this.olPopup,autoPan:!0,autoPanAnimation:{duration:250}})},initLayerRoute:function(){this.multiLineString=new ol.geom.MultiLineString([]),this.layerRoute=new ol.layer.Vector({source:new ol.source.Vector({features:[new ol.Feature({geometry:this.multiLineString})]}),style:[new ol.style.Style({stroke:new ol.style.Stroke({width:3,color:[51,51,51,1]}),zIndex:2})],updateWhileAnimating:!0})},initVectorSource:function(e){if(!e.length)return this.vectorSource=new ol.source.Vector({}),this.features=[],!1;this.vectorSource=new ol.source.Vector({}),this.extent=ol.extent.createEmpty();for(var t=0;t<e.length;t++)if(a=e[t].latitude,r=e[t].longitude,a=parseFloat(a),r=parseFloat(r),n(-90,a,90)&&n(-180,r,180)){var o=new ol.Feature({geometry:new ol.geom.Point(ol.proj.transform([parseFloat(e[t].longitude),parseFloat(e[t].latitude)],"EPSG:4326","EPSG:3857")),name:e[t].title});o.set("popupInfo",this.locationData(e[t]));var i=new ol.style.Style({image:new ol.style.Icon({anchor:[.5,.5],anchorXUnits:"fraction",anchorYUnits:"fraction",crossOrigin:"anonymous",src:e[t].gmap_marker?e[t].gmap_marker:_townhub_add_ons.marker})});o.setStyle(i),o.setId(e[t].ID),this.features.push(o),this.vectorSource.addFeature(o),ol.extent.extend(this.extent,o.getGeometry().getExtent())}var a,r;return!0},initCluster:function(){this.clusterSource=new ol.source.Cluster({source:this.vectorSource})},initVectorLayer:function(){var e=this;e.vectorLayer=new ol.layer.Vector({source:e.clusterSource,updateWhileAnimating:!0,updateWhileInteracting:!0,style:function(t){var n=t.get("features");if(null!=n){var o=n.length;if(o>1){var i=e.styleCache[o];return i||(i=new ol.style.Style({image:new ol.style.Circle({radius:20,stroke:new ol.style.Stroke({color:"#fff",width:3}),fill:new ol.style.Fill({color:""!=_townhub_add_ons.td_color?_townhub_add_ons.td_color:"#4db7fe"})}),text:new ol.style.Text({text:o.toString(),fill:new ol.style.Fill({color:"#fff"}),font:"13px 'Quicksand', sans-serif"})}),e.styleCache[o]=i),i}return n[0].getStyle()}}})},locationData:function(e){return this.info_tmpl(e)},mapInteraction:function(){var e=this,t=new ol.interaction.Select({condition:function(t){if(!ol.events.condition.singleClick(t))return!1;var n=[],o=[];
1if(e.map.forEachFeatureAtPixel(t.pixel,(function(e,t){if(null!=(o=e.get("features")))for(var i=0;i<o.length;i++)n.push(o[i])})),n.length>1){if(e.map.getView().getZoom()<e.maxZoom){var i=ol.extent.createEmpty();o.forEach((function(e,t){ol.extent.extend(i,e.getGeometry().getExtent())})),e.map.getView().fit(i,e.map.getSize())}else e.map.forEachFeatureAtPixel(t.pixel,(function(n,o){var i=n.get("features");e.displayOverlapping(i,t.pixel)}));return!1}if(1===n.length){var a=n[0];e.olPopup.innerHTML=a.get("popupInfo"),e.popup.setPosition(t.coordinate);var r=new CustomEvent("mapPopupOpened",{detail:"osm"});return window.dispatchEvent(r),!1}return e.popup.setPosition(void 0),!1}});e.map.addInteraction(t)},displayOverlapping:function(e,t){if(null!=e){var n=this,o=e[0];if(o){var i=o.getGeometry().getCoordinates(),a=n.map.getPixelFromCoordinate(i),r=n.generatePointsCircle(e.length,a);n.multiLineString.setCoordinates([]),e.forEach((function(e,t){var o=n.map.getCoordinateFromPixel(r[t]);n.multiLineString.appendLineString(new ol.geom.LineString([i,o])),e.setGeometry(new ol.geom.Point(o))}))}}},generatePointsCircle:function(e,t){var n,o,i=2*Math.PI,a=i/12,r=25*(2+e)/i,l=i/e,s=[];for(n=e-1;n>=0;n--)o=a+n*l,s[n]=[t[0]+r*Math.cos(o),t[1]+r*Math.sin(o)];return s},updateMap:function(e){var t=this,n=t.vectorLayer,o=t.initVectorSource(e);t.initCluster(),t.initVectorLayer();var i=t.map.getLayers();null!=i.remove(n)&&i.push(t.vectorLayer),t.fitMap(),o?t.fitMap():t.toDefaultMap()}};null!=document.getElementById("map-main")&&(e(window).on("load",(function(){null!=window._townhub_add_ons_map&&window._townhub_add_ons_map.length?o.init("map-main",window._townhub_add_ons_map):o.init("map-main",t())})),window.addEventListener("listingsChanged",(function(e){"ajax_search"==e.detail&&o.updateMap(t())}))),e(".singleMap").length&&e(window).on("load",(function(){e(".singleMap").each((function(){var t=e(this),n=t.attr("id"),o=[parseFloat(t.data("lng")),parseFloat(t.data("lat"))],i=t.data("loc"),a=t.data("zoom")?parseInt(t.data("zoom")):parseInt(_townhub_add_ons.map_zoom),r=new ol.View({center:ol.proj.fromLonLat(o),zoom:a}),l=new ol.Feature({geometry:new ol.geom.Point(ol.proj.transform(o,"EPSG:4326","EPSG:3857")),name:i}),s=new ol.style.Style({image:new ol.style.Icon({anchor:[.5,.5],anchorXUnits:"fraction",anchorYUnits:"fraction",src:_townhub_add_ons.marker,crossOrigin:"anonymous"})});l.setStyle(s);var u=new ol.layer.Vector({source:new ol.source.Vector({features:[l]})});new ol.Map({target:n,view:r,pixelRatio:1,layers:[new ol.layer.Tile({preload:3,source:new ol.source.OSM}),u],loadTilesWhileAnimating:!0,interactions:ol.interaction.defaults.defaults({mouseWheelZoom:!1})})}))})),e(document).on("click",".autoplace-clear-input",(function(t){e(".nearby-inputs-wrap").find(".auto-place-loc").length&&e(".nearby-inputs-wrap").find(".auto-place-loc").val(""),e(".nearby-inputs-wrap").find(".nearby-checkbox").length&&e(".nearby-inputs-wrap").find(".nearby-checkbox").prop("checked",!1),e(".nearby-inputs-wrap").children(".auto-place-nearby").length&&e(".nearby-inputs-wrap").children(".auto-place-nearby").val("off"),e(".nearby-inputs-wrap").children(".auto-place-lat").length&&e(".nearby-inputs-wrap").children(".auto-place-lat").val(""),e(".nearby-inputs-wrap").children(".auto-place-lng").length&&e(".nearby-inputs-wrap").children(".auto-place-lng").val("")}))}(jQuery);

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.