Tighten flight search links
This commit is contained in:
@@ -3128,16 +3128,33 @@
|
||||
|
||||
function quickBook(type) {
|
||||
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;
|
||||
switch(type) {
|
||||
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-google': url = `https://www.google.com/travel/flights/search?q=${encodeURIComponent(q)}&tfpla=on`; break;
|
||||
case 'flights-kayak': url = `https://www.kayak.com/flights/${encodeURIComponent(q)}`; break;
|
||||
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;
|
||||
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-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;
|
||||
case 'flights-alaska': url = `https://www.alaskaair.com/booking/flights`; break;
|
||||
case 'flights':
|
||||
case 'flights-google':
|
||||
url = `https://www.google.com/travel/flights/search?q=${encodeURIComponent(googleFlightsQuery)}&tfpla=on`;
|
||||
break;
|
||||
case 'flights-kayak':
|
||||
url = `https://www.kayak.com/flights/${origin}-SJD/${depart}/${ret}?sort=bestflight_a`;
|
||||
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 'viator': url = `https://www.viator.com/search/${encodeURIComponent(q)}`; break;
|
||||
case 'expedia': url = `https://www.expedia.com/Thotel-Search?destination=${encodeURIComponent(q)}`; break;
|
||||
|
||||
Reference in New Issue
Block a user