a2g_travel_blog/Resources/Public/JavaScript/index.9adfbad3.js
2023-12-04 16:40:27 +01:00

3 lines
15 KiB
JavaScript

var E=Object.defineProperty,G=Object.defineProperties;var U=Object.getOwnPropertyDescriptors;var x=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var P=(e,t,s)=>t in e?E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,O=(e,t)=>{for(var s in t||(t={}))j.call(t,s)&&P(e,s,t[s]);if(x)for(var s of x(t))z.call(t,s)&&P(e,s,t[s]);return e},A=(e,t)=>G(e,U(t));import{F as h,S as f,C as y,a as u,V as g,G as T,b as m,c as w,d as _,P as D,O as V,X as W,T as L,e as N,f as q,g as S,h as Z,i as B,Z as H,M as R,j as X,D as J,p as F,k as K,l as Q,m as Y,I as k,n as $,o as I,q as ee,r as te}from"./vendor.a5ae8db0.js";const se=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function s(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerpolicy&&(a.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?a.credentials="include":r.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(r){if(r.ep)return;r.ep=!0;const a=s(r);fetch(r.href,a)}};se();const o={mapWrapClass:"a2g-map-wrap",mapClass:"a2g-map",convexHullFill:new h({color:"rgba(255, 153, 0, 0.4)"}),convexHullStroke:new f({color:"rgba(204, 85, 0, 1)",width:1}),textFill:new h({color:"#333"}),textStroke:new f({color:"rgba(0, 0, 0, 0.6)",width:0}),innerCircle:new y({radius:14,fill:new h({color:"rgba(255, 165, 0, 0.7)"})}),outerCircle:new y({radius:20,fill:new h({color:"rgba(255, 153, 102, 0.3)"})}),mapWraps:[],maps:[],mapObjects:[],gpx:{mapSources:[],mapLayers:[],gpxSourceDataAttribute:"gpxSource",style:{Point:new u({image:new y({fill:new h({color:"rgba(255,255,0,0.4)"}),radius:5,stroke:new f({color:"#ff0",width:1})})}),LineString:new u({stroke:new f({color:"#f00",width:3})}),MultiLineString:new u({stroke:new f({color:"#0f0",width:3})})},init:function(e){var t=this;o.maps[e].dataset[t.gpxSourceDataAttribute]&&(t.mapSources[e]=new g({url:o.maps[e].dataset[t.gpxSourceDataAttribute],format:new T}),t.mapLayers[e]=new m({source:t.mapSources[e],style:function(s){return t.style[s.getGeometry().getType()]}}),o.layers.mapLayers[e].push(t.mapLayers[e]))}},geolocate:{locateMeDoms:[],checkboxClass:"a2g-map-geolocate-me",geolocations:[],positionFeature:new w,accuracyFeature:new w,mapSources:[],mapLayers:[],setPositionFeatureStyle:function(){this.positionFeature.setStyle(new u({image:new y({radius:6,fill:new h({color:"#3399CC"}),stroke:new f({color:"#fff",width:2})})}))},setMapGeolocations:function(e){var t=this;t.geolocations[e]=new _({trackingOptions:{enableHighAccuracy:!0},projection:o.views[e].getProjection()}),t.geolocations[e].on("change:position",function(){const s=t.geolocations[e].getPosition();t.positionFeature.setGeometry(s?new D(s):null)}),t.geolocations[e].on("change:accuracyGeometry",function(){t.accuracyFeature.setGeometry(t.geolocations[e].getAccuracyGeometry())})},setGeolocateMeAction:function(e){var t=this;t.locateMeDoms[e]=o.mapWraps[e].getElementsByClassName(t.checkboxClass),t.locateMeDoms[e].length>0&&(t.setMapGeolocations(e),t.mapSources[e]=new g({features:[t.accuracyFeature,t.positionFeature]}),t.mapLayers[e]=new m({map:o.mapObjects[e],source:t.mapSources[e]}));for(var s=0;s<t.locateMeDoms[e].length;s++)t.locateMeDoms[e][s].addEventListener("change",function(){t.geolocations[e].setTracking(this.checked);for(var n=0;n<t.locateMeDoms[e].length;n++)t.locateMeDoms[e][n].checked=this.checked;this.checked?t.mapLayers[e].setSource(t.mapSources[e]):t.mapLayers[e].setSource(null)})},init:function(e){this.setPositionFeatureStyle(),this.setGeolocateMeAction(e)}},popup:{class:"a2g-map-popup",contentClass:"a2g-map-popup-content",closerClass:"a2g-map-popup-closer",content:[],closer:[],overlay:[],init:function(e){if(o.mapWraps[e].querySelector("."+o.popup.class)){var t=o.mapWraps[e].querySelector("."+o.popup.class);t.querySelector("."+o.popup.contentClass)&&typeof this.content[e]=="undefined"&&(this.content[e]=t.querySelector("."+o.popup.contentClass)),t.querySelector("."+o.popup.closerClass)&&typeof this.closer[e]=="undefined"&&(this.closer[e]=t.querySelector("."+o.popup.closerClass)),typeof this.overlay[e]=="undefined"&&(this.overlay[e]=new V({element:t,autoPan:{animation:{duration:250}}}),typeof this.closer[e]!="undefined"&&(this.closer[e].onclick=function(){return o.popup.overlay[e].setPosition(void 0),o.popup.closer[e].blur(),!1}))}}},ajaxCall:function(e,t,s){jQuery.ajax({async:"true",url:t,type:"POST",data:s,dataType:"json",success:function(n){typeof e=="function"&&e(n,s)},error:function(n){},done:function(){}})},layers:{mapLayerSources:[],mapLayers:[],mapLayerSelects:[],mapLayerSwitchers:[],mapLayerSwitcherClass:"a2g-map-layer-swipe",mapLayerSelectClass:"a2g-map-layer-select",attributions:'<a href="https://www.altogether.at" target="_blank">&copy; altogether</a>',attributionOpenStreetMap:'<a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap</a>',thunderforest:{a:"your_key_here",baseUrl:"https://tile.thunderforest.com/",baseUrlSufix:"/{z}/{x}/{y}.png?apikey=",getUrl:function(e){return this.baseUrl+e+this.baseUrlSufix+this.a}},maptiler:{a:"your_key_here",baseUrl:"https://api.maptiler.com/maps/",baseUrlSufix:"/{z}/{x}/{y}.png?key=",jpgUrlSufix:"/{z}/{x}/{y}.jpg?key=",getUrl:function(e){return e==="hybrid"||e==="openstreetmap"?this.baseUrl+e+this.jpgUrlSufix+this.a:this.baseUrl+e+this.baseUrlSufix+this.a}},setMapXyzLayer:function(e,t,s){this.mapLayerSources[e][t]=new W(s),this.mapLayers[e][t]=new L({source:this.mapLayerSources[e][t]})},setMapOsmLayer:function(e,t,s){this.mapLayerSources[e][t]=new N(s),this.mapLayers[e][t]=new L({source:this.mapLayerSources[e][t]})},setMapStamenLayer:function(e,t,s){this.mapLayerSources[e][t]=new q(s),this.mapLayers[e][t]=new L({source:this.mapLayerSources[e][t]})},appendToMapLayerSwitcher:function(e,t,s){for(var n=0;n<this.mapLayerSelects[e].length;n++)if(typeof t.label!="undefined"){var r=document.createElement("option");r.text=t.label,r.value=s,typeof t.active!="undefined"&&t.active&&(r.selected=!0),this.mapLayerSelects[e][n].add(r)}else{var r=document.createElement("option");r.text=s,r.value=s,typeof t.active!="undefined"&&t.active&&(r.selected=!0),this.mapLayerSelects[e][n].add(r)}},setLayerSwitcherAction:function(e){for(var t=this,s=0;s<t.mapLayerSelects[e].length;s++)t.mapLayerSelects[e][s].dataset.map=e,t.mapLayerSelects[e][s].addEventListener("change",function(n){for(var r=0;r<t.mapLayerSources[this.dataset.map].length;r++)(typeof t.layerSwitchLayerIds[this.dataset.map]=="undefined"||t.layerSwitchLayerIds[this.dataset.map]!==r)&&t.mapLayers[this.dataset.map][r].setSource(null);t.mapLayers[this.dataset.map][this.value].setSource(t.mapLayerSources[this.dataset.map][this.value]);for(var r=0;r<t.mapLayerSelects[e].length;r++)t.mapLayerSelects[e][r].selectedIndex=this.selectedIndex})},layerSwitchLayerIds:[],init:function(e){var t=this;if(typeof t.mapLayers[e]=="undefined"&&(t.mapLayers[e]=[],t.mapLayerSources[e]=[]),t.mapLayerSelects[e]=o.mapWraps[e].getElementsByClassName(t.mapLayerSelectClass),t.mapLayerSwitchers[e]=o.mapWraps[e].getElementsByClassName(t.mapLayerSwitcherClass),typeof o.maps[e].dataset.mapLayers!="undefined"){for(var s=JSON.parse(o.maps[e].dataset.mapLayers),n=!0,r=0,a=0;a<s.length;a++){if(typeof s[a].layer!=""&&typeof s[a].config=="object")switch(s[a].config.attributions=t.attributions,s[a].layer){case"osm":this.setMapOsmLayer(e,a,s[a].config);break;case"stamen":this.setMapStamenLayer(e,a,s[a].config);break;case"thunderforest":s[a].config.url=t.thunderforest.getUrl(s[a].config.layer),this.setMapXyzLayer(e,a,s[a].config);break;case"maptiler":s[a].config.url=t.maptiler.getUrl(s[a].config.layer),this.setMapXyzLayer(e,a,s[a].config);break}if(typeof s[a].active=="undefined"||!s[a].active)t.mapLayers[e][a].setSource(null);else if(n=!1,r++,typeof t.mapLayerSwitchers[e][0]!="undefined")if(r===2){for(var i=0;i<t.mapLayerSwitchers[e].length;i++)t.mapLayers[e][a].on("prerender",function(c){const l=c.context,p=o.mapObjects[e].getSize(),b=p[0]*(t.mapLayerSwitchers[e][0].value/100),v=S(c,[b,0]),M=S(c,[p[0],0]),d=S(c,[b,p[1]]),C=S(c,p);l.save(),l.beginPath(),l.moveTo(v[0],v[1]),l.lineTo(d[0],d[1]),l.lineTo(C[0],C[1]),l.lineTo(M[0],M[1]),l.closePath(),l.clip()}),t.mapLayerSwitchers[e][i].addEventListener("input",function(){o.mapObjects[e].render()}),t.mapLayerSwitchers[e][i].addEventListener("change",function(){o.mapObjects[e].render()});t.mapLayers[e][a].on("postrender",function(c){c.context.restore()}),t.layerSwitchLayerIds[e]=a}else r>2&&this.mapLayers[e][a].setSource(null);else r>1&&this.mapLayers[e][a].setSource(null);this.appendToMapLayerSwitcher(e,s[a],a)}if(this.setLayerSwitcherAction(e),n){this.mapLayers[e][o.layers.mapLayers[e].length-1].setSource(o.layers.mapLayerSources[e][o.layers.mapLayerSources[e].length-1]);for(var a=0;a<this.mapLayerSelects[e].length;a++)this.mapLayerSelects[e][a].selectedIndex=o.layers.mapLayers[e].length-1}}}},views:[],controls:[],zoomSliderDataAttribute:"zoomSlider",setMapObject:function(e){var t=this;t.views[e]=new Z({center:[typeof t.maps[e].dataset.centerLon!="number"?0:t.maps[e].dataset.centerLon,typeof t.maps[e].dataset.centerLat!="number"?0:t.maps[e].dataset.centerLat],zoom:typeof t.maps[e].dataset.zoom=="undefined"?1:t.maps[e].dataset.zoom,maxZoom:typeof t.maps[e].dataset.maxZoom=="undefined"?18:t.maps[e].dataset.maxZoom,showFullExtent:!0}),t.controls[e]=[new B],t.maps[e].dataset[t.zoomSliderDataAttribute]&&t.maps[e].dataset[t.zoomSliderDataAttribute]==="true"&&t.controls[e].push(new H),t.mapObjects[e]=new R({layers:t.layers.mapLayers[e],interactions:X({dragPan:!1,mouseWheelZoom:!1}).extend([new J({condition:function(s){return this.getPointerCount()===2||F(s)}}),new K({condition:F})]),controls:Q().extend(t.controls[e]),target:t.maps[e],overlays:[t.popup.overlay[e]],view:t.views[e]})},setMapClickAction:function(e){o.mapObjects[e].on("click",t=>{o.marker.layers.mapClusters[e].getFeatures(t.pixel).then(s=>{if(s.length>0){const n=s[0].get("features");if(n.length>1){const r=te();n.forEach(c=>Y(r,c.getGeometry().getExtent()));const a=o.mapObjects[e].getView(),i=o.mapObjects[e].getView().getResolution();a.getZoom()===a.getMaxZoom()?(clickFeature=s[0],clickResolution=i,o.marker.layers.mapClusterCircles[e].setStyle(o.marker.layers.clusterCircleStyle)):a.fit(r,{duration:500,padding:[50,50,50,50]})}else o.popup.content[e].innerHTML=n[0].values_.popup,o.popup.overlay[e].setPosition(n[0].getGeometry().getCoordinates())}})})},marker:{markerSwitcherClass:"a2g-map-marker-visible-switcher",markerSwitchers:[],setMarkerSwitcherAction:function(e){var t=this;t.markerSwitchers[e]=o.mapWraps[e].getElementsByClassName(this.markerSwitcherClass);for(var s=0;s<t.markerSwitchers[e].length;s++)t.markerSwitchers[e][s].addEventListener("change",function(n){this.checked?(t.layers.mapClusters[e].setSource(null),t.layers.mapClusterCircles[e].setSource(null)):(t.layers.mapClusters[e].setSource(t.layers.mapClusterSources[e]),t.layers.mapClusterCircles[e].setSource(t.layers.mapClusterSources[e]));for(var r=0;r<t.markerSwitchers[e].length;r++)t.markerSwitchers[e][r].checked=this.checked})},icons:{costumIconsDataTag:"icons",costumIconsUrlTag:"iconsUrl",costumIconsId:"a2g-costum-icons",defaulMarkerIcon:"/typo3conf/ext/a2g_travel_blog/Resources/Public/Icons/Marker/markerSolid.svg",defaultMarkerIconDataAttribute:"defaultMarkerIcon",costumIcons:[],mapIcons:[],defaultIcons:[],fillCostumIconsHelper:function(e,t){o.maps[t].hasAttribute("data-"+this.defaultMarkerIconDataAttribute)?this.defaultIcons[t]=new k({src:o.maps[t].getAttribute("data-"+this.defaultMarkerIconDataAttribute)}):this.defaultIcons[t]=new k({src:this.defaulMarkerIcon});for(let s=0;s<e.length;s++)typeof e[s].uid!="undefined"&&typeof this.costumIcons[e[s].uid]=="undefined"&&(typeof e[s].icon=="undefined"?this.costumIcons[e[s].uid]=null:this.costumIcons[e[s].uid]=new k({src:e[s].icon}))},fillCostumIcons:function(e){document.getElementById(this.costumIconsId)&&this.fillCostumIconsHelper(JSON.parse(document.getElementById(this.costumIconsId).dataset.content),e)},clusterMemberStyle:function(e){return typeof e.get("icon")=="undefined"||typeof this.costumIcons[e.get("icon")]=="undefined"?new u({geometry:e.getGeometry(),image:this.defaultIcons[0]}):new u({geometry:e.getGeometry(),image:this.costumIcons[e.get("icon")]})}},layers:{clusterDistance:35,circleDistanceMultiplier:1,circleFootSeparation:28,circleStartAngle:Math.PI/2,mapClusterSources:[],mapVectorSources:[],mapClusters:[],mapClusterCircles:[],generatePointsCircle:function(e,t,s){let r=this.circleDistanceMultiplier*this.circleFootSeparation*(2+e)/(Math.PI*2);const a=Math.PI*2/e,i=[];let c;r=Math.max(r,45)*s;for(let l=0;l<e;++l)c=this.circleStartAngle+l*a,i.push([t[0]+r*Math.cos(c),t[1]+r*Math.sin(c)]);return i},clusterStyle:function(e){const t=e.get("features").length;return t>1?[new u({image:o.outerCircle}),new u({image:o.innerCircle,text:new $({text:t.toString(),fill:o.textFill,stroke:o.textStroke})})]:o.marker.icons.clusterMemberStyle(e.get("features")[0])},clusterCircleStyle:function(e,t){if(e!==o.clickFeature||t!==o.clickResolution)return;const s=e.get("features");return e.getGeometry().getCoordinates(),o.marker.layers.generatePointsCircle(s.length,e.getGeometry().getCoordinates(),t).reduce((n,r,a)=>{const i=new D(r);return n.push(o.marker.icons.clusterMemberStyle(new w(A(O({},s[a].getProperties()),{geometry:i})))),n},[])},setMapMarkerLayer:function(e){typeof this.mapVectorSources[e]=="undefined"&&(o.maps[e].hasAttribute("data-marker-source")?this.mapVectorSources[e]=new g({format:new I,url:o.maps[e].dataset.markerSource}):this.mapVectorSources[e]=null),typeof this.mapClusterSources[e]=="undefined"&&this.mapVectorSources[e]!==null&&(this.mapClusterSources[e]=new ee({distance:this.clusterDistance,source:this.mapVectorSources[e]})),typeof this.mapClusters[e]=="undefined"&&typeof this.mapClusterSources[e]=="object"&&(this.mapClusters[e]=new m({source:this.mapClusterSources[e],style:this.clusterStyle})),typeof this.mapClusterCircles[e]=="undefined"&&typeof this.mapClusterSources[e]=="object"&&(this.mapClusterCircles[e]=new m({source:this.mapClusterSources[e],style:this.clusterCircleStyle})),this.mapVectorSources[e]!==null&&(o.layers.mapLayers[e].push(this.mapClusters[e]),o.layers.mapLayers[e].push(this.mapClusterCircles[e]))}}},clickFeature:null,clickResolution:null,init:function(){var e=document.getElementsByClassName(this.mapWrapClass);for(let t=0;t<e.length;t++)e[t].querySelector("."+this.mapClass),this.mapWraps[t]=e[t],this.maps[t]=this.mapWraps[t].querySelector("."+this.mapClass),this.layers.init(t),this.marker.icons.fillCostumIcons(t),this.marker.layers.setMapMarkerLayer(t),this.popup.init(t),this.gpx.init(t),this.setMapObject(t),this.setMapClickAction(t),this.geolocate.init(t),this.marker.setMarkerSwitcherAction(t)}};o.init();
//# sourceMappingURL=index.9adfbad3.js.map