Skip to content

Commit

Permalink
Remove find return flights (for all) option
Browse files Browse the repository at this point in the history
  • Loading branch information
vloss3 committed Dec 10, 2024
1 parent c483756 commit 352221e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ a) (recommended) Get from Chrome Store https://chromewebstore.google.com/detail/

b) To install this Chrome extension:

1. Download [https://github.com/vloss3/wizz-aycf-route-finder/archive/refs/tags/1.3.1.zip](https://github.com/vloss3/wizz-aycf-route-finder/archive/refs/tags/1.3.1.zip)
1. Download [https://github.com/vloss3/wizz-aycf-route-finder/archive/refs/tags/1.3.2.zip](https://github.com/vloss3/wizz-aycf-route-finder/archive/refs/tags/1.3.2.zip)

2. Unzip the file.

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "AYCF Route Finder",
"description": "Simple(<1mb) Chrome extension to find all available routes on Wizz AYCF (All-You-Can-Fly). Not affiliated with Wizz Air.",
"version": "1.3.1",
"version": "1.3.2",
"permissions": [
"activeTab"
],
Expand Down
10 changes: 1 addition & 9 deletions popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ <h1 class="is-size-5">Wizz AYCF Route Finder</h1>
<select id="date-select" class="select">
</select>
</div>
<div class="field mt-2">
<div class="control">
<label class="checkbox">
<input type="checkbox" id="check-returns">
Find return flights (for all)
</label>
</div>
</div>
</div>
<button id="search-flights" class="button is-link mb-4">Check Routes</button>
<div class="notification is-danger" id="rate-limited-message">
Expand All @@ -65,7 +57,7 @@ <h1 class="is-size-5">Wizz AYCF Route Finder</h1>
</div>
<p class="is-size-6 mt-3"><b>Disclaimer:</b> This extension is not affiliated with Wizz Air or its partners in any way. It is a personal project to help Multipass users like me find available routes.</p>
<p class="is-size-6 mt-3">Please use responsibly and at your own risk. Doing too many searches in a short period of time will result in temporary rate limiting.</p>
<p class="is-size-6 mt-3">Version 1.3.1 - <a href="https://github.com/vloss3/wizz-aycf-route-finder/releases" target="_blank">Changelog</a> </p>
<p class="is-size-6 mt-3">Version 1.3.2 - <a href="https://github.com/vloss3/wizz-aycf-route-finder/releases" target="_blank">Changelog</a> </p>
</section>
<script src="popup.js"></script>
</body>
Expand Down
21 changes: 4 additions & 17 deletions popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,8 @@ async function checkAllRoutes() {
console.log("checkAllRoutes started");
const originInput = document.getElementById("airport-input");
const dateSelect = document.getElementById("date-select");
const checkReturnsCheckbox = document.getElementById("check-returns");
const origin = originInput.value.toUpperCase();
const selectedDate = dateSelect.value;
const checkReturns = checkReturnsCheckbox.checked;

if (!origin) {
alert("Please enter a departure airport code.");
Expand Down Expand Up @@ -230,7 +228,7 @@ async function checkAllRoutes() {
flightsByDate[selectedDate] = [];
}
flightsByDate[selectedDate].push(flightInfo);
displayResults(flightsByDate, checkReturns, true);
displayResults(flightsByDate, true);
});
}
} catch (error) {
Expand Down Expand Up @@ -261,18 +259,7 @@ async function checkAllRoutes() {
routeListElement.innerHTML = `<p class="is-size-4 has-text-centered">No flights available for ${selectedDate}.</p>`;
} else {
setCachedResults(cacheKey, flightsByDate[selectedDate]);
await displayResults(flightsByDate, checkReturns);

if (checkReturns) {
const returnPromises = flightsByDate[selectedDate].map(
async (flight) => {
const returnFlights = await findReturnFlight(flight);
const returnCacheKey = `${cacheKey}-return-${flight.route}`;
setCachedResults(returnCacheKey, returnFlights);
}
);
await Promise.all(returnPromises);
}
await displayResults(flightsByDate);
}
}
} catch (error) {
Expand All @@ -288,7 +275,7 @@ function formatDate(date) {
return `${year}-${month}-${day}`;
}

function displayResults(flightsByDate, checkReturns, append = false) {
function displayResults(flightsByDate, append = false) {
const resultsDiv = document.querySelector(".route-list");
if (!resultsDiv) {
console.error("Error: .route-list element not found in the DOM");
Expand Down Expand Up @@ -403,7 +390,7 @@ function displayResults(flightsByDate, checkReturns, append = false) {
const returnCacheKey = `${origin}-${date}-return-${flight.route}`;
const cachedReturnData = localStorage.getItem(returnCacheKey);

if (!checkReturns && !cachedReturnData) {
if (!cachedReturnData) {
const findReturnButton = document.createElement("button");
findReturnButton.textContent = "Find Return";
findReturnButton.style.width = "100px";
Expand Down

0 comments on commit 352221e

Please sign in to comment.