PageSourceSearch

https://first-shecodes-weather-app.netlify.app/src/weather3.js

js first-shecodes-weather-app.netlify.app collected 2026-10-03 10:44:07 UTC 1,611 bytes, 61 lines download raw bytes

1function search(event) {
2  event.preventDefault();
3  let searchInputElement = document.querySelector("#searchCity");
4  let city = searchInputElement.value;
5
6  let cityElement = document.querySelector("h1");
7  cityElement.innerHTML = searchInputElement.value;
8
9  let apiKey = "oe055taad4b159f1c193102ce46d9b5e";
10  let apiUrl = `https://api.shecodes.io/weather/v1/current?query=${city}&key=${apiKey}&units=metric`;
11  axios.get(apiUrl).then(showTemp);
12}
13
14function formatDate(date) {
15  let minutes = date.getMinutes();
16  let hours = date.getHours();
17  let day = date.getDay();
18
19  if (minutes < 10) {
20    minutes = `0${minutes}`;
21  }
22
23  if (hours < 10) {
24    hours = `0${hours}`;
25  }
26
27  let days = [
28    "Sunday",
29    "Monday",
30    "Tuesday",
31    "Wednesday",
32    "Thursday",
33    "Friday",
34    "Saturday",
35  ];
36
37  let formattedDay = days[day];
38  return `${formattedDay} ${hours}:${minutes}`;
39}
40
41let searchForm = document.querySelector("form");
42searchForm.addEventListener("submit", search);
43
44let currentDateELement = document.querySelector("#day");
45let currentDate = new Date();
46
47currentDateELement.innerHTML = formatDate(currentDate);
48
49function showTemp(response) {
50  //console.log(response);
51  let city = response.data.city;
52  let temp = Math.round(response.data.temperature.current);
53  //console.log(temp);
54
55  let temperature = document.querySelector("#temp");
56  temperature.innerHTML = `${temp}`;
57}
58/*let city = "Tokyo";
59  let apiKey = "oe055taad4b159f1c193102ce46d9b5e";
60  let apiUrl = `https://api.shecodes.io/weather/v1/current?query=${city}&key=${apiKey}&units=metric`;
61  axios.get(apiUrl).then(showTemp);*/

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.