Spaces:
Sleeping
Sleeping
Update templates/weather_index.html
Browse files- templates/weather_index.html +17 -19
templates/weather_index.html
CHANGED
|
@@ -7,7 +7,6 @@
|
|
| 7 |
<link href="https://fonts.googleapis.com/css2?family=Cairo:wght@400;700&display=swap" rel="stylesheet">
|
| 8 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
<style>
|
| 10 |
-
/* ... (الأنماط تبقى كما هي) ... */
|
| 11 |
body {
|
| 12 |
font-family: 'Cairo', sans-serif;
|
| 13 |
background-color: #0b132b;
|
|
@@ -16,9 +15,7 @@
|
|
| 16 |
min-height: 100vh;
|
| 17 |
padding: 50px 20px;
|
| 18 |
direction: rtl;
|
| 19 |
-
|
| 20 |
-
justify-content: center;
|
| 21 |
-
align-items: flex-start;
|
| 22 |
}
|
| 23 |
.container {
|
| 24 |
background-color: #111a30;
|
|
@@ -29,6 +26,8 @@
|
|
| 29 |
max-width: 500px;
|
| 30 |
border: 1px solid #2a3a5a;
|
| 31 |
text-align: center;
|
|
|
|
|
|
|
| 32 |
}
|
| 33 |
h1 {
|
| 34 |
color: #00aaff;
|
|
@@ -92,10 +91,10 @@
|
|
| 92 |
justify-content: center;
|
| 93 |
align-items: center;
|
| 94 |
}
|
| 95 |
-
.temp-display i { /* استخدام أيقونات Font Awesome
|
| 96 |
font-size: 0.8em;
|
| 97 |
margin-left: 15px;
|
| 98 |
-
color: #FFD700;
|
| 99 |
}
|
| 100 |
.error-message {
|
| 101 |
color: #ff6b6b;
|
|
@@ -109,7 +108,7 @@
|
|
| 109 |
<h1><i class="fas fa-cloud-sun" style="margin-left: 10px;"></i> متتبع الطقس العالمي (مجاني 100%)</h1>
|
| 110 |
|
| 111 |
<form id="weatherForm">
|
| 112 |
-
<input type="text" id="city_name" name="city_name" placeholder="أدخل اسم المدينة (مثال:
|
| 113 |
<button type="submit"><i class="fas fa-search"></i></button>
|
| 114 |
</form>
|
| 115 |
|
|
@@ -121,7 +120,8 @@
|
|
| 121 |
<script>
|
| 122 |
// دالة مساعدة لتحويل رمز الطقس إلى أيقونة Font Awesome (بناءً على رموز WMO)
|
| 123 |
function getWeatherIcon(code) {
|
| 124 |
-
if (code
|
|
|
|
| 125 |
if (code >= 51 && code <= 55) return 'fas fa-cloud-drizzle'; // رذاذ
|
| 126 |
if (code >= 61 && code <= 65) return 'fas fa-cloud-showers-heavy'; // مطر
|
| 127 |
if (code >= 71 && code <= 75) return 'fas fa-snowflake'; // ثلج
|
|
@@ -158,30 +158,28 @@
|
|
| 158 |
resultBox.style.display = 'none';
|
| 159 |
} else {
|
| 160 |
const iconClass = getWeatherIcon(data.icon);
|
| 161 |
-
|
|
|
|
|
|
|
| 162 |
resultBox.innerHTML = `
|
| 163 |
-
<h2 style="color:#fff; margin-bottom: 20px;">${data.city}</h2>
|
| 164 |
|
| 165 |
<div class="temp-display">
|
| 166 |
<i class="${iconClass}"></i>
|
| 167 |
-
<span>${
|
| 168 |
</div>
|
| 169 |
|
| 170 |
-
<div class="result-item">
|
| 171 |
-
<span class="label">الدولة:</span>
|
| 172 |
-
<span class="value">${data.country}</span>
|
| 173 |
-
</div>
|
| 174 |
<div class="result-item">
|
| 175 |
<span class="label">الحالة:</span>
|
| 176 |
<span class="value">${data.description}</span>
|
| 177 |
</div>
|
| 178 |
<div class="result-item">
|
| 179 |
-
<span class="label">
|
| 180 |
-
<span class="value">${
|
| 181 |
</div>
|
| 182 |
<div class="result-item">
|
| 183 |
-
<span class="label">
|
| 184 |
-
<span class="value">${
|
| 185 |
</div>
|
| 186 |
`;
|
| 187 |
errorOutput.style.display = 'none';
|
|
|
|
| 7 |
<link href="https://fonts.googleapis.com/css2?family=Cairo:wght@400;700&display=swap" rel="stylesheet">
|
| 8 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
<style>
|
|
|
|
| 10 |
body {
|
| 11 |
font-family: 'Cairo', sans-serif;
|
| 12 |
background-color: #0b132b;
|
|
|
|
| 15 |
min-height: 100vh;
|
| 16 |
padding: 50px 20px;
|
| 17 |
direction: rtl;
|
| 18 |
+
/* ✅ تم إزالة خصائص Flexbox التي كانت تمنع التمرير */
|
|
|
|
|
|
|
| 19 |
}
|
| 20 |
.container {
|
| 21 |
background-color: #111a30;
|
|
|
|
| 26 |
max-width: 500px;
|
| 27 |
border: 1px solid #2a3a5a;
|
| 28 |
text-align: center;
|
| 29 |
+
/* ✅ لضمان التوسيط الأفقي بعد إزالة Flex من body */
|
| 30 |
+
margin: 0 auto;
|
| 31 |
}
|
| 32 |
h1 {
|
| 33 |
color: #00aaff;
|
|
|
|
| 91 |
justify-content: center;
|
| 92 |
align-items: center;
|
| 93 |
}
|
| 94 |
+
.temp-display i { /* استخدام أيقونات Font Awesome */
|
| 95 |
font-size: 0.8em;
|
| 96 |
margin-left: 15px;
|
| 97 |
+
color: #FFD700;
|
| 98 |
}
|
| 99 |
.error-message {
|
| 100 |
color: #ff6b6b;
|
|
|
|
| 108 |
<h1><i class="fas fa-cloud-sun" style="margin-left: 10px;"></i> متتبع الطقس العالمي (مجاني 100%)</h1>
|
| 109 |
|
| 110 |
<form id="weatherForm">
|
| 111 |
+
<input type="text" id="city_name" name="city_name" placeholder="أدخل اسم المدينة (مثال: Cairo)" required>
|
| 112 |
<button type="submit"><i class="fas fa-search"></i></button>
|
| 113 |
</form>
|
| 114 |
|
|
|
|
| 120 |
<script>
|
| 121 |
// دالة مساعدة لتحويل رمز الطقس إلى أيقونة Font Awesome (بناءً على رموز WMO)
|
| 122 |
function getWeatherIcon(code) {
|
| 123 |
+
if (code === 0) return 'fas fa-sun'; // صافية
|
| 124 |
+
if (code >= 1 && code <= 3) return 'fas fa-cloud-sun'; // مشمس جزئياً/غائم جزئياً
|
| 125 |
if (code >= 51 && code <= 55) return 'fas fa-cloud-drizzle'; // رذاذ
|
| 126 |
if (code >= 61 && code <= 65) return 'fas fa-cloud-showers-heavy'; // مطر
|
| 127 |
if (code >= 71 && code <= 75) return 'fas fa-snowflake'; // ثلج
|
|
|
|
| 158 |
resultBox.style.display = 'none';
|
| 159 |
} else {
|
| 160 |
const iconClass = getWeatherIcon(data.icon);
|
| 161 |
+
const formattedTemp = Math.round(data.temp);
|
| 162 |
+
const formattedFeelsLike = Math.round(data.feels_like);
|
| 163 |
+
|
| 164 |
resultBox.innerHTML = `
|
| 165 |
+
<h2 style="color:#fff; margin-bottom: 20px;">${data.city} (${data.country})</h2>
|
| 166 |
|
| 167 |
<div class="temp-display">
|
| 168 |
<i class="${iconClass}"></i>
|
| 169 |
+
<span>${formattedTemp}°C</span>
|
| 170 |
</div>
|
| 171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
<div class="result-item">
|
| 173 |
<span class="label">الحالة:</span>
|
| 174 |
<span class="value">${data.description}</span>
|
| 175 |
</div>
|
| 176 |
<div class="result-item">
|
| 177 |
+
<span class="label">ملموسة كـ:</span>
|
| 178 |
+
<span class="value">${formattedFeelsLike}°C</span>
|
| 179 |
</div>
|
| 180 |
<div class="result-item">
|
| 181 |
+
<span class="label">الرطوبة:</span>
|
| 182 |
+
<span class="value">${data.humidity}</span>
|
| 183 |
</div>
|
| 184 |
`;
|
| 185 |
errorOutput.style.display = 'none';
|