Tighten flight search links

This commit is contained in:
TopherMayor
2026-04-30 21:18:46 -07:00
parent b768990e05
commit 16a0252647

View File

@@ -3128,16 +3128,33 @@
function quickBook(type) { function quickBook(type) {
const q = (document.getElementById('map-search-input').value || '').trim() || 'Los Cabos Mexico'; const q = (document.getElementById('map-search-input').value || '').trim() || 'Los Cabos Mexico';
const origin = /ont\b/i.test(q) ? 'ONT' : /lax\b/i.test(q) ? 'LAX' : 'LAX';
const depart = '2027-02-03';
const ret = '2027-02-07';
const googleFlightsQuery = `Flights from ${origin} to SJD on ${depart} to ${ret}`;
const expediaFlightUrl = `https://www.expedia.com/Flights-Search?trip=roundtrip&leg1=from:${origin},to:SJD,departure:${depart}TANYT&leg2=from:SJD,to:${origin},departure:${ret}TANYT&passengers=adults:1&options=cabinclass:economy&mode=search`;
let url; let url;
switch(type) { switch(type) {
case 'gmaps': url = `https://www.google.com/maps/search/${encodeURIComponent(q)}`; break; case 'gmaps': url = `https://www.google.com/maps/search/${encodeURIComponent(q)}`; break;
case 'flights': url = `https://www.google.com/travel/flights/search?q=${encodeURIComponent(q)}&tfpla=on`; break; case 'flights':
case 'flights-google': url = `https://www.google.com/travel/flights/search?q=${encodeURIComponent(q)}&tfpla=on`; break; case 'flights-google':
case 'flights-kayak': url = `https://www.kayak.com/flights/${encodeURIComponent(q)}`; break; url = `https://www.google.com/travel/flights/search?q=${encodeURIComponent(googleFlightsQuery)}&tfpla=on`;
case 'flights-expedia': url = `https://www.expedia.com/Flights-Search?trip=roundtrip&leg1=from:${encodeURIComponent(q)},to:SJD,departure:${encodeURIComponent('2027-02-03TANYT')}&leg2=from:SJD,to:${encodeURIComponent(q)},departure:${encodeURIComponent('2027-02-07TANYT')}`; break; break;
case 'flights-united': url = `https://www.united.com/en/us/fsr/choose-flights?f=1&t=SJD&d=2027-02-03&tt=2027-02-07&pt=roundtrip`; break; case 'flights-kayak':
case 'flights-delta': url = `https://www.delta.com/flight-search/search?tripType=roundtrip&inputOrigin=${encodeURIComponent(q)}&destination=SJD&departureDate=2027-02-03&returnDate=2027-02-07`; break; url = `https://www.kayak.com/flights/${origin}-SJD/${depart}/${ret}?sort=bestflight_a`;
case 'flights-alaska': url = `https://www.alaskaair.com/booking/flights`; break; break;
case 'flights-expedia':
url = expediaFlightUrl;
break;
case 'flights-united':
url = `https://www.united.com/en-us/flights?f=1&from=${origin}&to=SJD&d=${depart}&tt=${ret}&px=1`;
break;
case 'flights-delta':
url = `https://www.delta.com/flight-search/search?tripType=roundtrip&departureAirportCode=${origin}&arrivalAirportCode=SJD&departureDate=${depart}&returnDate=${ret}&adultPassengerCount=1`;
break;
case 'flights-alaska':
url = `https://www.alaskaair.com/`;
break;
case 'hotels': url = `https://www.kayak.com/hotels/${encodeURIComponent(q)}/2admins`; break; case 'hotels': url = `https://www.kayak.com/hotels/${encodeURIComponent(q)}/2admins`; break;
case 'viator': url = `https://www.viator.com/search/${encodeURIComponent(q)}`; break; case 'viator': url = `https://www.viator.com/search/${encodeURIComponent(q)}`; break;
case 'expedia': url = `https://www.expedia.com/Thotel-Search?destination=${encodeURIComponent(q)}`; break; case 'expedia': url = `https://www.expedia.com/Thotel-Search?destination=${encodeURIComponent(q)}`; break;