<!-- جدول أسعار الذهب المختصر --><style>
.mini-gold-table{
max-width:700px;margin:10px auto 16px;padding:12px;border-radius:14px;
background:#fff;box-shadow:0 8px 20px rgba(0,0,0,.06)
}
.mgt-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.mgt-head strong{font-size:clamp(16px,3.5vw,20px)}
.mgt-head small{color:#7a7a7a}
.mgt{width:100%;border-collapse:separate;border-spacing:0;overflow:hidden;border-radius:10px}
.mgt th,.mgt td{padding:10px 12px;text-align:center}
.mgt thead th{background:#f9f6f1;color:#6b5d43}
.mgt tbody tr:nth-child(even){background:#fafafa}
.mgt tbody td:last-child{font-weight:700;color:#eda22d}
</style>
Live gold prices (SAR/Gram) updated automatically
| Caliber | Price/g |
|---|
| 18 karat | — |
| 21 caliber | — |
| 22 caliber | — |
| 24 caliber | — |
{
const p = readPrice(k);
document.getElementById(id).textContent = (p==null ? "—" : fmt(p));
});
}
// حدّث الآن
updateMiniTable();
// تابع أي تغيير على عناصر الأسعار (يحدّثها سكربت الأسعار لديك)
Object.values(KARAT_SELECTOR).forEach(sel=>{
const el = document.querySelector(sel);
if(el){
const obs = new MutationObserver(updateMiniTable);
obs.observe(el,{childList:true,characterData:true,subtree:true});
}
});
// وتحديث احتياطي كل 10 ثواني
setInterval(updateMiniTable,10000);
<!-- حاسبة زكاة الذهب --><style>
.zakat-card{
max-width:700px;margin:25px auto;padding:16px;border-radius:16px;
background:#fff;box-shadow:0 8px 20px rgba(0,0,0,.06)
}
.zakat-card h2{margin:0 0 14px;font-size:clamp(18px,4vw,26px)}
.zakat-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:10px}
.zakat-field{display:flex;flex-direction:column;text-align:right}
.zakat-field label{margin-bottom:6px;color:#555;font-size:14px}
.zakat-field select,.zakat-field input{
padding:12px;border:1px solid #e5e5e5;border-radius:10px;font-size:16px
}
.zakat-btn{
width:100%;padding:12px 16px;border:0;border-radius:12px;margin-top:12px;
background:#eda22d;color:#1f1f1f;font-weight:700;cursor:pointer
}
.zakat-btn:hover{filter:brightness(1.03)}
.zakat-note{color:#777;font-size:13px;margin-top:6px}
.zakat-result{
margin-top:14px;background:#f9f6f1;border:1px dashed #e7d9b9;border-radius:12px;
padding:14px;color:#3b352b;line-height:1.9
}
.zakat-warning{color:#c43c3c;font-weight:700}
@media (max-width:600px){.zakat-grid{grid-template-columns:1fr}}
</style>
Gold Zakat Calculator
<select id="karatSelect"></select>
<input id="goldWeight" type="number" min="85" step="0.1" placeholder="مثال: 120"> The current gram price for the selected karat is automatically used.
<button class="zakat-btn" id="calcZakatBtn">Calculate Zakat</button>
الرجاء إدخال الوزن.";
return;
}
if(weight < 85){
resultBox =
"الوزن المُدخل أقل من نصاب الذهب (85 جم)، لا زكاة واجبة. ";
return;
}
const pricePerGram = readPriceForKarat(karat);
if(pricePerGram === null){
resultBox =
"<span class='zakat-warning'>السعر غير متاح حاليًا، انتظر تحديث الأسعار أو حدّث الصفحة.</span>";
return;
}
const totalValue = weight * pricePerGram; // قيمة الذهب بالريال
const zakat = totalValue * 0.025; // نسبة الزكاة 2.5%
resultBox =
"العيار المختار: <b>" + karat + "</b><br>" +
"سعر الجرام الحالي: <b>" + formatSAR(pricePerGram) + "</b>
<br>" +
"قيمة الذهب: <b>" + formatSAR(totalValue) + "</b>
<br>" +
"الزكاة الواجبة (2.5%): <b style='font-size:1.1em'>" + formatSAR(zakat) + "</b>
";
}
document.getElementById("calcZakatBtn").addEventListener("click", calcZakat);
// ملاحظة: سكربت الأسعار لديك يحدّث القيم دوريًا، والحاسبة تقرأها عند الضغط على زر الحساب.