-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
qiyuhang
committed
May 13, 2024
1 parent
65a4b24
commit f69f7e8
Showing
9 changed files
with
69 additions
and
721 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,3 @@ | ||
/** | ||
* @license MIT | ||
* @fileoverview All api related stuff like api_key, api request etc. | ||
* @copyright codewithsadee 2023 All rights reserved | ||
* @author codewithsadee <[email protected]> | ||
*/ | ||
|
||
'use strict' | ||
const api_key = '612fe0c2c22681284f5bdf0b1f77bd17' | ||
const BAIDU_KEY = '26711937b3cbee60212cdf3af91b0ed8' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
/** | ||
* @license MIT | ||
* @copyright codewithsadee 2023 All rights reserved | ||
* @author codewithsadee <[email protected]> | ||
*/ | ||
|
||
"use strict"; | ||
|
||
import { fetchData, url } from "./api.js"; | ||
|
@@ -50,7 +44,6 @@ searchField.addEventListener("input", (e) => { | |
if (searchField.value.trim()) { | ||
searchTimeout = setTimeout(() => { | ||
fetchData(url.geo(searchField.value), function (locations) { | ||
console.log("🚀 ~ locations:", locations); | ||
searchField.classList.remove("searching"); | ||
searchResult.classList.add("active"); | ||
searchResult.innerHTML = ` | ||
|
@@ -85,24 +78,6 @@ searchField.addEventListener("input", (e) => { | |
searchResult.classList.remove("active"); | ||
}); | ||
}); | ||
// for (const { lat, lon, name, state, country } of locations) { | ||
// const searchItem = document.createElement("li"); | ||
// searchItem.classList.add("view-item"); | ||
// searchItem.innerHTML = ` | ||
// <span class="m-icon">location_on</span> | ||
// <div> | ||
// <p class="item-title">${name}</p> | ||
// <p class="label-2 item-subtitle">${state || ""} ${country}</p> | ||
// </div> | ||
// <a href="#/weather?lat=${lat}&lon=${lon}" aria-label="${name} weather" class="item-link has-state" data-search-toggler></a> | ||
// ` | ||
// searchResult.querySelector("[data-search-list]").appendChild(searchItem); | ||
// items.push(searchItem.querySelector("[data-search-toggler]")); | ||
// addEvernOnElements(items, "click", function () { | ||
// toggleSearch(); | ||
// searchResult.classList.remove("active"); | ||
// }); | ||
// } | ||
}); | ||
}, searchTimeoutDuration); | ||
} | ||
|
@@ -180,7 +155,9 @@ export const updateWeather = (lat, lon) => { | |
fetchData( | ||
url.reverseGeo(lat.split("=")[1], lon.split("=")[1]), | ||
function (result) { | ||
const { regeocode: {addressComponent} } = result; | ||
const { | ||
regeocode: { addressComponent }, | ||
} = result; | ||
const { province, city } = addressComponent; | ||
card.querySelector( | ||
"[data-location]" | ||
|
@@ -400,9 +377,7 @@ export const updateWeather = (lat, lon) => { | |
<p class="title-2">${parseInt(temp_max)}°</p> | ||
</span> | ||
</div> | ||
<p class="label-1">${date.getDate()} ${ | ||
module.monthNames[date.getMonth()] | ||
}</p> | ||
<p class="label-1">${module.monthNames[date.getMonth()]} / ${date.getDate()}</p> | ||
<p class="label-1">${module.weekDayNames[date.getDay()]}</p> | ||
`; | ||
forecastSection.querySelector("[data-forecast-list]").appendChild(li); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.