Spaces:
Running
Running
File size: 24,209 Bytes
4e651bd 0379fba 4e651bd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>آلة حاسبة كيميائية سلفات الماغنسيوم - Chemist/ Mostafa Hassan</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap');
body {
font-family: 'Tajawal', sans-serif;
background-color: #f8fafc;
}
.gradient-bg {
background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
}
.input-field {
transition: all 0.3s ease;
}
.input-field:focus {
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}
.result-card {
background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}
.floating-label {
position: absolute;
right: 1rem;
top: -0.5rem;
background-color: white;
padding: 0 0.5rem;
font-size: 0.75rem;
color: #4b5563;
}
.animate-bounce-once {
animation: bounceOnce 0.5s;
}
@keyframes bounceOnce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-5px); }
}
</style>
</head>
<body class="min-h-screen bg-gray-50">
<div class="gradient-bg text-white py-6 shadow-lg">
<div class="container mx-auto px-4">
<div class="flex items-center justify-between">
<div>
<h1 class="text-3xl font-bold">آلة حاسبة كيميائية</h1>
<p class="text-blue-100 mt-1">Chemist/ Mostafa Hassan</p>
</div>
<div class="bg-white/20 p-3 rounded-full">
<i class="fas fa-flask text-2xl"></i>
</div>
</div>
</div>
</div>
<div class="container mx-auto px-4 py-8">
<!-- Section 1: Water Molecules Calculation -->
<div class="bg-white rounded-xl shadow-md overflow-hidden mb-8 transition-all duration-300 hover:shadow-lg">
<div class="gradient-bg px-6 py-4 flex items-center">
<i class="fas fa-tint text-white text-xl mr-3"></i>
<h2 class="text-xl font-bold text-white">حساب عدد جزيئات الماء (x)</h2>
</div>
<div class="p-6">
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6">
<div class="relative">
<div class="floating-label">وزن الجفنة فارغة (جم)</div>
<div class="relative mt-2">
<input type="number" id="emptyCrucibleWeight" step="0.001"
class="input-field w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:border-blue-500">
<div class="absolute left-3 top-3 text-gray-400">g</div>
</div>
</div>
<div class="relative">
<div class="floating-label">وزن العينة (جم)</div>
<div class="relative mt-2">
<input type="number" id="sampleWeightSection1" step="0.001"
class="input-field w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:border-blue-500">
<div class="absolute left-3 top-3 text-gray-400">g</div>
</div>
</div>
<div class="relative">
<div class="floating-label">وزن الجفنة بعد الحرق (جم)</div>
<div class="relative mt-2">
<input type="number" id="crucibleWeightAfterBurning" step="0.001"
class="input-field w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:border-blue-500">
<div class="absolute left-3 top-3 text-gray-400">g</div>
</div>
</div>
</div>
<button onclick="calculateX()"
class="gradient-bg text-white px-6 py-3 rounded-lg font-medium hover:opacity-90 transition-all flex items-center justify-center">
<i class="fas fa-calculator ml-2"></i>
احسب عدد جزيئات الماء (x)
</button>
<div id="xResult" class="mt-6 hidden">
<div class="result-card p-5 rounded-lg border border-blue-100">
<div class="flex items-center justify-between">
<h3 class="font-bold text-lg text-gray-800">النتيجة:</h3>
<div class="bg-blue-100 text-blue-800 px-3 py-1 rounded-full text-sm font-medium">
<i class="fas fa-water mr-1"></i> جزيئات الماء
</div>
</div>
<div class="mt-3 text-2xl font-bold text-blue-600" id="xValue"></div>
<div class="mt-2 text-sm text-gray-600" id="xDetails"></div>
</div>
</div>
</div>
</div>
<!-- Section 2: Purity and Elements Calculation -->
<div class="bg-white rounded-xl shadow-md overflow-hidden mb-8 transition-all duration-300 hover:shadow-lg">
<div class="gradient-bg px-6 py-4 flex items-center">
<i class="fas fa-percentage text-white text-xl mr-3"></i>
<h2 class="text-xl font-bold text-white">حساب النقاوة ونسب العناصر</h2>
</div>
<div class="p-6">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-6">
<div class="relative">
<div class="floating-label">وزن العينة (جم)</div>
<div class="relative mt-2">
<input type="number" id="sampleWeightSection2" step="0.001"
class="input-field w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:border-blue-500">
<div class="absolute left-3 top-3 text-gray-400">g</div>
</div>
</div>
<div class="relative">
<div class="floating-label">حجم السحبة (مل)</div>
<div class="relative mt-2">
<input type="number" id="aliquotVolume" step="0.001"
class="input-field w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:border-blue-500">
<div class="absolute left-3 top-3 text-gray-400">ml</div>
</div>
</div>
<div class="relative">
<div class="floating-label">الحجم النازل من السحاحة (مل)</div>
<div class="relative mt-2">
<input type="number" id="titrantVolume" step="0.001"
class="input-field w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:border-blue-500">
<div class="absolute left-3 top-3 text-gray-400">ml</div>
</div>
</div>
<div class="relative">
<div class="floating-label">عيارية EDTA (مول/لتر)</div>
<div class="relative mt-2">
<input type="number" id="edtaMolarity" step="0.001" value="0.01"
class="input-field w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:border-blue-500">
<div class="absolute left-3 top-3 text-gray-400">M</div>
</div>
</div>
</div>
<button onclick="calculatePurityAndElements()"
class="gradient-bg text-white px-6 py-3 rounded-lg font-medium hover:opacity-90 transition-all flex items-center justify-center">
<i class="fas fa-atom ml-2"></i>
احسب النقاوة ونسب العناصر
</button>
<div id="purityResults" class="mt-6 hidden">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<!-- Purity Card -->
<div class="result-card p-5 rounded-lg border border-blue-100">
<div class="flex items-center justify-between">
<h3 class="font-bold text-lg text-gray-800">النقاوة</h3>
<div class="bg-green-100 text-green-800 px-3 py-1 rounded-full text-sm font-medium">
<i class="fas fa-certificate mr-1"></i> النقاوة
</div>
</div>
<div class="mt-3 flex items-end">
<div class="text-3xl font-bold text-green-600" id="purityValue"></div>
<div class="text-xl text-green-600 mb-1 ml-1">%</div>
</div>
<div class="mt-4">
<label class="block text-sm font-medium text-gray-700 mb-1">تعديل النقاوة يدويًا:</label>
<div class="relative">
<input type="number" id="manualPurity" step="0.001"
class="input-field w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:border-blue-500">
<div class="absolute left-3 top-2.5 text-gray-400">%</div>
</div>
</div>
</div>
<!-- Elements Card -->
<div class="result-card p-5 rounded-lg border border-blue-100">
<div class="flex items-center justify-between">
<h3 class="font-bold text-lg text-gray-800">نسب العناصر</h3>
<div class="bg-purple-100 text-purple-800 px-3 py-1 rounded-full text-sm font-medium">
<i class="fas fa-chart-pie mr-1"></i> العناصر
</div>
</div>
<div class="mt-3 grid grid-cols-2 gap-4" id="elementsResult">
<!-- Elements will be populated here -->
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Info Section -->
<div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
<div class="bg-gray-800 px-6 py-4 flex items-center">
<i class="fas fa-info-circle text-white text-xl mr-3"></i>
<h2 class="text-xl font-bold text-white">معلومات عن الآلة الحاسبة</h2>
</div>
<div class="p-6">
<div class="prose prose-sm max-w-none text-gray-700">
<p>هذه الآلة الحاسبة تساعد في:</p>
<ul class="list-disc pr-5">
<li>حساب عدد جزيئات الماء (x) في مركب MgSO₄·xH₂O</li>
<li>تحديد نقاوة العينة بناءً على معايرة EDTA</li>
<li>حساب نسب العناصر المختلفة في المركب</li>
</ul>
<div class="mt-4 p-4 bg-blue-50 rounded-lg border border-blue-200">
<div class="flex items-start">
<div class="flex-shrink-0 pt-1">
<i class="fas fa-lightbulb text-blue-500"></i>
</div>
<div class="mr-3">
<h4 class="text-sm font-medium text-blue-800">نصيحة:</h4>
<p class="mt-1 text-sm text-blue-700">
تأكد من إدخال جميع القيم بدقة للحصول على نتائج موثوقة. يمكنك تعديل قيمة النقاوة يدويًا لرؤية تأثيرها على نسب العناصر.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<footer class="gradient-bg text-white py-6">
<div class="container mx-auto px-4 text-center">
<p>تم تطويره بواسطة Chemist/ Mostafa Hassan</p>
<div class="mt-3 flex justify-center space-x-4">
<a href="#" class="text-white hover:text-blue-200 transition-colors">
<i class="fab fa-facebook-f"></i>
</a>
<a href="#" class="text-white hover:text-blue-200 transition-colors">
<i class="fab fa-twitter"></i>
</a>
<a href="#" class="text-white hover:text-blue-200 transition-colors">
<i class="fab fa-linkedin-in"></i>
</a>
<a href="#" class="text-white hover:text-blue-200 transition-colors">
<i class="fab fa-github"></i>
</a>
</div>
</div>
</footer>
<script>
// Section 1: Water Molecules Calculation
function calculateX() {
const emptyCrucibleWeight = parseFloat(document.getElementById('emptyCrucibleWeight').value);
const sampleWeight = parseFloat(document.getElementById('sampleWeightSection1').value);
const crucibleWeightAfterBurning = parseFloat(document.getElementById('crucibleWeightAfterBurning').value);
if (isNaN(emptyCrucibleWeight) || isNaN(sampleWeight) || isNaN(crucibleWeightAfterBurning)) {
showError('xResult', 'يرجى إدخال جميع القيم بشكل صحيح.');
return;
}
// وزن العينة بعد الحرق (MgSO4)
const sampleWeightAfterBurning = crucibleWeightAfterBurning - emptyCrucibleWeight;
// وزن الماء المفقود
const waterWeight = sampleWeight - sampleWeightAfterBurning;
// عدد مولات MgSO4
const molesMgSO4 = sampleWeightAfterBurning / 120; // الكتلة المولية لـ MgSO4 = 120
// عدد مولات H2O
const molesH2O = waterWeight / 18; // الكتلة المولية لـ H2O = 18
// حساب x
const x = molesH2O / molesMgSO4;
const roundedX = Math.round(x);
// Display results
document.getElementById('xValue').textContent = roundedX;
document.getElementById('xDetails').innerHTML = `
<div class="grid grid-cols-2 gap-2 mt-3">
<div class="bg-gray-100 p-2 rounded">
<div class="text-xs text-gray-500">وزن الماء المفقود</div>
<div class="font-medium">${waterWeight.toFixed(3)} جم</div>
</div>
<div class="bg-gray-100 p-2 rounded">
<div class="text-xs text-gray-500">مولات الماء</div>
<div class="font-medium">${molesH2O.toFixed(5)} مول</div>
</div>
<div class="bg-gray-100 p-2 rounded">
<div class="text-xs text-gray-500">مولات MgSO₄</div>
<div class="font-medium">${molesMgSO4.toFixed(5)} مول</div>
</div>
<div class="bg-gray-100 p-2 rounded">
<div class="text-xs text-gray-500">القيمة الدقيقة</div>
<div class="font-medium">${x.toFixed(2)}</div>
</div>
</div>
`;
document.getElementById('xResult').classList.remove('hidden');
document.getElementById('xResult').classList.add('animate-bounce-once');
setTimeout(() => {
document.getElementById('xResult').classList.remove('animate-bounce-once');
}, 500);
}
// Section 2: Purity and Elements Calculation
function calculatePurityAndElements() {
const sampleWeight = parseFloat(document.getElementById('sampleWeightSection2').value);
const aliquotVolume = parseFloat(document.getElementById('aliquotVolume').value);
const titrantVolume = parseFloat(document.getElementById('titrantVolume').value);
const edtaMolarity = parseFloat(document.getElementById('edtaMolarity').value);
if (isNaN(sampleWeight) || isNaN(aliquotVolume) || isNaN(titrantVolume) || isNaN(edtaMolarity)) {
showError('purityResults', 'يرجى إدخال جميع القيم بشكل صحيح.');
return;
}
// عدد مولات EDTA
const molesEDTA = edtaMolarity * (titrantVolume / 1000);
// عدد مولات Mg2+ في السحبة
const molesMg = molesEDTA; // التفاعل 1:1
// تركيز Mg2+ في السحبة
const mgConcentration = molesMg / (aliquotVolume / 1000);
// عدد مولات Mg2+ في الفلاسك (500 مل)
const molesMgInFlask = mgConcentration * 0.5; // 500 مل = 0.5 لتر
// وزن MgSO4 الفعلي
const mgSO4Weight = molesMgInFlask * 120; // الكتلة المولية لـ MgSO4 = 120
// النقاوة
const purity = (mgSO4Weight / sampleWeight) * 100;
// عرض النقاوة
document.getElementById('purityValue').textContent = purity.toFixed(2);
document.getElementById('manualPurity').value = purity.toFixed(2);
// حساب نسب العناصر
updateElementPercentages();
document.getElementById('purityResults').classList.remove('hidden');
document.getElementById('purityResults').classList.add('animate-bounce-once');
setTimeout(() => {
document.getElementById('purityResults').classList.remove('animate-bounce-once');
}, 500);
}
// Function to update element percentages based on purity (calculated or manual)
function updateElementPercentages() {
const purity = parseFloat(document.getElementById('manualPurity').value);
if (isNaN(purity)) {
showError('elementsResult', 'يرجى إدخال قيمة نقاوة صحيحة.');
return;
}
// الكتلة المولية لـ MgSO4·7H2O = 246 (لأن x = 7)
const molarMassMgSO4_7H2O = 246;
const molarMassMgSO4 = 120;
const molarMassMgO = 40;
const molarMassMg = 24;
const molarMassS = 32;
const molarMassO = 16;
// حساب النسب
const mgSO4Percentage = (molarMassMgSO4 / molarMassMgSO4_7H2O) * purity;
const mgoPercentage = (molarMassMgO / molarMassMgSO4_7H2O) * purity;
const mgPercentage = (molarMassMg / molarMassMgSO4_7H2O) * purity;
const sPercentage = (molarMassS / molarMassMgSO4_7H2O) * purity;
const oPercentage = (molarMassO * 4 / molarMassMgSO4_7H2O) * purity;
// عرض النتائج
document.getElementById('elementsResult').innerHTML = `
<div class="bg-blue-50 p-3 rounded-lg">
<div class="text-xs text-blue-600">MgSO₄</div>
<div class="font-bold text-blue-800">${mgSO4Percentage.toFixed(2)}%</div>
</div>
<div class="bg-green-50 p-3 rounded-lg">
<div class="text-xs text-green-600">MgO</div>
<div class="font-bold text-green-800">${mgoPercentage.toFixed(2)}%</div>
</div>
<div class="bg-purple-50 p-3 rounded-lg">
<div class="text-xs text-purple-600">Mg</div>
<div class="font-bold text-purple-800">${mgPercentage.toFixed(2)}%</div>
</div>
<div class="bg-yellow-50 p-3 rounded-lg">
<div class="text-xs text-yellow-600">S</div>
<div class="font-bold text-yellow-800">${sPercentage.toFixed(2)}%</div>
</div>
<div class="bg-red-50 p-3 rounded-lg">
<div class="text-xs text-red-600">O</div>
<div class="font-bold text-red-800">${oPercentage.toFixed(2)}%</div>
</div>
<div class="bg-indigo-50 p-3 rounded-lg">
<div class="text-xs text-indigo-600">H₂O</div>
<div class="font-bold text-indigo-800">${(100 - purity).toFixed(2)}%</div>
</div>
`;
}
// Helper function to show errors
function showError(elementId, message) {
const element = document.getElementById(elementId);
element.innerHTML = `
<div class="bg-red-50 border-l-4 border-red-500 p-4">
<div class="flex">
<div class="flex-shrink-0">
<i class="fas fa-exclamation-circle text-red-500"></i>
</div>
<div class="mr-3">
<p class="text-sm text-red-700">${message}</p>
</div>
</div>
</div>
`;
element.classList.remove('hidden');
}
// Initialize manual purity input to trigger updates
document.getElementById('manualPurity').addEventListener('input', updateElementPercentages);
</script>
<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=Mustafa7assan/mgso4-2" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |