Spaces:
Running
Running
Add 2 files
Browse files- README.md +7 -5
- index.html +202 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 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: mgso4
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: pink
|
| 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,202 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="ar" dir="rtl">
|
| 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=Tajawal:wght@400;500;700&display=swap');
|
| 11 |
+
|
| 12 |
+
body {
|
| 13 |
+
font-family: 'Tajawal', sans-serif;
|
| 14 |
+
background-color: #f0f7f4;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
.card {
|
| 18 |
+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
|
| 19 |
+
transition: all 0.3s ease;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
.card:hover {
|
| 23 |
+
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
.input-field {
|
| 27 |
+
transition: all 0.3s ease;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
.input-field:focus {
|
| 31 |
+
border-color: #4f46e5;
|
| 32 |
+
box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
.btn-primary {
|
| 36 |
+
background-color: #4f46e5;
|
| 37 |
+
transition: all 0.3s ease;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
.btn-primary:hover {
|
| 41 |
+
background-color: #4338ca;
|
| 42 |
+
transform: translateY(-2px);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.result-card {
|
| 46 |
+
background: linear-gradient(135deg, #f0f7f4 0%, #e3f2fd 100%);
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
.floating-label {
|
| 50 |
+
transition: all 0.3s ease;
|
| 51 |
+
transform-origin: right center;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
input:focus + .floating-label,
|
| 55 |
+
input:not(:placeholder-shown) + .floating-label {
|
| 56 |
+
transform: translateY(-1.5rem) scale(0.85);
|
| 57 |
+
color: #4f46e5;
|
| 58 |
+
}
|
| 59 |
+
</style>
|
| 60 |
+
</head>
|
| 61 |
+
<body class="min-h-screen flex items-center justify-center p-4">
|
| 62 |
+
<div class="w-full max-w-md">
|
| 63 |
+
<div class="card bg-white rounded-xl overflow-hidden p-6">
|
| 64 |
+
<div class="text-center mb-6">
|
| 65 |
+
<div class="w-16 h-16 bg-indigo-100 rounded-full flex items-center justify-center mx-auto mb-4">
|
| 66 |
+
<i class="fas fa-flask text-indigo-600 text-2xl"></i>
|
| 67 |
+
</div>
|
| 68 |
+
<h1 class="text-2xl font-bold text-gray-800">حاسبة كبريتات المغنيسيوم</h1>
|
| 69 |
+
<p class="text-gray-600 mt-2">أدخل القيم لحساب خصائص العينة</p>
|
| 70 |
+
</div>
|
| 71 |
+
|
| 72 |
+
<form id="calculatorForm" class="space-y-4">
|
| 73 |
+
<div class="relative">
|
| 74 |
+
<input type="number" id="emptyWeight" class="input-field w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none" placeholder=" " step="0.0001">
|
| 75 |
+
<label for="emptyWeight" class="floating-label absolute right-4 top-3 text-gray-500 pointer-events-none">وزن الجفنة الفارغة (جم)</label>
|
| 76 |
+
</div>
|
| 77 |
+
|
| 78 |
+
<div class="relative">
|
| 79 |
+
<input type="number" id="beforeWeight" class="input-field w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none" placeholder=" " step="0.0001">
|
| 80 |
+
<label for="beforeWeight" class="floating-label absolute right-4 top-3 text-gray-500 pointer-events-none">وزن الجفنة + العينة قبل الحرق (جم)</label>
|
| 81 |
+
</div>
|
| 82 |
+
|
| 83 |
+
<div class="relative">
|
| 84 |
+
<input type="number" id="afterWeight" class="input-field w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none" placeholder=" " step="0.0001">
|
| 85 |
+
<label for="afterWeight" class="floating-label absolute right-4 top-3 text-gray-500 pointer-events-none">وزن الجفنة + العينة بعد الحرق (جم)</label>
|
| 86 |
+
</div>
|
| 87 |
+
|
| 88 |
+
<button type="submit" class="btn-primary w-full py-3 px-4 text-white font-medium rounded-lg flex items-center justify-center space-x-2">
|
| 89 |
+
<i class="fas fa-calculator"></i>
|
| 90 |
+
<span>احسب النتائج</span>
|
| 91 |
+
</button>
|
| 92 |
+
</form>
|
| 93 |
+
</div>
|
| 94 |
+
|
| 95 |
+
<div id="resultContainer" class="card result-card rounded-xl overflow-hidden p-6 mt-6 hidden">
|
| 96 |
+
<h2 class="text-xl font-bold text-gray-800 mb-4 flex items-center">
|
| 97 |
+
<i class="fas fa-chart-bar text-indigo-600 ml-2"></i>
|
| 98 |
+
<span>النتائج</span>
|
| 99 |
+
</h2>
|
| 100 |
+
|
| 101 |
+
<div class="space-y-3">
|
| 102 |
+
<div class="flex justify-between items-center py-2 border-b border-gray-200">
|
| 103 |
+
<span class="text-gray-600 font-medium">عدد جزيئات الماء (X)</span>
|
| 104 |
+
<span id="waterMolecules" class="font-bold text-indigo-600">-</span>
|
| 105 |
+
</div>
|
| 106 |
+
|
| 107 |
+
<div class="mt-4">
|
| 108 |
+
<h3 class="font-medium text-gray-700 mb-2">النسب النظرية:</h3>
|
| 109 |
+
<div class="grid grid-cols-2 gap-3">
|
| 110 |
+
<div class="bg-indigo-50 p-3 rounded-lg">
|
| 111 |
+
<div class="text-sm text-indigo-500">Mg</div>
|
| 112 |
+
<div id="mgPercent" class="font-bold text-indigo-700">- %</div>
|
| 113 |
+
</div>
|
| 114 |
+
<div class="bg-indigo-50 p-3 rounded-lg">
|
| 115 |
+
<div class="text-sm text-indigo-500">MgO</div>
|
| 116 |
+
<div id="mgoPercent" class="font-bold text-indigo-700">- %</div>
|
| 117 |
+
</div>
|
| 118 |
+
<div class="bg-indigo-50 p-3 rounded-lg">
|
| 119 |
+
<div class="text-sm text-indigo-500">MgSO₄</div>
|
| 120 |
+
<div id="mgso4Percent" class="font-bold text-indigo-700">- %</div>
|
| 121 |
+
</div>
|
| 122 |
+
<div class="bg-indigo-50 p-3 rounded-lg">
|
| 123 |
+
<div class="text-sm text-indigo-500">S</div>
|
| 124 |
+
<div id="sPercent" class="font-bold text-indigo-700">- %</div>
|
| 125 |
+
</div>
|
| 126 |
+
</div>
|
| 127 |
+
</div>
|
| 128 |
+
|
| 129 |
+
<div class="mt-4 bg-green-50 p-4 rounded-lg">
|
| 130 |
+
<div class="flex justify-between items-center">
|
| 131 |
+
<span class="text-green-700 font-medium">النقاوة</span>
|
| 132 |
+
<span id="purityPercent" class="font-bold text-green-700 text-xl">- %</span>
|
| 133 |
+
</div>
|
| 134 |
+
</div>
|
| 135 |
+
</div>
|
| 136 |
+
|
| 137 |
+
<button id="resetBtn" class="mt-6 w-full py-2 px-4 border border-gray-300 text-gray-700 font-medium rounded-lg hover:bg-gray-50 transition">
|
| 138 |
+
<i class="fas fa-redo mr-2"></i>
|
| 139 |
+
إعادة تعيين
|
| 140 |
+
</button>
|
| 141 |
+
</div>
|
| 142 |
+
</div>
|
| 143 |
+
|
| 144 |
+
<script>
|
| 145 |
+
document.getElementById('calculatorForm').addEventListener('submit', function(e) {
|
| 146 |
+
e.preventDefault();
|
| 147 |
+
|
| 148 |
+
try {
|
| 149 |
+
const w_empty = parseFloat(document.getElementById('emptyWeight').value);
|
| 150 |
+
const w_before = parseFloat(document.getElementById('beforeWeight').value);
|
| 151 |
+
const w_after = parseFloat(document.getElementById('afterWeight').value);
|
| 152 |
+
|
| 153 |
+
if (isNaN(w_empty) || isNaN(w_before) || isNaN(w_after)) {
|
| 154 |
+
throw new Error("يرجى إدخال قيم صحيحة");
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
const w_hydrate = w_before - w_empty;
|
| 158 |
+
const w_anhydrous = w_after - w_empty;
|
| 159 |
+
const w_water = w_before - w_after;
|
| 160 |
+
|
| 161 |
+
// حساب عدد جزيئات الماء X
|
| 162 |
+
const mol_MgSO4 = w_anhydrous / 120.36; // الكتلة المولية لـ MgSO4
|
| 163 |
+
const mol_H2O = w_water / 18.015; // الكتلة المولية للماء
|
| 164 |
+
const x = mol_H2O / mol_MgSO4;
|
| 165 |
+
|
| 166 |
+
// حساب النسب
|
| 167 |
+
const Mg = (24.305 / 246.47) * 100; // الكتلة المولية لـ Mg في MgSO4·7H2O
|
| 168 |
+
const MgO = (40.304 / 246.47) * 100;
|
| 169 |
+
const MgSO4 = (120.36 / 246.47) * 100;
|
| 170 |
+
const S = (32.065 / 246.47) * 100;
|
| 171 |
+
|
| 172 |
+
// النقاوة
|
| 173 |
+
const theoretical = w_hydrate;
|
| 174 |
+
const actual = w_hydrate;
|
| 175 |
+
const purity = (actual / theoretical) * 100;
|
| 176 |
+
|
| 177 |
+
// عرض النتائج
|
| 178 |
+
document.getElementById('waterMolecules').textContent = x.toFixed(2);
|
| 179 |
+
document.getElementById('mgPercent').textContent = Mg.toFixed(2) + ' %';
|
| 180 |
+
document.getElementById('mgoPercent').textContent = MgO.toFixed(2) + ' %';
|
| 181 |
+
document.getElementById('mgso4Percent').textContent = MgSO4.toFixed(2) + ' %';
|
| 182 |
+
document.getElementById('sPercent').textContent = S.toFixed(2) + ' %';
|
| 183 |
+
document.getElementById('purityPercent').textContent = purity.toFixed(2) + ' %';
|
| 184 |
+
|
| 185 |
+
// إظهار قسم النتائج
|
| 186 |
+
document.getElementById('resultContainer').classList.remove('hidden');
|
| 187 |
+
|
| 188 |
+
// التمرير إلى النتائج
|
| 189 |
+
document.getElementById('resultContainer').scrollIntoView({ behavior: 'smooth' });
|
| 190 |
+
|
| 191 |
+
} catch (error) {
|
| 192 |
+
alert(error.message);
|
| 193 |
+
}
|
| 194 |
+
});
|
| 195 |
+
|
| 196 |
+
document.getElementById('resetBtn').addEventListener('click', function() {
|
| 197 |
+
document.getElementById('calculatorForm').reset();
|
| 198 |
+
document.getElementById('resultContainer').classList.add('hidden');
|
| 199 |
+
});
|
| 200 |
+
</script>
|
| 201 |
+
<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" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 202 |
+
</html>
|