Wayed11 commited on
Commit
befd0cb
·
verified ·
1 Parent(s): d26eab3

Fix: define hav distance (trip planner error)

Browse files
Files changed (1) hide show
  1. trips.html +3 -1
trips.html CHANGED
@@ -380,7 +380,7 @@ function plan(){
380
  st.its=(d.itineraries||[]).filter(function(it){return it.legs&&it.legs.length}).slice(0,5);
381
  st.sel=0;st.fromUsed=from;render();draw();
382
  if(st.its.length)speakPlan(true);else say('I couldn\'t find a bus or train for that trip right now. A '+pt().n+' ride or a wheelchair van can still get you there.');
383
- }).catch(function(){$('sb').innerHTML='<div class="note err">I couldn\'t reach the trip planner. Check your connection and try again.</div><div class="acts"><button class="act p" id="retry">Try again</button></div>';$('retry').onclick=plan});
384
  };
385
  if(st.from)go(st.from);else if(st.me)go(st.me);else locate(go);
386
  }
@@ -409,6 +409,8 @@ function render(){
409
  wireAlts();
410
  }
411
  function bubble(t){return '<div id="say"><div class="av split" id="sayAv"><img src="wheelie.jpg" alt=""></div><p>'+esc(t)+'</p></div>'}
 
 
412
  function pt(){var c=st.me;
413
  if(!c||hav([c.lon,c.lat],[-117.85,33.70])<70000)return{n:'OC ACCESS',tel:1,href:'tel:18776282232',ft:'Call 1-877-628-2232, press 1. Book by 5 PM the day before.',say:'Calling OC ACCESS. Press 1 to make your reservation. And remember, book it before 5 PM the day before.'};
414
  return{n:'Local paratransit',tel:0,href:'https://www.google.com/search?q='+encodeURIComponent('ADA paratransit wheelchair ride near me'),ft:'Your city\'s door-to-door wheelchair ride. Tap to find their number and book.',say:'Here\'s your city\'s wheelchair ride service. Book it ahead, most need a day\'s notice.'}}
 
380
  st.its=(d.itineraries||[]).filter(function(it){return it.legs&&it.legs.length}).slice(0,5);
381
  st.sel=0;st.fromUsed=from;render();draw();
382
  if(st.its.length)speakPlan(true);else say('I couldn\'t find a bus or train for that trip right now. A '+pt().n+' ride or a wheelchair van can still get you there.');
383
+ }).catch(function(err){try{console.error(err)}catch(e){}$('sb').innerHTML='<div class="note err">I couldn\'t reach the trip planner. Check your connection and try again.</div><div class="acts"><button class="act p" id="retry">Try again</button></div>';$('retry').onclick=plan});
384
  };
385
  if(st.from)go(st.from);else if(st.me)go(st.me);else locate(go);
386
  }
 
409
  wireAlts();
410
  }
411
  function bubble(t){return '<div id="say"><div class="av split" id="sayAv"><img src="wheelie.jpg" alt=""></div><p>'+esc(t)+'</p></div>'}
412
+ if(typeof hav!=='function'){var hav=function(a,b){var R=6371000,r=Math.PI/180,dLat=(b[1]-a[1])*r,dLon=(b[0]-a[0])*r,x=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(a[1]*r)*Math.cos(b[1]*r)*Math.sin(dLon/2)*Math.sin(dLon/2);return 2*R*Math.atan2(Math.sqrt(x),Math.sqrt(1-x))}}
413
+ if(typeof dist!=='function'){var dist=function(m){var mi=m/1609.34;return mi<0.1?Math.round(m*3.28)+' ft':mi.toFixed(1)+' mi'}}
414
  function pt(){var c=st.me;
415
  if(!c||hav([c.lon,c.lat],[-117.85,33.70])<70000)return{n:'OC ACCESS',tel:1,href:'tel:18776282232',ft:'Call 1-877-628-2232, press 1. Book by 5 PM the day before.',say:'Calling OC ACCESS. Press 1 to make your reservation. And remember, book it before 5 PM the day before.'};
416
  return{n:'Local paratransit',tel:0,href:'https://www.google.com/search?q='+encodeURIComponent('ADA paratransit wheelchair ride near me'),ft:'Your city\'s door-to-door wheelchair ride. Tap to find their number and book.',say:'Here\'s your city\'s wheelchair ride service. Book it ahead, most need a day\'s notice.'}}