91
91
} ;
92
92
93
93
initialize ( ) ;
94
- } ) ( ) ;
95
-
96
-
97
-
98
- // function addcityHistory(city) {
99
- // cityHistory.push(city);
100
- // localStorage.setItem("cityHistory", JSON.stringify(cityHistory));
101
- // oldCities();
102
- // }
103
-
104
- // function oldCities() {
105
- // $("#listofCities").text("");
106
- // cityHistory.forEach((city) => {
107
- // $("#listofCities").prepend("<tr><td>" + city + "</td></tr>");
108
- // });
109
- // }
110
-
111
- // function keepHistory() {
112
- // var manyCities = localStorage.getItem("cityHistory");
113
- // if (manyCities) {
114
- // cityHistory = JSON.parse(manyCities);
115
- // }
116
- // }
117
-
118
- // function searchCity() {
119
- // $("#search-button").on("click", function (event) {
120
- // event.preventDefault();
121
- // city = $(this).siblings("#city-search").val();
122
- // var urlCurrentWeather = `https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${apiKey}&units=imperial`;
123
- // $("#city-search").val("");
124
- // addcityHistory(city);
125
- // $.ajax({
126
- // url: urlCurrentWeather,
127
- // method: "GET",
128
- // }).then(function (response) {
129
- // updateCity(response, city);
130
- // var lat = response.coord.lat;
131
- // var lon = response.coord.lon;
132
- // var urlForecast = `https://api.openweathermap.org/data/2.5/forecast?lat=${lat}&lon=${lon}&appid=${apiKey}`;
133
- // $.ajax({
134
- // url: urlForecast,
135
- // method: "GET",
136
- // }).then(function (forecastResponse) {
137
- // console.log(forecastResponse);
138
- // fiveDayForecast(forecastResponse);
139
- // });
140
- // });
141
- // });
142
- // }
143
-
144
- // $("#clear").on("click", function (event) {
145
- // event.preventDefault();
146
- // cityHistory = [];
147
- // $("#listofCities").empty();
148
- // localStorage.removeItem("cityHistory");
149
- // });
150
-
151
- // function updateCity(response, city) {
152
- // var temp = response.main.temp;
153
- // var wind = response.wind.speed;
154
- // var humidity = response.main.humidity;
155
- // var currentTime = dayjs().format("MMMM D, YYYY");
156
- // $("#currentCity").html(`<li>City: ${city} ${currentTime}</li>
157
- // <li>Temperature: ${temp}°F</li>
158
- // <li>Wind Speed: ${wind} MPH</li>
159
- // <li>Humidity: ${humidity}%</li>`);
160
- // }
161
-
162
- // function fiveDayForecast(forecastResponse) {
163
- // $("#5forecast").empty();
164
- // for (var i = 0; i < 5; i++) {
165
- // var forecastDay = forecastResponse.list[i];
166
- // var date = dayjs(forecastDay.dt_txt).format("MMMM D, YYYY");
167
- // var temp1 = forecastDay.main.temp;
168
- // var wind2 = forecastDay.wind.speed;
169
- // var humidity2 = forecastDay.main.humidity;
170
- // var forecastHTML = `<li>Date: ${date}</li>
171
- // <li>Temperature: ${temp1}°F</li>
172
- // <li>Wind Speed: ${wind2} MPH</li>
173
- // <li>Humidity: ${humidity2}%</li>`;
174
- // $("#5forecast").append(forecastHTML);
175
- // }
176
- // }
177
-
178
- // keepHistory();
179
- // searchCity();
180
- // oldCities();
181
- // })();
94
+ } ) ( ) ;
0 commit comments