/* حاوية الشبكة */
#fahras-cards {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 20px;
padding: 20px;
}
/* بطاقة التصنيف */
.fahras-card {
background: #fff;
border-radius: 15px;
box-shadow: 0 3px 10px rgba(0,0,0,0.1);
overflow: hidden;
text-align: center;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.fahras-card:hover {
transform: translateY(-5px);
box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}
/* الدائرة التي تحمل الأيقونة */
.fahras-icon {
font-size: 40px;
background: #007bff;
color: #fff;
width: 60px;
height: 60px;
margin: 15px auto 10px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
/* محتوى البطاقة */
.fahras-card-content {
padding: 15px;
}
.fahras-card-content h3 {
margin: 5px 0;
font-size: 18px;
color: #007bff;
}
.fahras-card-content p {
margin: 5px 0;
font-size: 14px;
color: #555;
}
.fahras-card-content a {
display: inline-block;
margin-top: 8px;
padding: 8px 14px;
background: #007bff;
color: #fff;
border-radius: 8px;
text-decoration: none;
transition: background 0.3s;
}
.fahras-card-content a:hover {
background: #dc3545;
}
/* دعم الوضع الليلي */
@media (prefers-color-scheme: dark) {
body {
background: #121212;
color: #ddd;
}
.fahras-card {
background: #1e1e1e;
box-shadow: none;
}
.fahras-card-content h3 {
color: #66aaff;
}
.fahras-card-content p {
color: #ccc;
}
.fahras-icon {
background: #66aaff;
color: #111;
}
.fahras-card-content a {
background: #66aaff;
color: #111;
}
.fahras-card-content a:hover {
background: #ff6666;
}
}
const blogURL = window.location.origin;
const maxPosts = 200;
// أيقونات مخصصة لكل تصنيف
const categoryIcons = {
“تقنية”: “fa-microchip”,
“برمجة”: “fa-code”,
“تصميم”: “fa-paint-brush”,
“ألعاب”: “fa-gamepad”,
“صور”: “fa-image”,
“فيديو”: “fa-video”,
“أندرويد”: “fa-android”,
“إنترنت”: “fa-globe”,
“شروحات”: “fa-chalkboard-teacher”,
“برامج”: “fa-laptop-code”,
“بلوجر”: “fa-blog”,
“عام”: “fa-folder-open”,
“الربح من الانترنت”: “fa-dollar-sign”,
“فرص عمل”: “fa-briefcase”,
“قوالب بلوجر”: “fa-layer-group”,
“خدمات”: “fa-handshake”
};
// ألوان دوائر الأيقونات
const iconColors = [“#007bff”, “#28a745”, “#17a2b8”, “#ffc107”, “#6610f2”, “#e83e8c”, “#fd7e14”, “#20c997″];
fetch(`${blogURL}/feeds/posts/default?alt=json&max-results=${maxPosts}`)
.then(res => res.json())
.then(data => {
const entries = data.feed.entry || [];
const labelsMap = {};
// عدّ التدوينات لكل تصنيف
entries.forEach(entry => {
(entry.category || []).forEach(l => {
const name = l.term;
if (!labelsMap[name]) {
labelsMap[name] = { count: 0, url: `${blogURL}/search/label/${encodeURIComponent(name)}` };
}
labelsMap[name].count++;
});
});
// حوّل إلى مصفوفة ورتّب تنازليًا حسب العدد
const sorted = Object.entries(labelsMap)
.sort((a, b) => b[1].count – a[1].count);
const container = document.getElementById(‘fahras-cards’);
container.innerHTML = ”;
sorted.forEach(([labelName, info], idx) => {
const icon = categoryIcons[labelName] || “fa-tags”;
const color = iconColors[idx % iconColors.length];
const card = document.createElement(‘div’);
card.className = ‘fahras-card’;
card.innerHTML = `
`;
container.appendChild(card);
});
if (sorted.length === 0) {
container.textContent = ‘لم يتم العثور على تصنيفات.’;
}
})
.catch(err => {
document.getElementById(‘fahras-cards’).textContent = ‘حدث خطأ أثناء تحميل الفهرس.’;
console.error(err);
});
#sidebar-wrapper, #midsidebar-wrapper, .gapad2, .blog-pager, .post-header-line-1, .post-footer { display:none !important;} #main-wrapper { width:100%!important;} .post { width:100%!important; }

أضف تعليق