function mapClickSim(m,i){new bootstrap.Modal(document.getElementById('contentMapModal_'+m)).show();function w(){if(window.contentMaps[m]!==undefined&&typeof toggleMapIconClick==="function"&&typeof resetMarkersAndCards==="function"){resetMarkersAndCards(m);setTimeout(()=>{toggleMapIconClick(m,i,true);},500);}else{setTimeout(w,100);}} w();} function handleActionClick(e){const target=e.target.closest('[data-action]');if(!target)return;const{action,actionArgs}=target.dataset;const fn={mapClickSim}[action];fn&&fn(...actionArgs.split(',').map(Number));} if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',()=>{document.querySelectorAll('[data-action]').forEach(b=>b.addEventListener('click',handleActionClick));});}else{document.querySelectorAll('[data-action]').forEach(b=>b.addEventListener('click',handleActionClick));}function genImgContent(p,m){p=JSON.parse(p);if(Array.isArray(p[0])){let d='carousel'+Math.random().toString(36).substr(2,9);b='';for(let i=0;i`;} let c=``;return c;}else{return genImg(p,m);}} function genImg(p,m){var c=m?'w-100 h-100 object-fit-cover':'img-fluid w-100';var a=p[0];var u=`https://cdn.lazytrips.com/photos/`+a.slice(0,2)+'/'+a.slice(2,4)+'/'+a;var r=``+p[1]+``;return r;} function getNewLngLat(m,o,f){var p=m.project(new mapboxgl.LngLat(o[0],o[1]));p.x+=f.x;p.y+=f.y;return m.unproject(p);} function onMapZoom(m){if(contentMaps[m]){contentMaps[m].on('zoom',function(){Object.keys(markerData[m]).forEach(function(i){var p=markerData[m][i];if(!mDev()&&p.cardInstance){var o={x:p.c.card.oX,y:p.c.card.oY};var n=getNewLngLat(contentMaps[m],p.lonLat,o);p.cardInstance.setLngLat([n.lng,n.lat]);}});});}} async function fetchRoute(d,m,i,c){const p={routeId:d};const r=await fetch('/api/request-route',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(p)});if(r.ok){const j=await r.json();if(j.response&&j.response.route){const d=JSON.parse(j.response.route);markerData[m][i].c.route.json=d;updateMapWithRoute(m,i,d,c);}}} function updateMapWithRoute(m,i,r,c){const l='iconRoute_'+m+'_'+i;const g={type:'Feature',properties:{},geometry:{type:'LineString',coordinates:r}};if(contentMaps[m].getLayer(l)){contentMaps[m].setLayoutProperty(l,'visibility','visible');contentMaps[m].getSource(l).setData(g);}else{contentMaps[m].addLayer({id:l,type:'line',source:{type:'geojson',data:g},layout:{'line-join':'round','line-cap':'round'},paint:{'line-color':c,'line-width':5,'line-opacity':0.8}});}} function hideRouteLayer(m,i){const l='iconRoute_'+m+'_'+i;if(contentMaps[m].getLayer(l)){contentMaps[m].setLayoutProperty(l,'visibility','none');}} window.toggleMapIconClick=function(m,i,e=true){if(markerData[m][i].a){return;} for(const[key,icon]of Object.entries(markerData[m])){if(parseInt(key)===i){continue;} if(icon.popupInstance){icon.popupInstance.remove();delete icon.popupInstance;} if(icon.c?.route&&contentMaps[m].getLayer('iconRoute_'+m+'_'+key)){hideRouteLayer(m,key);} if(icon.marker){icon.marker.getElement().classList.remove('markerSpanSelect');} if(icon.cardInstance){icon.cardInstance.remove();delete icon.cardInstance;} if(icon.cardOverlay){var o=icon.cardOverlay;if(o&&o.parentNode){o.parentNode.removeChild(o);delete icon.cardOverlay;}} icon.a=false;} if(!markerData[m][i].a){markerData[m][i].marker.getElement().classList.add('markerSpanSelect');if(markerData[m][i].c?.popup){const t=markerData[m][i].c.popup.title;const p=markerData[m][i].c.popup.text;let popupHTML='
';if(t){popupHTML+='

'+t+'

';} if(p){popupHTML+='

'+p+'

