Add 3 files
Browse files- README.md +6 -4
- index.html +529 -19
- prompts.txt +1 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: blue
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: s-s
|
| 3 |
+
emoji: ๐ณ
|
| 4 |
colorFrom: blue
|
| 5 |
+
colorTo: yellow
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,529 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="ko">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>๋ ์จ์๋ณด - ์ค์๊ฐ ์ผ๊ธฐ์๋ณด ์๋น์ค</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');
|
| 11 |
+
|
| 12 |
+
body {
|
| 13 |
+
font-family: 'Noto Sans KR', sans-serif;
|
| 14 |
+
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
| 15 |
+
min-height: 100vh;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
.weather-card {
|
| 19 |
+
background: rgba(255, 255, 255, 0.25);
|
| 20 |
+
backdrop-filter: blur(10px);
|
| 21 |
+
-webkit-backdrop-filter: blur(10px);
|
| 22 |
+
border-radius: 20px;
|
| 23 |
+
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
|
| 24 |
+
transition: all 0.3s ease;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
.weather-card:hover {
|
| 28 |
+
transform: translateY(-5px);
|
| 29 |
+
box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.25);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
.search-input:focus {
|
| 33 |
+
outline: none;
|
| 34 |
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.temperature {
|
| 38 |
+
font-size: 4rem;
|
| 39 |
+
font-weight: 300;
|
| 40 |
+
background: linear-gradient(to right, #3b82f6, #10b981);
|
| 41 |
+
-webkit-background-clip: text;
|
| 42 |
+
-webkit-text-fill-color: transparent;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.hourly-forecast::-webkit-scrollbar {
|
| 46 |
+
height: 6px;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
.hourly-forecast::-webkit-scrollbar-thumb {
|
| 50 |
+
background: rgba(59, 130, 246, 0.5);
|
| 51 |
+
border-radius: 3px;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
.loading-spinner {
|
| 55 |
+
border-top-color: #3b82f6;
|
| 56 |
+
animation: spin 1s linear infinite;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
@keyframes spin {
|
| 60 |
+
to { transform: rotate(360deg); }
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
.sunny-bg {
|
| 64 |
+
background: linear-gradient(to bottom right, #FFD700, #FF8C00);
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
.cloudy-bg {
|
| 68 |
+
background: linear-gradient(to bottom right, #B0C4DE, #778899);
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
.rainy-bg {
|
| 72 |
+
background: linear-gradient(to bottom right, #4682B4, #1E90FF);
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
.snowy-bg {
|
| 76 |
+
background: linear-gradient(to bottom right, #E6E6FA, #ADD8E6);
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
.thunder-bg {
|
| 80 |
+
background: linear-gradient(to bottom right, #4B0082, #9932CC);
|
| 81 |
+
}
|
| 82 |
+
</style>
|
| 83 |
+
</head>
|
| 84 |
+
<body class="text-gray-800">
|
| 85 |
+
<div class="container mx-auto px-4 py-8 max-w-6xl">
|
| 86 |
+
<!-- ํค๋ -->
|
| 87 |
+
<header class="flex flex-col md:flex-row justify-between items-center mb-8">
|
| 88 |
+
<div class="flex items-center mb-4 md:mb-0">
|
| 89 |
+
<i class="fas fa-cloud-sun text-4xl text-blue-500 mr-3"></i>
|
| 90 |
+
<h1 class="text-3xl font-bold bg-gradient-to-r from-blue-500 to-green-500 bg-clip-text text-transparent">๋ ์จ์๋ณด</h1>
|
| 91 |
+
</div>
|
| 92 |
+
|
| 93 |
+
<!-- ๊ฒ์์ฐฝ -->
|
| 94 |
+
<div class="relative w-full md:w-64">
|
| 95 |
+
<input
|
| 96 |
+
type="text"
|
| 97 |
+
id="search-input"
|
| 98 |
+
placeholder="๋์ ๊ฒ์ (์: ์์ธ, ๋ถ์ฐ)"
|
| 99 |
+
class="w-full px-4 py-2 pr-10 rounded-full border border-gray-300 focus:border-blue-400 search-input"
|
| 100 |
+
>
|
| 101 |
+
<button id="search-btn" class="absolute right-3 top-2 text-gray-500 hover:text-blue-500">
|
| 102 |
+
<i class="fas fa-search"></i>
|
| 103 |
+
</button>
|
| 104 |
+
</div>
|
| 105 |
+
</header>
|
| 106 |
+
|
| 107 |
+
<!-- ๋ก๋ฉ ์คํผ๋ -->
|
| 108 |
+
<div id="loading" class="hidden flex justify-center items-center py-20">
|
| 109 |
+
<div class="loading-spinner h-12 w-12 border-4 border-blue-200 rounded-full"></div>
|
| 110 |
+
</div>
|
| 111 |
+
|
| 112 |
+
<!-- ๋ฉ์ธ ๋ ์จ ์ ๋ณด -->
|
| 113 |
+
<div id="weather-container" class="hidden">
|
| 114 |
+
<!-- ํ์ฌ ๋ ์จ -->
|
| 115 |
+
<div id="current-weather" class="weather-card p-6 mb-6">
|
| 116 |
+
<div class="flex flex-col md:flex-row justify-between items-center">
|
| 117 |
+
<div class="mb-4 md:mb-0">
|
| 118 |
+
<div class="flex items-center">
|
| 119 |
+
<h2 id="location" class="text-2xl font-bold mr-2">์์ธํน๋ณ์</h2>
|
| 120 |
+
<span id="country" class="text-gray-600">๋ํ๋ฏผ๊ตญ</span>
|
| 121 |
+
</div>
|
| 122 |
+
<p id="date-time" class="text-gray-600">2023๋
7์ 15์ผ ์คํ 3:00</p>
|
| 123 |
+
<div class="flex items-center mt-2">
|
| 124 |
+
<div id="weather-icon" class="text-5xl mr-3">
|
| 125 |
+
<i class="fas fa-sun text-yellow-400"></i>
|
| 126 |
+
</div>
|
| 127 |
+
<p id="weather-description" class="text-lg">๋ง์</p>
|
| 128 |
+
</div>
|
| 129 |
+
</div>
|
| 130 |
+
|
| 131 |
+
<div class="text-center">
|
| 132 |
+
<div class="temperature" id="current-temp">24ยฐC</div>
|
| 133 |
+
<div class="flex justify-center space-x-4 mt-2">
|
| 134 |
+
<div>
|
| 135 |
+
<p class="text-gray-600">์ต๊ณ </p>
|
| 136 |
+
<p id="max-temp" class="font-medium">28ยฐC</p>
|
| 137 |
+
</div>
|
| 138 |
+
<div>
|
| 139 |
+
<p class="text-gray-600">์ต์ </p>
|
| 140 |
+
<p id="min-temp" class="font-medium">18ยฐC</p>
|
| 141 |
+
</div>
|
| 142 |
+
</div>
|
| 143 |
+
</div>
|
| 144 |
+
|
| 145 |
+
<div class="grid grid-cols-2 gap-4 mt-4 md:mt-0">
|
| 146 |
+
<div class="flex items-center">
|
| 147 |
+
<i class="fas fa-wind text-blue-400 mr-2"></i>
|
| 148 |
+
<div>
|
| 149 |
+
<p class="text-gray-600">๋ฐ๋</p>
|
| 150 |
+
<p id="wind-speed" class="font-medium">5 km/h</p>
|
| 151 |
+
</div>
|
| 152 |
+
</div>
|
| 153 |
+
<div class="flex items-center">
|
| 154 |
+
<i class="fas fa-tint text-blue-400 mr-2"></i>
|
| 155 |
+
<div>
|
| 156 |
+
<p class="text-gray-600">์ต๋</p>
|
| 157 |
+
<p id="humidity" class="font-medium">65%</p>
|
| 158 |
+
</div>
|
| 159 |
+
</div>
|
| 160 |
+
<div class="flex items-center">
|
| 161 |
+
<i class="fas fa-compress-arrows-alt text-blue-400 mr-2"></i>
|
| 162 |
+
<div>
|
| 163 |
+
<p class="text-gray-600">๊ธฐ์</p>
|
| 164 |
+
<p id="pressure" class="font-medium">1012 hPa</p>
|
| 165 |
+
</div>
|
| 166 |
+
</div>
|
| 167 |
+
<div class="flex items-center">
|
| 168 |
+
<i class="fas fa-eye text-blue-400 mr-2"></i>
|
| 169 |
+
<div>
|
| 170 |
+
<p class="text-gray-600">๊ฐ์๊ฑฐ๋ฆฌ</p>
|
| 171 |
+
<p id="visibility" class="font-medium">10 km</p>
|
| 172 |
+
</div>
|
| 173 |
+
</div>
|
| 174 |
+
</div>
|
| 175 |
+
</div>
|
| 176 |
+
</div>
|
| 177 |
+
|
| 178 |
+
<!-- ์๊ฐ๋ณ ์๋ณด -->
|
| 179 |
+
<div class="mb-6">
|
| 180 |
+
<h3 class="text-xl font-bold mb-3 flex items-center">
|
| 181 |
+
<i class="fas fa-clock text-blue-500 mr-2"></i>
|
| 182 |
+
์๊ฐ๋ณ ์๋ณด
|
| 183 |
+
</h3>
|
| 184 |
+
<div id="hourly-forecast" class="hourly-forecast flex overflow-x-auto pb-2 space-x-4">
|
| 185 |
+
<!-- ์๊ฐ๋ณ ์๋ณด ์นด๋๋ค์ด ์ฌ๊ธฐ์ ์ถ๊ฐ๋ฉ๋๋ค -->
|
| 186 |
+
</div>
|
| 187 |
+
</div>
|
| 188 |
+
|
| 189 |
+
<!-- ์ฃผ๊ฐ ์๋ณด -->
|
| 190 |
+
<div>
|
| 191 |
+
<h3 class="text-xl font-bold mb-3 flex items-center">
|
| 192 |
+
<i class="fas fa-calendar-alt text-blue-500 mr-2"></i>
|
| 193 |
+
5์ผ๊ฐ์ ์ผ๊ธฐ์๋ณด
|
| 194 |
+
</h3>
|
| 195 |
+
<div id="daily-forecast" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-4">
|
| 196 |
+
<!-- ์ฃผ๊ฐ ์๋ณด ์นด๋๋ค์ด ์ฌ๊ธฐ์ ์ถ๊ฐ๋ฉ๋๋ค -->
|
| 197 |
+
</div>
|
| 198 |
+
</div>
|
| 199 |
+
</div>
|
| 200 |
+
|
| 201 |
+
<!-- ์ด๊ธฐ ๋ฉ์์ง -->
|
| 202 |
+
<div id="initial-message" class="text-center py-20">
|
| 203 |
+
<i class="fas fa-cloud-sun text-6xl text-blue-300 mb-4"></i>
|
| 204 |
+
<h2 class="text-2xl font-bold text-gray-700 mb-2">๋ ์จ ์ ๋ณด๋ฅผ ํ์ธํ์ธ์</h2>
|
| 205 |
+
<p class="text-gray-600 mb-6">๊ฒ์์ฐฝ์ ๋์ ์ด๋ฆ์ ์
๋ ฅํ๋ฉด ์ค์๊ฐ ๋ ์จ ์ ๋ณด๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.</p>
|
| 206 |
+
<button id="use-current-location" class="px-6 py-2 bg-blue-500 text-white rounded-full hover:bg-blue-600 transition">
|
| 207 |
+
<i class="fas fa-location-arrow mr-2"></i>ํ์ฌ ์์น ์ฌ์ฉ
|
| 208 |
+
</button>
|
| 209 |
+
</div>
|
| 210 |
+
</div>
|
| 211 |
+
|
| 212 |
+
<script>
|
| 213 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 214 |
+
// API ํค (์ค์ ํ๋ก์ ํธ์์๋ ์๋ฒ ์ฌ์ด๋์์ ์ฒ๋ฆฌํ๋ ๊ฒ์ด ์ข์ต๋๋ค)
|
| 215 |
+
const API_KEY = '5d4ae9954b1c58b1a0c1c9f3a0d6a5a';
|
| 216 |
+
|
| 217 |
+
// DOM ์์
|
| 218 |
+
const searchInput = document.getElementById('search-input');
|
| 219 |
+
const searchBtn = document.getElementById('search-btn');
|
| 220 |
+
const useCurrentLocationBtn = document.getElementById('use-current-location');
|
| 221 |
+
const weatherContainer = document.getElementById('weather-container');
|
| 222 |
+
const loading = document.getElementById('loading');
|
| 223 |
+
const initialMessage = document.getElementById('initial-message');
|
| 224 |
+
|
| 225 |
+
// ๊ธฐ๋ณธ์ผ๋ก ์์ธ ๋ ์จ ํ์
|
| 226 |
+
fetchWeather('Seoul');
|
| 227 |
+
|
| 228 |
+
// ๊ฒ์ ๋ฒํผ ํด๋ฆญ ์ด๋ฒคํธ
|
| 229 |
+
searchBtn.addEventListener('click', () => {
|
| 230 |
+
const city = searchInput.value.trim();
|
| 231 |
+
if (city) {
|
| 232 |
+
fetchWeather(city);
|
| 233 |
+
}
|
| 234 |
+
});
|
| 235 |
+
|
| 236 |
+
// ์ํฐ ํค ์ด๋ฒคํธ
|
| 237 |
+
searchInput.addEventListener('keypress', (e) => {
|
| 238 |
+
if (e.key === 'Enter') {
|
| 239 |
+
const city = searchInput.value.trim();
|
| 240 |
+
if (city) {
|
| 241 |
+
fetchWeather(city);
|
| 242 |
+
}
|
| 243 |
+
}
|
| 244 |
+
});
|
| 245 |
+
|
| 246 |
+
// ํ์ฌ ์์น ์ฌ์ฉ ๋ฒํผ
|
| 247 |
+
useCurrentLocationBtn.addEventListener('click', () => {
|
| 248 |
+
if (navigator.geolocation) {
|
| 249 |
+
navigator.geolocation.getCurrentPosition(
|
| 250 |
+
(position) => {
|
| 251 |
+
const { latitude, longitude } = position.coords;
|
| 252 |
+
fetchWeatherByCoords(latitude, longitude);
|
| 253 |
+
},
|
| 254 |
+
(error) => {
|
| 255 |
+
alert('์์น ์ ๋ณด๋ฅผ ๊ฐ์ ธ์ค๋๋ฐ ์คํจํ์ต๋๋ค. ์๋์ผ๋ก ๋์๋ฅผ ์
๋ ฅํด์ฃผ์ธ์.');
|
| 256 |
+
console.error(error);
|
| 257 |
+
}
|
| 258 |
+
);
|
| 259 |
+
} else {
|
| 260 |
+
alert('์ด ๋ธ๋ผ์ฐ์ ๋ ์์น ์ ๋ณด ๊ธฐ๋ฅ์ ์ง์ํ์ง ์์ต๋๋ค.');
|
| 261 |
+
}
|
| 262 |
+
});
|
| 263 |
+
|
| 264 |
+
// ๋ ์จ ์ ๋ณด ๊ฐ์ ธ์ค๊ธฐ
|
| 265 |
+
function fetchWeather(city) {
|
| 266 |
+
loading.classList.remove('hidden');
|
| 267 |
+
weatherContainer.classList.add('hidden');
|
| 268 |
+
initialMessage.classList.add('hidden');
|
| 269 |
+
|
| 270 |
+
fetch(`https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${API_KEY}&units=metric&lang=kr`)
|
| 271 |
+
.then(response => {
|
| 272 |
+
if (!response.ok) {
|
| 273 |
+
throw new Error('๋์๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค');
|
| 274 |
+
}
|
| 275 |
+
return response.json();
|
| 276 |
+
})
|
| 277 |
+
.then(data => {
|
| 278 |
+
displayCurrentWeather(data);
|
| 279 |
+
return fetch(`https://api.openweathermap.org/data/2.5/forecast?q=${city}&appid=${API_KEY}&units=metric&lang=kr`);
|
| 280 |
+
})
|
| 281 |
+
.then(response => response.json())
|
| 282 |
+
.then(data => {
|
| 283 |
+
displayForecast(data);
|
| 284 |
+
loading.classList.add('hidden');
|
| 285 |
+
weatherContainer.classList.remove('hidden');
|
| 286 |
+
})
|
| 287 |
+
.catch(error => {
|
| 288 |
+
console.error('Error:', error);
|
| 289 |
+
alert(error.message);
|
| 290 |
+
loading.classList.add('hidden');
|
| 291 |
+
initialMessage.classList.remove('hidden');
|
| 292 |
+
});
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
// ์ขํ๋ก ๋ ์จ ์ ๋ณด ๊ฐ์ ธ์ค๊ธฐ
|
| 296 |
+
function fetchWeatherByCoords(lat, lon) {
|
| 297 |
+
loading.classList.remove('hidden');
|
| 298 |
+
weatherContainer.classList.add('hidden');
|
| 299 |
+
initialMessage.classList.add('hidden');
|
| 300 |
+
|
| 301 |
+
fetch(`https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${lon}&appid=${API_KEY}&units=metric&lang=kr`)
|
| 302 |
+
.then(response => response.json())
|
| 303 |
+
.then(data => {
|
| 304 |
+
displayCurrentWeather(data);
|
| 305 |
+
return fetch(`https://api.openweathermap.org/data/2.5/forecast?lat=${lat}&lon=${lon}&appid=${API_KEY}&units=metric&lang=kr`);
|
| 306 |
+
})
|
| 307 |
+
.then(response => response.json())
|
| 308 |
+
.then(data => {
|
| 309 |
+
displayForecast(data);
|
| 310 |
+
loading.classList.add('hidden');
|
| 311 |
+
weatherContainer.classList.remove('hidden');
|
| 312 |
+
})
|
| 313 |
+
.catch(error => {
|
| 314 |
+
console.error('Error:', error);
|
| 315 |
+
alert('๋ ์จ ์ ๋ณด๋ฅผ ๊ฐ์ ธ์ค๋๋ฐ ์คํจํ์ต๋๋ค');
|
| 316 |
+
loading.classList.add('hidden');
|
| 317 |
+
initialMessage.classList.remove('hidden');
|
| 318 |
+
});
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
// ํ์ฌ ๋ ์จ ํ์
|
| 322 |
+
function displayCurrentWeather(data) {
|
| 323 |
+
const location = document.getElementById('location');
|
| 324 |
+
const country = document.getElementById('country');
|
| 325 |
+
const dateTime = document.getElementById('date-time');
|
| 326 |
+
const weatherIcon = document.getElementById('weather-icon');
|
| 327 |
+
const weatherDescription = document.getElementById('weather-description');
|
| 328 |
+
const currentTemp = document.getElementById('current-temp');
|
| 329 |
+
const maxTemp = document.getElementById('max-temp');
|
| 330 |
+
const minTemp = document.getElementById('min-temp');
|
| 331 |
+
const windSpeed = document.getElementById('wind-speed');
|
| 332 |
+
const humidity = document.getElementById('humidity');
|
| 333 |
+
const pressure = document.getElementById('pressure');
|
| 334 |
+
const visibility = document.getElementById('visibility');
|
| 335 |
+
|
| 336 |
+
// ์์น ์ ๋ณด
|
| 337 |
+
location.textContent = data.name;
|
| 338 |
+
country.textContent = data.sys.country;
|
| 339 |
+
|
| 340 |
+
// ๋ ์ง ๋ฐ ์๊ฐ
|
| 341 |
+
const now = new Date();
|
| 342 |
+
const options = {
|
| 343 |
+
year: 'numeric',
|
| 344 |
+
month: 'long',
|
| 345 |
+
day: 'numeric',
|
| 346 |
+
hour: '2-digit',
|
| 347 |
+
minute: '2-digit',
|
| 348 |
+
hour12: true
|
| 349 |
+
};
|
| 350 |
+
dateTime.textContent = now.toLocaleDateString('ko-KR', options);
|
| 351 |
+
|
| 352 |
+
// ๋ ์จ ์ ๋ณด
|
| 353 |
+
const weather = data.weather[0];
|
| 354 |
+
weatherDescription.textContent = weather.description;
|
| 355 |
+
currentTemp.textContent = `${Math.round(data.main.temp)}ยฐC`;
|
| 356 |
+
maxTemp.textContent = `${Math.round(data.main.temp_max)}ยฐC`;
|
| 357 |
+
minTemp.textContent = `${Math.round(data.main.temp_min)}ยฐC`;
|
| 358 |
+
windSpeed.textContent = `${Math.round(data.wind.speed * 3.6)} km/h`;
|
| 359 |
+
humidity.textContent = `${data.main.humidity}%`;
|
| 360 |
+
pressure.textContent = `${data.main.pressure} hPa`;
|
| 361 |
+
visibility.textContent = `${data.visibility / 1000} km`;
|
| 362 |
+
|
| 363 |
+
// ๋ ์จ ์์ด์ฝ ์ค์
|
| 364 |
+
setWeatherIcon(weatherIcon, weather.id, data.dt);
|
| 365 |
+
|
| 366 |
+
// ๋ฐฐ๊ฒฝ ์์ ๋ณ๊ฒฝ
|
| 367 |
+
setBackgroundByWeather(weather.id);
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
// ์๋ณด ์ ๋ณด ํ์
|
| 371 |
+
function displayForecast(data) {
|
| 372 |
+
const hourlyForecast = document.getElementById('hourly-forecast');
|
| 373 |
+
const dailyForecast = document.getElementById('daily-forecast');
|
| 374 |
+
|
| 375 |
+
// ์๊ฐ๋ณ ์๋ณด (๋ค์ 12์๊ฐ)
|
| 376 |
+
hourlyForecast.innerHTML = '';
|
| 377 |
+
for (let i = 0; i < 12; i++) {
|
| 378 |
+
const forecast = data.list[i];
|
| 379 |
+
const date = new Date(forecast.dt * 1000);
|
| 380 |
+
const hour = date.getHours();
|
| 381 |
+
|
| 382 |
+
const card = document.createElement('div');
|
| 383 |
+
card.className = 'weather-card flex-shrink-0 p-4 text-center min-w-[80px]';
|
| 384 |
+
card.innerHTML = `
|
| 385 |
+
<p class="font-medium">${hour}์</p>
|
| 386 |
+
<div class="my-2 text-2xl">
|
| 387 |
+
${getWeatherIcon(forecast.weather[0].id, forecast.dt)}
|
| 388 |
+
</div>
|
| 389 |
+
<p class="font-bold">${Math.round(forecast.main.temp)}ยฐC</p>
|
| 390 |
+
<p class="text-sm text-gray-600">${forecast.weather[0].description}</p>
|
| 391 |
+
`;
|
| 392 |
+
hourlyForecast.appendChild(card);
|
| 393 |
+
}
|
| 394 |
+
|
| 395 |
+
// ์ผ๋ณ ์๋ณด (5์ผ)
|
| 396 |
+
dailyForecast.innerHTML = '';
|
| 397 |
+
const dailyData = {};
|
| 398 |
+
|
| 399 |
+
// ๊ฐ์ ๋ ์ง์ ๋ฐ์ดํฐ ๊ทธ๋ฃนํ
|
| 400 |
+
data.list.forEach(forecast => {
|
| 401 |
+
const date = new Date(forecast.dt * 1000);
|
| 402 |
+
const dateStr = date.toLocaleDateString('ko-KR', { weekday: 'long', month: 'short', day: 'numeric' });
|
| 403 |
+
|
| 404 |
+
if (!dailyData[dateStr]) {
|
| 405 |
+
dailyData[dateStr] = {
|
| 406 |
+
temps: [],
|
| 407 |
+
weather: [],
|
| 408 |
+
dt: forecast.dt
|
| 409 |
+
};
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
dailyData[dateStr].temps.push(forecast.main.temp);
|
| 413 |
+
dailyData[dateStr].weather.push(forecast.weather[0]);
|
| 414 |
+
});
|
| 415 |
+
|
| 416 |
+
// ๊ฐ ๋ ์ง๋ณ๋ก ์นด๋ ์์ฑ
|
| 417 |
+
let count = 0;
|
| 418 |
+
for (const [date, info] of Object.entries(dailyData)) {
|
| 419 |
+
if (count >= 5) break;
|
| 420 |
+
|
| 421 |
+
// ๊ฐ์ฅ ๋น๋ฒํ ๋ ์จ ์ํ ์ฐพ๊ธฐ
|
| 422 |
+
const weatherCount = {};
|
| 423 |
+
info.weather.forEach(w => {
|
| 424 |
+
const key = w.id;
|
| 425 |
+
weatherCount[key] = (weatherCount[key] || 0) + 1;
|
| 426 |
+
});
|
| 427 |
+
|
| 428 |
+
const mostFrequentWeatherId = parseInt(Object.keys(weatherCount).reduce((a, b) =>
|
| 429 |
+
weatherCount[a] > weatherCount[b] ? a : b
|
| 430 |
+
));
|
| 431 |
+
|
| 432 |
+
const mostFrequentWeather = info.weather.find(w => w.id === mostFrequentWeatherId);
|
| 433 |
+
|
| 434 |
+
// ์ต๊ณ /์ต์ ๊ธฐ์จ ๊ณ์ฐ
|
| 435 |
+
const maxTemp = Math.round(Math.max(...info.temps));
|
| 436 |
+
const minTemp = Math.round(Math.min(...info.temps));
|
| 437 |
+
|
| 438 |
+
const card = document.createElement('div');
|
| 439 |
+
card.className = 'weather-card p-4';
|
| 440 |
+
card.innerHTML = `
|
| 441 |
+
<p class="font-bold text-lg mb-2">${date.split(' ')[0]} ${date.split(' ')[1]} ${date.split(' ')[2]}</p>
|
| 442 |
+
<div class="flex items-center justify-between">
|
| 443 |
+
<div class="text-4xl">
|
| 444 |
+
${getWeatherIcon(mostFrequentWeather.id, info.dt)}
|
| 445 |
+
</div>
|
| 446 |
+
<div class="text-right">
|
| 447 |
+
<p class="font-medium">${mostFrequentWeather.description}</p>
|
| 448 |
+
<p class="text-2xl font-bold">${Math.round((maxTemp + minTemp) / 2)}ยฐC</p>
|
| 449 |
+
<p class="text-sm text-gray-600">${maxTemp}ยฐ / ${minTemp}ยฐ</p>
|
| 450 |
+
</div>
|
| 451 |
+
</div>
|
| 452 |
+
`;
|
| 453 |
+
dailyForecast.appendChild(card);
|
| 454 |
+
count++;
|
| 455 |
+
}
|
| 456 |
+
}
|
| 457 |
+
|
| 458 |
+
// ๋ ์จ ์์ด์ฝ ์ค์
|
| 459 |
+
function setWeatherIcon(element, weatherId, timestamp) {
|
| 460 |
+
const isDay = isDayTime(timestamp);
|
| 461 |
+
element.innerHTML = getWeatherIcon(weatherId, timestamp, isDay);
|
| 462 |
+
}
|
| 463 |
+
|
| 464 |
+
// ๋ ์จ ID์ ๋ฐ๋ฅธ ์์ด์ฝ ๋ฐํ
|
| 465 |
+
function getWeatherIcon(weatherId, timestamp, isDay = null) {
|
| 466 |
+
if (isDay === null) {
|
| 467 |
+
isDay = isDayTime(timestamp);
|
| 468 |
+
}
|
| 469 |
+
|
| 470 |
+
// ๋ ์จ ์ฝ๋์ ๋ฐ๋ฅธ ์์ด์ฝ ์ค์ (OpenWeatherMap ๊ธฐ์ค)
|
| 471 |
+
if (weatherId >= 200 && weatherId < 300) {
|
| 472 |
+
return '<i class="fas fa-bolt text-purple-400"></i>'; // ๋ฒ๊ฐ
|
| 473 |
+
} else if (weatherId >= 300 && weatherId < 400) {
|
| 474 |
+
return '<i class="fas fa-cloud-rain text-blue-400"></i>'; // ์ด์ฌ๋น
|
| 475 |
+
} else if (weatherId >= 500 && weatherId < 600) {
|
| 476 |
+
return '<i class="fas fa-umbrella text-blue-500"></i>'; // ๋น
|
| 477 |
+
} else if (weatherId >= 600 && weatherId < 700) {
|
| 478 |
+
return '<i class="far fa-snowflake text-blue-200"></i>'; // ๋
|
| 479 |
+
} else if (weatherId >= 700 && weatherId < 800) {
|
| 480 |
+
return '<i class="fas fa-smog text-gray-400"></i>'; // ์๊ฐ ๋ฑ
|
| 481 |
+
} else if (weatherId === 800) {
|
| 482 |
+
return isDay
|
| 483 |
+
? '<i class="fas fa-sun text-yellow-400"></i>'
|
| 484 |
+
: '<i class="fas fa-moon text-blue-200"></i>';
|
| 485 |
+
} else if (weatherId === 801) {
|
| 486 |
+
return isDay
|
| 487 |
+
? '<i class="fas fa-cloud-sun text-yellow-300"></i>'
|
| 488 |
+
: '<i class="fas fa-cloud-moon text-blue-200"></i>';
|
| 489 |
+
} else if (weatherId > 801 && weatherId < 805) {
|
| 490 |
+
return '<i class="fas fa-cloud text-gray-300"></i>';
|
| 491 |
+
} else {
|
| 492 |
+
return '<i class="fas fa-question-circle text-gray-400"></i>';
|
| 493 |
+
}
|
| 494 |
+
}
|
| 495 |
+
|
| 496 |
+
// ๋ฐฐ๊ฒฝ ์์ ์ค์
|
| 497 |
+
function setBackgroundByWeather(weatherId) {
|
| 498 |
+
const body = document.body;
|
| 499 |
+
|
| 500 |
+
// ๊ธฐ์กด ํด๋์ค ์ ๊ฑฐ
|
| 501 |
+
body.classList.remove(
|
| 502 |
+
'sunny-bg', 'cloudy-bg', 'rainy-bg',
|
| 503 |
+
'snowy-bg', 'thunder-bg'
|
| 504 |
+
);
|
| 505 |
+
|
| 506 |
+
// ๋ ์จ์ ๋ฐ๋ฅธ ๋ฐฐ๊ฒฝ ํด๋์ค ์ถ๊ฐ
|
| 507 |
+
if (weatherId >= 200 && weatherId < 300) {
|
| 508 |
+
body.classList.add('thunder-bg');
|
| 509 |
+
} else if ((weatherId >= 300 && weatherId < 600) || weatherId === 701) {
|
| 510 |
+
body.classList.add('rainy-bg');
|
| 511 |
+
} else if (weatherId >= 600 && weatherId < 700) {
|
| 512 |
+
body.classList.add('snowy-bg');
|
| 513 |
+
} else if (weatherId === 800) {
|
| 514 |
+
body.classList.add('sunny-bg');
|
| 515 |
+
} else {
|
| 516 |
+
body.classList.add('cloudy-bg');
|
| 517 |
+
}
|
| 518 |
+
}
|
| 519 |
+
|
| 520 |
+
// ๋ฎ/๋ฐค ํ์ธ
|
| 521 |
+
function isDayTime(timestamp) {
|
| 522 |
+
const date = new Date(timestamp * 1000);
|
| 523 |
+
const hours = date.getHours();
|
| 524 |
+
return hours >= 6 && hours < 18;
|
| 525 |
+
}
|
| 526 |
+
});
|
| 527 |
+
</script>
|
| 528 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - ๐งฌ <a href="https://enzostvs-deepsite.hf.space?remix=joung/s-s" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 529 |
+
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
์ผ๊ธฐ์๋ณด ์ฌ์ดํธ๋ฅผ ๋ง๋ค์ด์ค
|