Skip to content

Commit

Permalink
chore:delete nouse
Browse files Browse the repository at this point in the history
  • Loading branch information
qiyuhang committed May 13, 2024
1 parent 65a4b24 commit f69f7e8
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 721 deletions.
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

61 changes: 0 additions & 61 deletions README.md

This file was deleted.

7 changes: 0 additions & 7 deletions assets/js/api.js
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'
Expand Down
33 changes: 4 additions & 29 deletions assets/js/app.js
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";
Expand Down Expand Up @@ -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 = `
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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]"
Expand Down Expand Up @@ -400,9 +377,7 @@ export const updateWeather = (lat, lon) => {
<p class="title-2">${parseInt(temp_max)}&deg;</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);
Expand Down
77 changes: 57 additions & 20 deletions assets/js/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,66 @@

'use strict';

// export const weekDayNames = [
// "Sunday",
// "Monday",
// "Tuesday",
// "Wednesday",
// "Thursday",
// "Friday",
// "Saturday"
// ];
export const weekDayNames = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
"星期天",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六"
];

// export const monthNames = [
// "Jan",
// "Feb",
// "Mar",
// "Apr",
// "May",
// "Jun",
// "Jul",
// "Aug",
// "Sep",
// "Oct",
// "Nov",
// "Dec"
// ];
// export const monthNames = [
// "一月",
// "二月",
// "三月",
// "四月",
// "五月",
// "六月",
// "七月",
// "八月",
// "九月",
// "十月",
// "十一月",
// "十二月"
// ];
export const monthNames = [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12"
];

/**
Expand All @@ -43,7 +80,7 @@ export const getDate = function (dateUnix, timezone) {
const weekDayName = weekDayNames[date.getUTCDay()];
const monthName = monthNames[date.getUTCMonth()];

return `${weekDayName} ${date.getUTCDate()}, ${monthName}`;
return `${weekDayName} ${monthName} / ${date.getUTCDate()}`;
}
/**
*
Expand Down
5 changes: 0 additions & 5 deletions favicon.svg

This file was deleted.

Loading

0 comments on commit f69f7e8

Please sign in to comment.