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:[-120.97846480817043,37.60497830203366],zoom:5,cooperativeGestures:true});window.contentMaps[1]=contentMap_1;if(typeof window.bounds[1]==='undefined'){window.bounds[1]=new mapboxgl.LngLatBounds();} const contentFinish_1_1=[-115.39557707731609,35.60150205055541];const contentFinish_1_1_geoson={'type':'FeatureCollection','features':[{'type':'Feature','geometry':{'type':'Point','coordinates':contentFinish_1_1},'properties':{'title':'Finish','description':'Finish point'}}]};for(const feature of contentFinish_1_1_geoson.features){const el=document.createElement('div');el.className='marker_star';new mapboxgl.Marker(el,{offset:[0,-29]}).setLngLat(feature.geometry.coordinates).addTo(contentMap_1);} window.bounds[1].extend(contentFinish_1_1);async function getRoute_1_0(start,finish,via){const url=`https://api.mapbox.com/directions/v5/mapbox/driving/${start.join(',')};${via}${finish.join(',')}?alternatives=true&geometries=geojson&language=en&overview=full&steps=true&access_token=${mapboxgl.accessToken}`;const response=await fetch(url);const json=await response.json();const data=json.routes[0];const route=data.geometry.coordinates;const geojson={type:'Feature',properties:{},geometry:{type:'LineString',coordinates:route}};for(const coord of route){window.bounds[1].extend(coord);contentMap_1.fitBounds(window.bounds[1],{padding:{top:60,bottom:60,left:60,right:60}});} if(contentMap_1.getSource('route1_0')){contentMap_1.getSource('route1_0').setData(geojson);}else{contentMap_1.addLayer({id:'route1_0',type:'line',source:{type:'geojson',data:geojson},layout:{'line-join':'round','line-cap':'round'},paint:{'line-color':'#0b7192','line-width':5,'line-opacity':0.80}});}} const start_1_0=[-115.39557707732,35.601502050555];const finish_1_0=[-117.02292671999,34.884086239998];const via_1_0='-116.54178880395,33.830018258638;-117.16052782796,32.715597644471;-118.63488690172,34.037001527832;-119.45198179307,34.365923920057;-120.68970380321,35.168318666693;-121.35704513427,35.807371294259;-121.80795735042,36.270624992502;-121.91351326448,36.427446521912;-121.95615375899,36.983526363413;-122.48522498055,37.620542403048;-122.91794605301,38.197896735982;-124.18463381117,40.759970202407;-123.97351158657,41.703047254433;-123.64645538264,42.161999432238;-123.37763513975,41.79276564731;-122.30790349161,41.309891578532;-121.00059441196,40.498270888773;-119.97701646785,38.940077195687;-119.87585434475,37.799632063448;-119.65185665941,37.716548387317;-119.19683293293,36.31778295988;-118.76653024923,36.568878625434;-117.0131465602,34.897424618478;';contentMap_1.on('load',async()=>{await getRoute_1_0(start_1_0,finish_1_0,via_1_0);});contentMap_1.fitBounds(window.bounds[1],{padding:{top:60,bottom:60,left:60,right:60}});initialMapBounds[1]=new mapboxgl.LngLatBounds(window.bounds[1].getSouthWest(),window.bounds[1].getNorthEast());const visibleMapRoutes_1=[];contentMaps[1].on('click',(e)=>{resetMarkersAndCards(1);});addMarkersToMap(1);} 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))); });