';} popupHTML+='
';var popup=new mapboxgl.Popup({anchor:'bottom',closeButton:false,closeOnClick:false,className:'pointer'}).setLngLat(markerData[m][i].lonLat).setHTML(popupHTML).addTo(contentMaps[m]);markerData[m][i].popupInstance=popup;popup._content.addEventListener('click',function(){toggleMapIconClick(m,i);});markerData[m][i].marker.getElement().style.display='none';} if(markerData[m][i].c?.route){const layerId='iconRoute_'+m+'_'+i;if(contentMaps[m].getLayer(layerId)){contentMaps[m].setLayoutProperty(layerId,'visibility','visible');}else{fetchRoute(markerData[m][i].c.route.id,m,i,markerData[m][i].c.route.color);}} if(markerData[m][i].c?.card){var cardContent={n:markerData[m][i].c.card.title,d:markerData[m][i].c.card.d,t:markerData[m][i].c.card.t,p:markerData[m][i].c.card.p,};if(markerData[m][i].c.card.hasOwnProperty('link')){cardContent.l=markerData[m][i].c.card.link;} if(markerData[m][i].c.card.hasOwnProperty('linkText')){cardContent.s=markerData[m][i].c.card.linkText;} if(!mDev()){var cardContentHtml=createCardContentHtml(cardContent,false);var offsets={x:markerData[m][i].c.card.oX,y:markerData[m][i].c.card.oY};var newLngLat=getNewLngLat(contentMaps[m],markerData[m][i]['lonLat'],offsets);var cardPopup=new mapboxgl.Popup({anchor:'bottom',closeButton:false,closeOnClick:false,className:'mapPopupCard'}).setHTML(cardContentHtml).setLngLat([newLngLat.lng,newLngLat.lat]).addTo(contentMaps[m]);markerData[m][i].cardInstance=cardPopup;setTimeout(()=>{if(markerData[m][i].cardInstance&&markerData[m][i].cardInstance.isOpen()){markerData[m][i].c.card.height=markerData[m][i].cardInstance.getElement().offsetHeight;}},10);}else{var cardMobile=document.createElement('div');cardMobile.className='mapPopupCardMobile';cardMobile.innerHTML=createCardContentHtml(cardContent,true);var mapContainer=contentMaps[m].getContainer();mapContainer.appendChild(cardMobile);markerData[m][i].cardOverlay=cardMobile;}} markerData[m][i].a=true;if(e){updateMapBounds(m,i);}}else{resetMarkersAndCards(m);}} window.resetMarkersAndCards=function(m){Object.keys(markerData[m]).forEach((i)=>{if(markerData[m][i].marker){markerData[m][i].marker.getElement().classList.remove('markerSpanSelect');} if(markerData[m][i].popupInstance){markerData[m][i].popupInstance.remove();delete markerData[m][i].popupInstance;} if(markerData[m][i].c&&markerData[m][i].c.route){if(contentMaps[m].getLayer('iconRoute_'+m+'_'+i)){hideRouteLayer(m,i);}} if(markerData[m][i].c&&markerData[m][i].c.card){if(markerData[m][i].cardInstance){markerData[m][i].cardInstance.remove();delete markerData[m][i].cardInstance;}} if(markerData[m][i].cardOverlay){var o=markerData[m][i].cardOverlay;if(o&&o.parentNode){o.parentNode.removeChild(o);delete markerData[m][i].cardOverlay;}} markerData[m][i].marker.getElement().style.display='block';markerData[m][i].a=false;});} function formatTime(t){const h=Math.floor(t / 60);const m=t%60;return`⏱️ ${h > 0 ? h + " hour" + (h > 1 ? "s" : "") : ""}${h > 0 && m > 0 ? ", " : ""}${m > 0 ? m + " minute" + (m > 1 ? "s" : "") : ""}`;} function createCardContentHtml(c,m){cC='';if(m){cC=' d-flex flex-row';} let h='
';if(c.p){p=genImgContent(c.p,m);h+='
'+p+'
';} if(c.n||c.d||c.t||c.l){h+='
';if(c.n){h+='
'+c.n+'
';} if(c.d){h+='
';} if(c.d){h+='
🚗 '+c.d+'
';} if(c.t){h+='
'+formatTime(c.t)+'
';} if(!m){h+='
';} if(c.l){var z=c.s||'Read more';p='';if(m){p=' pt-2';} h+='';}} if(m){h+='
';} h+='
';return h;} document.addEventListener('shown.bs.modal',function(e){if(e.target.id.startsWith('contentMapModal_')){let m=e.target.id.replace('contentMapModal_','');let t=window.contentMaps[m];if(t){setTimeout(()=>{e.target.style.borderBottom='1px solid #eee';setTimeout(()=>{e.target.style.borderBottom='';},1);},1);}}});window.addEventListener('resize',function(){document.querySelectorAll('[id^="contentMapModal_"]').forEach(p=>{if(p.classList.contains('show')){let m=p.id.replace('contentMapModal_','');let t=window.contentMaps[m];if(t){setTimeout(()=>{t.style.borderBottom='1px solid #eee';setTimeout(()=>{t.style.borderBottom='';},1);},1);}}});});function mDev(){return window.innerWidth<=768||window.innerHeight<=600;} async function updateMapBounds(m,n){const map=contentMaps[m];const oldBounds=contentMaps[m].getBounds();var T=contentMaps[m].getBounds();const D=contentMaps[m].getContainer().getBoundingClientRect();const x=markerData[m][n];const lngDiff=oldBounds.getNorthEast().lng-oldBounds.getSouthWest().lng;const latDiff=oldBounds.getNorthEast().lat-oldBounds.getSouthWest().lat;const lngPerPx=lngDiff / D.width;const latPerPx=latDiff / D.height;const U=[];var B=new mapboxgl.LngLatBounds(T.toArray());var R=new mapboxgl.LngLatBounds(T.toArray());if(!mDev()&&markerData[m][n].c.card&&markerData[m][n].a){const cP=new Promise(async(resolve)=>{const h=await new Promise(resolveHeight=>{const hInt=setInterval(()=>{let chk=markerData[m][n].c.card.height;if(chk){clearInterval(hInt);resolveHeight(chk);}},100);});const w=300;var p=15;const z=contentMaps[m].getZoom();var a=0;if(z<7){a=(8-z)*10;} const oX=markerData[m][n].c.card.oX;const oY=markerData[m][n].c.card.oY;const P=map.project(new mapboxgl.LngLat(x.lonLat[0],x.lonLat[1]));const tG=P.y+oY-h if(tG{const jR=await new Promise(resolve=>{const intervalId=setInterval(()=>{if(x.c.route.json&&Array.isArray(x.c.route.json)&&x.c.route.json.length>0){clearInterval(intervalId);resolve(true);}},100);});if(jR){const paddingRoutePixels=20;let extendWest=false,extendEast=false,extendNorth=false,extendSouth=false;x.c.route.json.forEach(coord=>{if(coord[0]R.getEast())extendEast=true;if(coord[1]>R.getNorth())extendNorth=true;if(coord[1]status)){T.extend(B.getSouthWest());T.extend(B.getNorthEast());T.extend(R.getSouthWest());T.extend(R.getNorthEast());map.fitBounds(T,{padding:0,duration:600,easing:(t)=>t*(2-t)});}}const markerConfig={'finish':{className:'marker_finish',size:[58,58],offset:[0,-29],span:false,best:false,text:false,},'start':{className:'marker_start',size:[58,58],offset:[0,-29],span:false,best:false,text:false,},'star':{className:'marker_star',size:[58,58],offset:[0,-29],span:false,best:false,text:false,},'numbered':{className:'mapMarkerNum',size:false,offset:[0,0],span:true,best:true,text:false,},'star-plain':{className:'mapMarkerNum markerSpanRed',size:false,offset:[0,0],span:true,best:false,text:'☆',},'grey':{className:'mapMarkerNum markerSpanGrey',size:false,offset:[0,0],span:true,best:false,text:false,},};function addMarkersToMap(m,f=null){Object.values(markerData[m]).forEach((i,n)=>{if(f!==null&&n'+t+'';} if(mC.width&&mC.height){el.style.width=mC.width+'px';el.style.height=mC.height+'px';} var marker=new mapboxgl.Marker(el,{offset:mC.offset}).setLngLat(i.lonLat).addTo(window.contentMaps[m]);marker.markerType=i.iconType;if(f!==null){} i.marker=marker;window.bounds[m].extend(i.lonLat);if(i.c){marker.getElement().addEventListener('click',function(){event.stopPropagation();toggleMapIconClick(m,n,true);});}});}if(typeof window.contentMaps==='undefined'){window.contentMaps={};window.initialMapBounds={};} if(typeof window.bounds==='undefined'){window.bounds={};} if(typeof window.markerData==='undefined'){window.markerData={};} if(!markerData[1]){markerData[1]={};} function initMapbox_1(){mapboxgl.accessToken='pk.eyJ1IjoibGF6eXRyaXBzIiwiYSI6ImNsaTJ4anh2MTA5NDYzZW85ODJmMm45ZzcifQ.9u5pN47V7SsoFwF6_Pw5bQ';const contentMap_1=new mapboxgl.Map({container:'contentMap_1',style:'mapbox://styles/mapbox/streets-v11',center:[-98.49460961196311,29.425198498224123],zoom:5,cooperativeGestures:false});window.contentMaps[1]=contentMap_1;if(typeof window.bounds[1]==='undefined'){window.bounds[1]=new mapboxgl.LngLatBounds();} markerData[1][0]={"lonLat":[-98.49460961196311,29.425198498224123],"type":"star-plain"};markerData[1][1]={"lonLat":[-97.74317,30.267144],"best":1,"time":150,"distance":120,"type":"numbered","c":{"route":{"id":402,"color":"#fa5050"},"card":{"title":"Austin","d":"120 miles","t":150,"p":"[\"7d39a74d31f0e082af32a70da612ca3f\",\"Austin, Texas, USA with the city skyline in the evening and blue hour taken as a panoramic shot.\"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-san-antonio-to-austin","linkText":"Read more"}}};markerData[1][2]={"lonLat":[-97.14679424740945,31.5495903320899],"best":2,"time":180,"distance":190,"type":"numbered","c":{"route":{"id":2648,"color":"#fa5050"},"card":{"title":"Waco","d":"190 miles","t":180,"p":"[\"5cba71529de891dbd15d9276a130eb25\",\"Waco's Dr Pepper Museum in the Artesian Manufacturing and Bottling Company building.\"]","oX":175,"oY":0}}};markerData[1][3]={"lonLat":[-97.418686,27.785128],"best":3,"time":480,"distance":470,"type":"numbered","c":{"route":{"id":295,"color":"#fa5050"},"card":{"title":"Corpus Christi","d":"470 miles","t":480,"p":"[\"00b1506c9a955e7826fad9f7c610c620\",\"Corpus Christi, in Texas, on the seawall overlooking the marina with some boats docket at sunset\"]","oX":-175,"oY":0,"link":"\/trip\/road-trip-from-san-antonio-to-corpus-christi","linkText":"Read more"}}};markerData[1][4]={"lonLat":[-94.90702381717267,29.240180916125116],"best":4,"time":240,"distance":250,"type":"numbered","c":{"route":{"id":2649,"color":"#fa5050"},"card":{"title":"Houston and Galveston Island","d":"250 miles","t":240,"p":"[\"113b780c38f597ccffa4e1ede5c88ff7\",\"Galveston, Texas, USA with a view of the beach umbrellas and Pleasure Pier amusement park in the distance against a blue sky. \"]","oX":175,"oY":0}}};markerData[1][5]={"lonLat":[-96.79825320519372,32.77557765829934],"best":5,"time":250,"distance":285,"type":"numbered","c":{"route":{"id":2650,"color":"#fa5050"},"card":{"title":"Dallas","d":"285 miles","t":250,"p":"[\"9f61ee54ee44ec4ecc5c9396aabd5235\",\"Dallas, Texas, USA downtown city skyline at night with the skyscrapers reflecting in the water in the foreground.\"]","oX":175,"oY":0}}};markerData[1][6]={"lonLat":[-97.16922289502685,26.111238225000186],"best":6,"time":270,"distance":300,"type":"numbered","c":{"route":{"id":2651,"color":"#fa5050"},"card":{"title":"South Padre Island","d":"300 miles","t":270,"p":"[\"8e915e832ce04028426b3bb26d0c70d2\",\"A beautiful soft and fine sandy beach along the gulf coast of South Padre Island, Texas\"]","oX":175,"oY":0}}};markerData[1][7]={"lonLat":[-104.0212137999212,30.30946328793695],"best":7,"time":350,"distance":400,"type":"numbered","c":{"route":{"id":2652,"color":"#fa5050"},"card":{"title":"Marfa","d":"400 miles","t":350,"p":"[\"b71887284a2db93ca492f9ff818fe32f\",\"Marfa bus stop with famous Marfa water tower in the background on a sunny day.\"]","oX":-175,"oY":0}}};markerData[1][8]={"lonLat":[-93.98046254174541,32.74157695512754],"best":8,"time":430,"distance":460,"type":"numbered","c":{"route":{"id":2653,"color":"#fa5050"},"card":{"title":"Caddo Lake","d":"460 miles","t":430,"p":"[\"ddcbac36b4ba9bcde0462b0f8dffb634\",\"Canoeing on Saw Mill Pond at Caddo Lake State Park in Texas\"]","oX":175,"oY":0}}};markerData[1][9]={"lonLat":[-103.16067386537429,29.67709036280049],"best":9,"time":350,"distance":410,"type":"numbered","c":{"route":{"id":2655,"color":"#fa5050"},"card":{"title":"Big Bend National Park","d":"410 miles","t":350,"p":"[\"2386b54b296bab190a8ca37be0b05797\",\"Santa Elena Canyon and Rio Grande river at Big Bend National Park\"]","oX":-175,"oY":0}}};markerData[1][10]={"lonLat":[-101.83256333482947,35.22231513098199],"best":10,"time":455,"distance":510,"type":"numbered","c":{"route":{"id":2656,"color":"#fa5050"},"card":{"title":"Amarillo","d":"510 miles","t":455,"p":"[\"0f41a56137a549b33859241cfbea7f61\",\"The Cadillac Ranch at Amarillo Texas\"]","oX":-175,"oY":0}}};markerData[1][11]={"lonLat":[-90.006214,29.948628],"best":11,"time":540,"distance":590,"type":"numbered","c":{"route":{"id":527,"color":"#fa5050"},"card":{"title":"New Orleans","d":"590 miles","t":540,"p":"[\"bab8f5715eded2da628be9c254936f8c\",\"Street performers playing blue grass style music in the French Quarter district in New Orleans on a sunny day\"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-san-antonio-to-new-orleans","linkText":"Read more"}}};markerData[1][12]={"lonLat":[-106.6523041742604,35.08782851906017],"best":12,"time":650,"distance":720,"type":"numbered","c":{"route":{"id":2657,"color":"#fa5050"},"card":{"title":"Albuquerque","d":"720 miles","t":650,"p":"[\"1c14b3428b0a71e2f4de25dcb13e926c\",\"The sun beats down on the adobe style buildings in Poco Apoco Plaza in the historic Old Town section of Albuquerque, New Mexico.\"]","oX":-175,"oY":0}}};markerData[1][13]={"lonLat":[-105.94380379070927,35.7014821380807],"best":13,"time":650,"distance":700,"type":"numbered","c":{"route":{"id":2658,"color":"#fa5050"},"card":{"title":"Santa Fe","d":"700 miles","t":650,"p":"[\"70020cc83cfdf0eece395a4b6c7cec8e\",\"Candles are lit up on ledges around a traditional southern style building after dark\"]","oX":-175,"oY":0}}};markerData[1][14]={"lonLat":[-104.98793402694429,39.738865588146474],"best":14,"time":860,"distance":930,"type":"numbered","c":{"route":{"id":2659,"color":"#fa5050"},"card":{"title":"Denver","d":"930 miles","t":860,"p":"[\"18af6ddd6ed4107598e43f77ae586149\",\"City park green spaces circle pattern monument aerial drone view high above Denver , Colorado\"]","oX":-175,"oY":0}}};markerData[1][15]={"lonLat":[-106.490174,31.759765],"best":15,"time":690,"distance":680,"type":"numbered","c":{"route":{"id":60,"color":"#fa5050"},"card":{"title":"El Paso","d":"680 miles","t":690,"p":"[\"9a24fcfd10cf8307e2cd6afb8bbe6bc8\",\"El Paso, Texas, USA downtown city skyline at dusk with Juarez, Mexico in the distance.\"]","oX":-175,"oY":0,"link":"\/trip\/road-trip-from-san-antonio-to-el-paso","linkText":"Read more"}}};markerData[1][16]={"lonLat":[-93.75088651573945,32.52474594953059],"best":16,"time":400,"distance":430,"type":"numbered","c":{"route":{"id":2654,"color":"#fa5050"},"card":{"title":"Shreveport","d":"430 miles","t":400,"p":"[\"68ef35948af63a446dd07de1b07fb986\",\"Shreveport, Louisiana showing the downtown skyline in the distance, and a metal bridge crossing the Red River in the foreground at sunset.\"]","oX":175,"oY":0}}};markerData[1][17]={"lonLat":[-98.8723666648707,30.275425964520263],"best":17,"time":70,"distance":70,"type":"numbered","c":{"route":{"id":2642,"color":"#fa5050"},"card":{"title":"Fredericksburg","d":"70 miles","t":70,"p":"[\"304194041dcfed0e6059016a88ba0b9e\",\"Beautiful Pioneer Memorial Library in Fredericksburg, Texas, situated in a green garden, surrounded by trees on a sunny day\"]","oX":-175,"oY":0}}};markerData[1][18]={"lonLat":[-98.09874515358173,29.99796182284591],"best":18,"time":70,"distance":60,"type":"numbered","c":{"route":{"id":2641,"color":"#fa5050"},"card":{"title":"Wimberley","d":"60 miles","t":70,"p":"[\"be0dbfc6dd2163afbfa44608be242593\",\"Colorful shop with art and artificial plants and an old pickup truck in Wimberley, Texas.\"]","oX":-175,"oY":-60}}};markerData[1][19]={"lonLat":[-98.25780706267277,30.30841927163648],"best":19,"time":90,"distance":75,"type":"numbered","c":{"route":{"id":2644,"color":"#fa5050"},"card":{"title":"Pedernales Falls State Park","d":"75 miles","t":90,"p":"[\"b70610bcf80fc8777de8f5bb82138c07\",\"Sunset image over rocks, clear waters and sand with trees in the background\"]","oX":175,"oY":0}}};markerData[1][20]={"lonLat":[-99.07393242849558,29.727262657075837],"best":20,"time":60,"distance":50,"type":"numbered","c":{"route":{"id":2640,"color":"#fa5050"},"card":{"title":"Bandera","d":"50 miles","t":60,"p":"[\"02935801b96732bd10c364f8b281be7f\",\"Motorbikes parked in front of a BBQ joint\"]","oX":-175,"oY":0}}};markerData[1][21]={"lonLat":[-97.67157754123815,29.885990019608194],"best":21,"time":70,"distance":70,"type":"numbered","c":{"route":{"id":2643,"color":"#fa5050"},"card":{"title":"Lockhart","d":"70 miles","t":70,"p":"[\"90e5537843e2d9a66320c8e9cb4cf43c\",\"The Beautiful and Ornate Caldwell County Courthouse in Lockhart, Texas. Built in 1894.\"]","oX":175,"oY":0}}};markerData[1][22]={"lonLat":[-99.74874610880238,29.60441053271894],"best":22,"time":95,"distance":90,"type":"numbered","c":{"route":{"id":2646,"color":"#fa5050"},"card":{"title":"Garner State Park","d":"90 miles","t":95,"p":"[\"219651c9531df5ca28495a0657ab7771\",\"Beautiful Bright Orange Autumn Foliage Surrounding the Emerald Green Clear Frio River, at Garner State Park, Texas.\"]","oX":-175,"oY":0}}};markerData[1][23]={"lonLat":[-98.73214937212029,29.794523947884596],"best":23,"time":35,"distance":30,"type":"numbered","c":{"route":{"id":2664,"color":"#fa5050"},"card":{"title":"Boerne","d":"30 miles","t":35,"p":"[\"f7ab0252c089eaaefd0507ba19816c70\",\"Bronze statue of Wild Bill sitting on a bench\"]","oX":-175,"oY":0}}};markerData[1][24]={"lonLat":[-98.12379187570716,29.702507627048288],"best":24,"time":40,"distance":35,"type":"numbered","c":{"route":{"id":2665,"color":"#fa5050"},"card":{"title":"New Braunfels","d":"35 miles","t":40,"p":"[\"2f35065f18c34ba1e61da8fc007cdc35\",\"Guadalupe River New Braunfels, Texas\"]","oX":175,"oY":0}}};markerData[1][25]={"lonLat":[-98.08684403023177,30.18990889973012],"best":25,"time":80,"distance":75,"type":"numbered","c":{"route":{"id":2666,"color":"#fa5050"},"card":{"title":"Dripping Springs","d":"75 miles","t":80,"p":"[\"d01934cf49daede31699eb321b1e36ae\",\"Swimmers enjoying the blue waters of Hamilton Pool in Dripping Springs, Texas\"]","oX":175,"oY":0}}};markerData[1][26]={"lonLat":[-97.17080662768213,29.428928584159774],"best":26,"time":90,"distance":90,"type":"numbered","c":{"route":{"id":2667,"color":"#fa5050"},"card":{"title":"Shiner","d":"90 miles","t":90,"p":"[\"eda8bd507137a0ca105825a47155ca3e\",\"White exterior of Spoetzl Brewery on a sunny day\"]","oX":175,"oY":0}}};initialMapBounds[1]=new mapboxgl.LngLatBounds(window.bounds[1].getSouthWest(),window.bounds[1].getNorthEast());const visibleMapRoutes_1=[];contentMaps[1].on('click',(e)=>{resetMarkersAndCards(1);});markerData[1][31]={"lonLat":[-104.814445,38.838762],"time":990,"distance":1030,"type":"grey","c":{"route":{"id":633,"color":"#fa5050"},"card":{"title":"Colorado Springs","d":"1,030 miles","t":990,"p":"[\"bc98a10f275320ebf58ea00f04b1ac02\",\"South Gateway Rock formation framed by twisted Juniper Trees at the Garden of the Gods Park in Colorado Springs, Colorado, USA.\"]","oX":-175,"oY":-60,"link":"\/trip\/road-trip-from-san-antonio-to-colorado-springs","linkText":"Read more"}}};markerData[1][27]={"lonLat":[-112.116879,36.131207],"time":1020,"distance":1130,"type":"grey","c":{"route":{"id":886,"color":"#fa5050"},"card":{"title":"Grand Canyon National Park","d":"1,130 miles","t":1020,"p":"[\"62b57d20fcebbfaf085b6095e4c389ec\",\"Havasu Falls, waterfalls in the Grand Canyon, Arizona\"]","oX":-175,"oY":0,"link":"\/trip\/road-trip-from-san-antonio-to-grand-canyon-national-park","linkText":"Read more"}}};markerData[1][28]={"lonLat":[-115.143953,36.179944],"time":1160,"distance":1300,"type":"grey","c":{"route":{"id":937,"color":"#fa5050"},"card":{"title":"Las Vegas","d":"1,300 miles","t":1160,"p":"[\"2b4512c4e8bbc154cb1df0e1f644f6c2\",\"Las Vegas, Nevada, USA skyline over the strip at dusk.\"]","oX":-175,"oY":0,"link":"\/trip\/road-trip-from-san-antonio-to-las-vegas","linkText":"Read more"}}};markerData[1][29]={"lonLat":[-81.41289141802646,28.44427255266749],"time":1395,"distance":1400,"type":"grey","c":{"route":{"id":2660,"color":"#fa5050"},"card":{"title":"Orlando","d":"1,400 miles","t":1395,"p":"[\"0d2151513ce3f1893cb87cdb49e79e44\",\"Orlando, Florida, USA at Universal studios city walk with a view of the Lighthouse, entrance to Islands of Adventure.\"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-san-antonio-to-orlando-florida","linkText":"Read more"}}};markerData[1][30]={"lonLat":[-118.20898192454898,34.082625557320725],"time":1620,"distance":1700,"type":"grey","c":{"route":{"id":2662,"color":"#fa5050"},"card":{"title":"Los Angeles","d":"1,700 miles","t":1620,"p":"[\"9aef2fc0abc03f7b7776b1e48e387cd7\",\"View of the TCL Chinese Theatre and the stars on Hollywood Boulevard, LA\"]","oX":-175,"oY":0,"link":"\/trip\/road-trip-from-san-antonio-to-los-angeles","linkText":"Read more"}}};addMarkersToMap(1);contentMap_1.fitBounds(window.bounds[1],{padding:{top:60,bottom:60,left:60,right:60}});const sortByValue=document.querySelector('.cardListSortDropdown').value;sortMapMarkers(markerData,sortOptionsMap,sortByValue,1);}const sortOptionsMap={'best':'best','distance':'distanceSort',};function sortMapMarkers(markerData,sortOptionsMap,sortBy,listNum){const markersWithDistance=Object.values(markerData[listNum]).filter(marker=>marker.hasOwnProperty('distance')&&marker.hasOwnProperty('best'));const hasDistanceSort=markersWithDistance.some(marker=>marker.hasOwnProperty('distanceSort'));if(!hasDistanceSort){const sortedMarkers=markersWithDistance.sort((a,b)=>a.distance-b.distance);sortedMarkers.forEach((sortedMarker,index)=>{sortedMarker.distanceSort=index+1;});} Object.keys(markerData[listNum]).forEach(n=>{const marker=markerData[listNum][n];if(marker.hasOwnProperty('distance')&&marker.hasOwnProperty('best')){const markerElement=document.getElementById('markerSpan-'+listNum+'-'+n);if(markerElement){const propertyToUse=sortOptionsMap[sortBy]||sortBy;const v=marker[propertyToUse];if(v!==undefined){markerElement.innerHTML=v;}else{markerElement.innerHTML='';}}}});document.querySelectorAll('.cardListSortDropdown').forEach(function(dropdownUpdate){dropdownUpdate.value=sortBy;});} (function(){function iSort(){document.querySelectorAll('.cardListSortDropdown').forEach(function(dropdown){dropdown.addEventListener('change',function(){const sortBy=this.value;const listNum=this.getAttribute('data-listnum');const cardsContainer=document.querySelector('.row[data-listnum=\"'+listNum+'\"]');Array.from(cardsContainer.children).sort((a,b)=>{const aValue=parseFloat(a.getAttribute('data-'+sortBy)||Infinity);const bValue=parseFloat(b.getAttribute('data-'+sortBy)||Infinity);return aValue-bValue;}).forEach((card,index)=>{cardsContainer.appendChild(card);const titleElement=card.querySelector('.card-title');if(titleElement){const updatedTitle=(index+1)+titleElement.innerHTML.replace(/^\d+\./,'.');titleElement.innerHTML=updatedTitle;}});sortMapMarkers(markerData,sortOptionsMap,sortBy,listNum);});});} if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',iSort);}else{iSort();}})(); var mapScriptCreated = 0; var mapCssCreated = 0; var mapScriptLoaded = 0; var mapCssLoaded = 0; var mapLoadList = []; function showLazyMap(fname) { if (mapScriptLoaded == 1 && mapCssLoaded == 1) { if (!mapLoadList.includes(fname)) { window[fname](); mapLoadList.push(fname); } } } (function fn() { var pics = document.querySelectorAll('.no-js-hide'); pics.forEach(function(pic) { pic.classList.toggle('no-js-hide'); }); var lazyImages = [].slice.call(document.querySelectorAll(".lazeeload")); if ("IntersectionObserver" in window) { const config = { root: null, rootMargin: '1000px', threshold: 0 }; let lazyImageObserver = new IntersectionObserver(function(entries, observer) { entries.forEach(function(entry) { if (entry.isIntersecting) { let lazyImage = entry.target; if (lazyImage.dataset.src) {lazyImage.src = lazyImage.dataset.src;} if (lazyImage.dataset.srcset) {lazyImage.srcset = lazyImage.dataset.srcset;} if (lazyImage.dataset.map) { const fname = "initMapbox_"+lazyImage.dataset.map; if (mapScriptLoaded == 0) { let script = document.createElement('script'); script.async=true; script.defer=true; script.src = "https://api.mapbox.com/mapbox-gl-js/v3.0.0/mapbox-gl.js"; script.onload = function(){ mapScriptLoaded = 1; showLazyMap(fname); } document.head.appendChild(script); mapScriptCreated = 1; let css = document.createElement('link'); css.rel = "stylesheet"; css.href = "https://api.mapbox.com/mapbox-gl-js/v3.0.0/mapbox-gl.css"; css.onload = function(){ mapCssLoaded = 1; showLazyMap(fname); } document.head.appendChild(css); mapCssCreated = 1; } else { if (typeof window[fname] === 'function') { window[fname](); } showLazyMap(fname); } } lazyImage.classList.remove("no-js-hide"); lazyImage.classList.remove("lazeeload"); lazyImageObserver.unobserve(lazyImage); } }); }, config); lazyImages.forEach(function(lazyImage) { lazyImageObserver.observe(lazyImage); lazyImage.classList.add("lazeeload-activated"); }); } else { let active = false; const lazyLoad = function() { if (active === false) { active = true; setTimeout(function() { lazyImages.forEach(function(lazyImage) { if ((lazyImage.getBoundingClientRect().top <= window.innerHeight+1000 && lazyImage.getBoundingClientRect().bottom >= 0) && getComputedStyle(lazyImage).display !== "none") { if (lazyImage.dataset.src) lazyImage.src = lazyImage.dataset.src; if (lazyImage.dataset.srcset) lazyImage.srcset = lazyImage.dataset.srcset; if (lazyImage.dataset.onload) lazyImage.onload = lazyImage.dataset.onload; lazyImage.classList.remove("lazeeload"); lazyImages = lazyImages.filter(function(image) { return image !== lazyImage; }); if (lazyImages.length === 0) { document.removeEventListener("scroll", lazyLoad); window.removeEventListener("resize", lazyLoad); window.removeEventListener("orientationchange", lazyLoad); } } }); active = false; }, 200); } }; document.addEventListener("scroll", lazyLoad); window.addEventListener("resize", lazyLoad); window.addEventListener("orientationchange", lazyLoad); } var lazyImages = [].slice.call(document.querySelectorAll(".lazeeload")); i=1; lazyImages.forEach(function(lazyImage) { if (!(lazyImage.classList.contains("lazeeload-activated"))) { if (lazyImage.dataset.src) lazyImage.src = lazyImage.dataset.src; if (lazyImage.dataset.srcset) lazyImage.srcset = lazyImage.dataset.srcset; lazyImage.classList.remove("lazeeload"); } }); })(); document.addEventListener('DOMContentLoaded', () => { const h = document.querySelector('header.fixed-top'), o = getComputedStyle(h).right; ['show.bs.modal', 'hidden.bs.modal'].forEach(e => document.querySelectorAll('.fullScreenModal').forEach(m => m.addEventListener(e, ev => h.style.right = ev.type === 'show.bs.modal' ? `${window.innerWidth - document.documentElement.clientWidth}px` : o))); });