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){console.log(c);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;if(i.best){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:[-82.45875735954331,27.951705149990044],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":[-82.45875735954331,27.951705149990044],"type":"star-plain"};markerData[1][1]={"lonLat":[-81.779751,24.55532],"best":1,"time":540,"distance":460,"type":"numbered","c":{"route":{"id":361,"color":"#fa5050"},"card":{"title":"Key West","d":"460 miles","t":540,"p":"[\"9d64b963c37f534317361fe90bb0b4bc\",\"footbridge to the beach - Florida Key West\"]","oX":-175,"oY":0,"link":"\/trip\/road-trip-from-tampa-to-key-west","linkText":"Read more"}}};markerData[1][2]={"lonLat":[-80.191956,25.761725],"best":2,"time":690,"distance":590,"type":"numbered","c":{"route":{"id":354,"color":"#fa5050"},"card":{"title":"Miami","d":"590 miles","t":690,"p":"[\"07d4f0b1320763e381c43c4fca3c7722\",\"Miami Beach, Florida, USA on Ocean Drive at sunset.\"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-tampa-to-miami","linkText":"Read more"}}};markerData[1][3]={"lonLat":[-81.37894442905886,28.53839559699792],"best":3,"time":100,"distance":85,"type":"numbered","c":{"route":{"id":2737,"color":"#fa5050"},"card":{"title":"Orlando","d":"85 miles","t":100,"p":"[\"75afa2066046f180a124a28cd966ac53\",\"Up close shot of people riding and having fun on the bright blue Manta Ray rollercoaster in action at Seaworld \"]","oX":175,"oY":0}}};markerData[1][4]={"lonLat":[-82.63845179322072,27.767193074705798],"best":4,"time":30,"distance":25,"type":"numbered","c":{"route":{"id":2730,"color":"#fa5050"},"card":{"title":"St Petersburg","d":"25 miles","t":30,"p":"[\"e71cc9261d52955fbb4d971ecbc382f8\",\"St Petersburg, Florida, USA with a boardwalk to a beach the beach with stunning flowers in the foreground on a sunny day.\"]","oX":175,"oY":360}}};markerData[1][5]={"lonLat":[-82.79587128956864,27.9656094615505],"best":5,"time":40,"distance":20,"type":"numbered","c":{"route":{"id":2731,"color":"#fa5050"},"card":{"title":"Clearwater","d":"20 miles","t":40,"p":"[\"0d936c6d966981f6213151e668c2dfa5\",\"Long wooden pier stretches out into calm sea with pink, blue and gold sunset light reflected\"]","oX":-175,"oY":0}}};markerData[1][6]={"lonLat":[-81.38376860757042,25.842702127551043],"best":6,"time":185,"distance":205,"type":"numbered","c":{"route":{"id":2745,"color":"#fa5050"},"card":{"title":"Everglades National Park","d":"205 miles","t":185,"p":"[\"87e5811cc570a278dbbc4320fe4a0ec0\",\"Everglades National Park, Florida at in the sunrise with a wooden platform in the foreground overlooking waters covered with green plants.\"]","oX":175,"oY":0}}};markerData[1][7]={"lonLat":[-81.6556226179399,30.332153513555944],"best":7,"time":190,"distance":200,"type":"numbered","c":{"route":{"id":2746,"color":"#fa5050"},"card":{"title":"Jacksonville","d":"200 miles","t":190,"p":"[\"9a952defb2da106cf0148569ad7b5169\",\"Jacksonville, Florida, USA downtown city skyline.\"]","oX":175,"oY":0}}};markerData[1][8]={"lonLat":[-81.31430765831202,29.89265279213925],"best":8,"time":200,"distance":190,"type":"numbered","c":{"route":{"id":2748,"color":"#fa5050"},"card":{"title":"St Augustine","d":"190 miles","t":200,"p":"[\"06ecaaf1cd1555f6a33852df195110ee\",\"St. Augustine, Florida, USA town square.\"]","oX":175,"oY":0}}};markerData[1][9]={"lonLat":[-86.49587121835178,30.392075834860226],"best":9,"time":530,"distance":410,"type":"numbered","c":{"route":{"id":2749,"color":"#fa5050"},"card":{"title":"Destin","d":"410 miles","t":530,"p":"[\"a050993f4eef70d255e6b80d57c3de8e\",\"Aerial Close-up of Crab Island, Destin Florida on a sunny day\"]","oX":-175,"oY":0}}};markerData[1][10]={"lonLat":[-81.09097185429786,32.081332687386684],"best":10,"time":310,"distance":335,"type":"numbered","c":{"route":{"id":2750,"color":"#fa5050"},"card":{"title":"Savannah","d":"335 miles","t":310,"p":"[\"fd7d4a1e421be58ff22c26a025406f49\",\"Savannah, Georgia, USA riverfront promenade at sunrise. A riverboat can be seen.\"]","oX":175,"oY":0}}};markerData[1][11]={"lonLat":[-79.93170266072529,32.78344743607058],"best":11,"time":410,"distance":435,"type":"numbered","c":{"route":{"id":2751,"color":"#fa5050"},"card":{"title":"Charleston","d":"435 miles","t":410,"p":"[\"a2815273d4793f66b6384febd8c79c7b\",\"Rainbow Row, Charleston SC\"]","oX":175,"oY":0}}};markerData[1][12]={"lonLat":[-78.87991326606425,33.69649808857539],"best":12,"time":530,"distance":560,"type":"numbered","c":{"route":{"id":2752,"color":"#fa5050"},"card":{"title":"Myrtle Beach","d":"560 miles","t":530,"p":"[\"db7300d54c26b3f52dbda5f5e75cecfa\",\"Myrtle Beach with its famous pier and Ferris Wheel in the background during a pink and peach sunset.\"]","oX":175,"oY":0}}};markerData[1][13]={"lonLat":[-82.81207965511774,28.05969818641916],"best":13,"time":45,"distance":30,"type":"numbered","c":{"route":{"id":2732,"color":"#fa5050"},"card":{"title":"Honeymoon Island","d":"30 miles","t":45,"p":"[\"4033ab103ec58429dec7caf55f3c6b38\",\"Dunedin Causeway Honeymoon Island State Park In Florida\"]","oX":-175,"oY":0}}};markerData[1][14]={"lonLat":[-81.94956408099588,26.562768870868076],"best":14,"time":140,"distance":140,"type":"numbered","c":{"route":{"id":2739,"color":"#fa5050"},"card":{"title":"Fort Myers and Cape Coral","d":"140 miles","t":140,"p":"[\"7b47eda4491846b436525eb093a4a834\",\"Florida Fort Myers colorful facades and palm trees in USA\"]","oX":175,"oY":0}}};markerData[1][15]={"lonLat":[-80.60774602042184,28.392200466188882],"best":15,"time":140,"distance":130,"type":"numbered","c":{"route":{"id":2741,"color":"#fa5050"},"card":{"title":"Cape Canaveral","d":"130 miles","t":140,"p":"[\"f0383b2994c57b03a5565db23680cb2d\",\"NASA Logo on Globe at Kennedy Space Center Visitor Complex in Cape Canaveral, Florida, USA. To the left is a painting visible of President John F. Kennedy.\"]","oX":175,"oY":0}}};markerData[1][16]={"lonLat":[-82.75691444973756,28.146113766678077],"best":16,"time":60,"distance":35,"type":"numbered","c":{"route":{"id":2733,"color":"#fa5050"},"card":{"title":"Tarpon Springs","d":"35 miles","t":60,"p":"[\"d77377e6f445324c4abe1efe17bdd4b1\",\"Greek fishing village in Florida, Main Street view on a sunny day\"]","oX":-175,"oY":0}}};markerData[1][17]={"lonLat":[-82.53098197852543,27.336555167369703],"best":17,"time":65,"distance":60,"type":"numbered","c":{"route":{"id":2734,"color":"#fa5050"},"card":{"title":"Sarasota","d":"60 miles","t":65,"p":"[\"89271171a79f85ea9025fc6a7a640b31\",\"Sarasota Florida Downtown Bayfront Park Marina Jacks Golden Gate\"]","oX":-175,"oY":0}}};markerData[1][18]={"lonLat":[-81.70779132023425,25.939108234264708],"best":18,"time":170,"distance":180,"type":"numbered","c":{"route":{"id":2743,"color":"#fa5050"},"card":{"title":"Marco Island","d":"180 miles","t":170,"p":"[\"ecb8e64cacf74e80b97dcc8b9b67e1d0\",\"Marco Island, Florida, USA with a sunset over the boats in Esplanade Harbor Marina.\"]","oX":175,"oY":0}}};markerData[1][19]={"lonLat":[-82.57288468011515,28.516154376341426],"best":19,"time":60,"distance":55,"type":"numbered","c":{"route":{"id":2735,"color":"#fa5050"},"card":{"title":"Weeki Wachee Springs State Park","d":"55 miles","t":60,"p":"[\"042a6ef926e0256dee37cd98428e7050\",\"Manatees swimming under the crystal clear waters of the natural spring\"]","oX":-175,"oY":0}}};markerData[1][20]={"lonLat":[-82.59258460431933,28.902387482174255],"best":20,"time":80,"distance":80,"type":"numbered","c":{"route":{"id":2736,"color":"#fa5050"},"card":{"title":"Crystal River","d":"80 miles","t":80,"p":"[\"07407a3a6adff77fa9b60102a251d6a6\",\"Crystal River, Florida taken at Three Sisters Springs with turquoise waters on a sunny day and trees in the distance. \"]","oX":-175,"oY":0}}};markerData[1][21]={"lonLat":[-82.14125263016912,29.189858594249856],"best":21,"time":90,"distance":95,"type":"numbered","c":{"route":{"id":2738,"color":"#fa5050"},"card":{"title":"Ocala","d":"95 miles","t":90,"p":"[\"15eae3576742d076acd227df1cfcc7cf\",\"A tourist boat on the river with tall trees lining the shore\"]","oX":175,"oY":0}}};markerData[1][22]={"lonLat":[-82.32494813444055,29.65202555596292],"best":22,"time":120,"distance":130,"type":"numbered","c":{"route":{"id":2740,"color":"#fa5050"},"card":{"title":"Gainesville","d":"130 miles","t":120,"p":"[\"db3a414f3e0f090f2115790252e4d1e1\",\"Gainesville, Florida, USA downtown cityscape taken at sunset.\"]","oX":175,"oY":-60}}};markerData[1][23]={"lonLat":[-80.83111868427545,27.20084963564974],"best":23,"time":160,"distance":145,"type":"numbered","c":{"route":{"id":2742,"color":"#fa5050"},"card":{"title":"Lake Okeechobee","d":"145 miles","t":160,"p":"[\"426de522eec8499b35eb8eeb25b26499\",\"Sun setting over the lake with clouds in the sky\"]","oX":175,"oY":0}}};markerData[1][24]={"lonLat":[-81.33380931597789,28.95265677029485],"best":24,"time":135,"distance":120,"type":"numbered","c":{"route":{"id":2744,"color":"#fa5050"},"card":{"title":"Blue Springs State Park","d":"120 miles","t":135,"p":"[\"c2aaa75d00a8a2e5f56658fcc3acfdda\",\"Clear, blue waters of the natural springs, with trees lining the shores\"]","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][27]={"lonLat":[-90.07138,29.95115],"time":750,"distance":670,"type":"grey","c":{"route":{"id":375,"color":"#fa5050"},"card":{"title":"New Orleans","d":"670 miles","t":750,"p":"[\"37ff1a2c80ddb57f76b35b943f9dae12\",\"Mural of historical jazz players on the side of a building in downtown\"]","oX":-175,"oY":0,"link":"\/trip\/road-trip-from-tampa-to-new-orleans","linkText":"Read more"}}};markerData[1][25]={"lonLat":[-86.78203204159605,36.16261515976688],"time":610,"distance":705,"type":"grey","c":{"route":{"id":2753,"color":"#fa5050"},"card":{"title":"Nashville","d":"705 miles","t":610,"p":"[\"f153dd5cd06a08c07e71554d83fe3893\",\"A busy bar in downtown Nashville, with people watching live music. Neon signs and music memorabilia line the walls\"]","oX":-175,"oY":0}}};markerData[1][26]={"lonLat":[-74.00721712096029,40.713031612674676],"time":1005,"distance":1130,"type":"grey","c":{"route":{"id":2754,"color":"#fa5050"},"card":{"title":"New York","d":"1,130 miles","t":1005,"p":"[\"718ebfba471f3afb2b783bf1dc47bef1\",\"The facade of the famous museum in New York City on a sunny day without people\"]","oX":175,"oY":0}}};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))); });