diff --git a/js/search-engine-settings.js b/js/search-engine-settings.js index 698b848..b58bb4f 100644 --- a/js/search-engine-settings.js +++ b/js/search-engine-settings.js @@ -44,9 +44,14 @@ class SearchEngineSettings { const seValue = key; const seData = this._searchEngines[key]; const seOption = document.createElement('option'); - seOption.value = seValue; - seOption.innerText = seData.name; - this._selectSearchEngine.appendChild(seOption); + + // Generate search engine suggestions + this._selectSearchEngine.insertAdjacentHTML( + 'beforeend', + ` + + ` + ) }) // Call to update query string and placeholder diff --git a/js/weather-screen.js b/js/weather-screen.js index 9f5c3f3..1eb0e90 100644 --- a/js/weather-screen.js +++ b/js/weather-screen.js @@ -80,62 +80,24 @@ class WeatherScreen { _createForecastBody = (fIcon, forecastTemp, foreDescription, fHour, fDate) => { - // Main Div - const forecastDay = document.createElement('div'); - forecastDay.className = 'weatherForecastDay'; - - // Icon Container Div - const forecastIconContainer = document.createElement('div'); - forecastIconContainer.className = 'weatherForecastDayIconContainer'; - - // Icon Div - const forecastIcon = document.createElement('div'); - forecastIcon.className = 'weatherForecastDayIcon'; - forecastIcon.style.background = `url('assets/weather-icons/${fIcon}')`; - forecastIcon.style.backgroundSize = 'cover'; - - // Details Div - const forecastDetails = document.createElement('div'); - forecastDetails.className = 'weatherForecastDayDetails'; - - const forecastTemperature = document.createElement('div'); - forecastTemperature.className = 'weatherForecastDayDetailsTemperature'; - forecastTemperature.innerHTML = forecastTemp; - - const forecastDescription = document.createElement('div'); - forecastDescription.className = 'weatherForecastDayDetailsDescription'; - forecastDescription.innerHTML = foreDescription; - - // Append details to div container - forecastDetails.appendChild(forecastTemperature); - forecastDetails.appendChild(forecastDescription); - - // Date Div - const forecastDayDate = document.createElement('div'); - forecastDayDate.className = 'weatherForecastDayDate'; - - const forecastHour = document.createElement('div'); - forecastHour.className = 'weatherForecastDayDateHour'; - forecastHour.innerHTML = fHour; - - const forecastDate = document.createElement('div'); - forecastDate.className = 'weatherForecastDayDateDate'; - forecastDate.innerHTML = fDate; - - // Append icon image to div container - forecastIconContainer.appendChild(forecastIcon); - - // Append details to div container - forecastDayDate.appendChild(forecastHour); - forecastDayDate.appendChild(forecastDate); - - // Append to main div - forecastDay.appendChild(forecastIconContainer); - forecastDay.appendChild(forecastDetails); - forecastDay.appendChild(forecastDayDate); - - // Append to the main container - this._forecastContainer.appendChild(forecastDay); + // Generate forecast + this._forecastContainer.insertAdjacentHTML( + 'beforeend', + ` +