${weather.nearest_area[0].areaName[0].value}`
+ chance()
+ article[0].innerHTML += `
Area: ${weather.nearest_area[0].areaName[0].value}
` + + } else { + article[0].innerHTML = `${input.value}`
+ chance()
+ article[0].innerHTML += `
Nearest Area: ${weather.nearest_area[0].areaName[0].value}
` + + } + input.value = ""; + article[0].innerHTML += `Region: ${weather.nearest_area[0].region[0].value}
Country: ${weather.nearest_area[0].country[0].value}
Currently: Feels like ${weather.current_condition[0].FeelsLikeF}°F
` + article[0].innerHTML += `Chance of Sunshine: ${weather.weather[0].hourly[0].chanceofsunshine}
Chance of Rain: ${weather.weather[0].hourly[0].chanceofrain}
Chance of Snow: ${weather.weather[0].hourly[0].chanceofsnow}
` + const head = document.querySelectorAll('h2') + head[2].innerHTML = `Today` + head[3].innerHTML = `Tomorrow` + head[4].innerHTML = `Day After Tomorrow` + article[1].innerHTML = `Average Temperature: ${weather.weather[0].avgtempF}°FMax Temperature: ${weather.weather[0].maxtempF}°F
Min Temperature: ${weather.weather[0].mintempF}°F` + article[2].innerHTML = `Average Temperature: ${weather.weather[1].avgtempF}°F
Max Temperature: ${weather.weather[1].maxtempF}°F
Min Temperature: ${weather.weather[1].mintempF}°F` + article[3].innerHTML = `Average Temperature: ${weather.weather[2].avgtempF}°F
Max Temperature: ${weather.weather[2].maxtempF}°F
Min Temperature: ${weather.weather[2].mintempF}°F` + } + get() + let li = document.createElement('li') + if(!array.includes(weather.nearest_area[0].areaName[0].value)){ + li.innerHTML = `${weather.nearest_area[0].areaName[0].value}:${weather.current_condition[0].FeelsLikeF}°F` + ul[4].append(li) + } + p.remove() + array.push(weather.nearest_area[0].areaName[0].value) + li.addEventListener("click", (event) => { + event.preventDefault() + get() + }) + const conversion = document.querySelector('#conversionForm'); + conversion.addEventListener('submit', (event) => { + event.preventDefault(); + let conversion = event.target.convert.value; + let toC = document.querySelector('#to-c') + let toF = document.querySelector('#to-f') + if (toC.checked) { + conversion = (conversion - 32) * (5 / 9); + document.querySelector('#result').innerHTML = `${conversion.toFixed(2)}°C`; + } else { + conversion = conversion * (9 / 5) + 32; + document.querySelector('#result').innerHTML = `${conversion.toFixed(2)}°F`; + } + }); + }) +}); \ No newline at end of file diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..c403ce1 --- /dev/null +++ b/styles.css @@ -0,0 +1,49 @@ +.header { + background-color: rgb(9, 67, 67); + grid-area: header; + text-align: center; +} + +.main { + font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; + justify-content: center; + background-color: rgb(54, 146, 106); + text-align: center; + grid-area: main; + border-top: 2px solid rgb(208, 232, 128); + border-left: 2px solid rgb(208, 232, 128); + border-bottom: 2px solid rgb(208, 232, 128); + border-right: 2px solid rgb(208, 232, 128); +} + +.previous { + background-color: rgb(208, 232, 128); + display: grid; + grid-area: previous; + text-decoration: underline; +} + +.conversion { + background-color: rgb(118, 155, 95); + display: grid; + grid-area: aside; +} +.weatherForecast { + background-color: rgba(197, 231, 153, 0.543); + display: grid; + grid-template-columns: "auto auto auto"; + grid-template-rows: "auto auto auto"; + grid-template-areas: "header header header"; + border-left: thick solid rgb(208, 232, 128); + border-right: thick solid rgb(208, 232, 128); + border: 50px; + +} +body { + background-color: rgb(174, 239, 151); + display: grid; + text-align: center; + grid-template-columns: "auto auto auto"; + grid-template-rows: "auto auto auto"; + grid-template-areas: "header header header" "aside main previous"; +} \ No newline at end of file