joung commited on
Commit
72d5180
ยท
verified ยท
1 Parent(s): 8cee642

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +6 -4
  2. index.html +529 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: S S
3
- emoji: ๐Ÿ“š
4
  colorFrom: blue
5
- colorTo: purple
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
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ ์ผ๊ธฐ์˜ˆ๋ณด ์‚ฌ์ดํŠธ๋ฅผ ๋งŒ๋“ค์–ด์ค˜