From 1054fd77f0725b40ea4cf0ee05c1a395c41e0bfd Mon Sep 17 00:00:00 2001 From: "Jesse H. (JesseLikesWeather)" <134172009+JesseWx2011@users.noreply.github.com> Date: Sun, 21 Jan 2024 09:51:42 -0500 Subject: [PATCH] Removed Search Bar Function. I could not get the search bar to function, so you have a configuration at the top, set to :auto. Go to README.md for more information. --- scriptcc.js | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/scriptcc.js b/scriptcc.js index 8e93891..e548128 100644 --- a/scriptcc.js +++ b/scriptcc.js @@ -1,5 +1,8 @@ +// Configuration Files +city = `chicago,il` // :auto for your estimated location (default) +// Types are zipcode, cityname, and geocode. getWx(); -const api_url = `https://api.aerisapi.com/conditions/:auto?format=json&plimit=1&filter=1min&client_id=DZLMGEFxCvfbQRG7aSN3c&client_secret=N63dulcmKzQTrWjIrTe2aGKmOw5AhERWWUmjHQKt`; +const api_url = `https://api.aerisapi.com/conditions/${city}?format=json&plimit=1&filter=1min&client_id=DZLMGEFxCvfbQRG7aSN3c&client_secret=N63dulcmKzQTrWjIrTe2aGKmOw5AhERWWUmjHQKt`; async function getWx() { const responsee = await fetch(api_url); const data = await responsee.json(); @@ -51,25 +54,15 @@ uvvalue.innerHTML = `${response[0].periods[0].uvi} - Very High` visibilitytext.innerHTML = `Very Dense Fog or Haze` } if (visibilityvalue = response[0].periods[0].visibilityMI <= 0.25) { visibilitytext.innerHTML = `Extremely Dense Fog/Haze` -} -// Get City Weather Data Based off of the Searched city. - -const searchInput = document.getElementById('search-input'); -const searchButton = document.getElementById('search-button'); + } + + } +getWx(); -searchButton.addEventListener('click', function() { - // Process the search query here - const query = searchInput.value; - let api_url = `https://api.aerisapi.com/conditions/${query}?format=json&plimit=1&filter=1min&client_id=DZLMGEFxCvfbQRG7aSN3c&client_secret=N63dulcmKzQTrWjIrTe2aGKmOw5AhERWWUmjHQKt` - console.log(api_url) - getWx(); -}); -} - getWx(); -setInterval(getWx, 15000) -getForecast(); + // Get The Weather Forecast based off of IP + getForecast(); async function getForecast() { - const forecast_url = `https://api.aerisapi.com/forecasts/:auto?limit=7&client_id=DZLMGEFxCvfbQRG7aSN3c&client_secret=N63dulcmKzQTrWjIrTe2aGKmOw5AhERWWUmjHQKt`; + const forecast_url = `https://api.aerisapi.com/forecasts/${city}?limit=7&client_id=DZLMGEFxCvfbQRG7aSN3c&client_secret=N63dulcmKzQTrWjIrTe2aGKmOw5AhERWWUmjHQKt`; const responsee = await fetch(forecast_url); const data = await responsee.json(); const {response} = data;