Spaces:
Running
Running
Home not saved: use current location, ask once
Browse files- trips.html +1 -1
trips.html
CHANGED
|
@@ -334,7 +334,7 @@ function heard(raw){
|
|
| 334 |
if(m=raw.match(/\bfrom\s+(.+?)\s+to\s+(.+)$/i)){f=m[1];t=m[2]}else if(m=raw.match(/\bto\s+(.+?)\s+from\s+(.+)$/i)){t=m[1];f=m[2]}
|
| 335 |
t=t.replace(/^(take me to|i need to go to|i want to go to|go to|get me to|how do i get to|take me|get me)\s+/i,'').replace(/^the\s+nearest\s+/i,'');
|
| 336 |
function G(q,cb){q=q.replace(/^the\s+/i,'');
|
| 337 |
-
if(/^(home|my house|my home|my place)$/i.test(q)){var H=ls('wTripHome');if(H)return cb(H);say('I
|
| 338 |
if(/^(here|my location|where i am|right here)$/i.test(q))return cb('here');
|
| 339 |
fetch(API+'geocode?text='+encodeURIComponent(q)+'&place='+bias()).then(function(x){return x.json()}).then(function(L){if(L&&L.length){var w=q.toLowerCase().split(/\s+/).filter(function(x){return x.length>2}),stn=/station|stop|train|metrolink|amtrak/i.test(q);var r0=L.map(function(r,i){var n=(r.name||'').toLowerCase(),s=0;w.forEach(function(x){if(n.indexOf(x)>-1)s+=2});if(r.type==='STOP'&&!stn)s-=3;return{r:r,s:s-i*0.1}}).sort(function(a,b){return b.s-a.s})[0].r;cb({label:title(r0.name),sub:area(r0),lat:r0.lat,lon:r0.lon})}else{say('I couldn\'t find '+q+'. Can you say it another way?');cb(null)}}).catch(function(){say('I can\'t reach the map right now.');cb(null)})}
|
| 340 |
$('to').value=t;active='to';
|
|
|
|
| 334 |
if(m=raw.match(/\bfrom\s+(.+?)\s+to\s+(.+)$/i)){f=m[1];t=m[2]}else if(m=raw.match(/\bto\s+(.+?)\s+from\s+(.+)$/i)){t=m[1];f=m[2]}
|
| 335 |
t=t.replace(/^(take me to|i need to go to|i want to go to|go to|get me to|how do i get to|take me|get me)\s+/i,'').replace(/^the\s+nearest\s+/i,'');
|
| 336 |
function G(q,cb){q=q.replace(/^the\s+/i,'');
|
| 337 |
+
if(/^(home|my house|my home|my place)$/i.test(q)){var H=ls('wTripHome');if(H)return cb(H);if(f&&q===f.replace(/^the\s+/i,'')){say('I\'ll start from where you are right now.');return cb('here')}window.tlHome=1;$('to').value='';$('to').placeholder='Type your home address';setTimeout(function(){$('to').focus()},300);say('Where\'s home? Type your address once and I\'ll remember it.');return cb(null)}
|
| 338 |
if(/^(here|my location|where i am|right here)$/i.test(q))return cb('here');
|
| 339 |
fetch(API+'geocode?text='+encodeURIComponent(q)+'&place='+bias()).then(function(x){return x.json()}).then(function(L){if(L&&L.length){var w=q.toLowerCase().split(/\s+/).filter(function(x){return x.length>2}),stn=/station|stop|train|metrolink|amtrak/i.test(q);var r0=L.map(function(r,i){var n=(r.name||'').toLowerCase(),s=0;w.forEach(function(x){if(n.indexOf(x)>-1)s+=2});if(r.type==='STOP'&&!stn)s-=3;return{r:r,s:s-i*0.1}}).sort(function(a,b){return b.s-a.s})[0].r;cb({label:title(r0.name),sub:area(r0),lat:r0.lat,lon:r0.lon})}else{say('I couldn\'t find '+q+'. Can you say it another way?');cb(null)}}).catch(function(){say('I can\'t reach the map right now.');cb(null)})}
|
| 340 |
$('to').value=t;active='to';
|