صفحة "كل الأنشطة" تعرض ملخصًا سريعًا لما يحدث في المنتدى، لكنها تكتفي بمقتطفات قصيرة من المساهمات، فيضطر القارئ إلى فتح كل موضوع لمعرفة التفاصيل. هذا الكود يضيف زر "توسيع" إلى كل نشاط، وعند الضغط عليه يعرض محتوى المساهمة كاملًا، وأسماء الأعضاء الذين أعجبوا بها، كما يظهر زر "حذف" المساهمة للمسؤولين، مما يتيح لهم إدارة المحتوى مباشرة من صفحة الأنشطة دون الحاجة للانتقال إلى صفحة المساهمة نفسها. والكود مخصص لنسخة AwesomeBB.
التومبلايتات والقوالب ← إدارة عامة ← قالب discover
ابحث عن التالي:
واستبدله بالتالي:
ثم انشر القالب.
كود Javascript
العنوان: اختيارك
المكان: جميع الصفحات
ثم اضغط على زر قدم.
بهذه الإضافة تتحول صفحة الأنشطة إلى أداة متابعة وإدارة متكاملة توفر الكثير من التنقل. كل الشكر لصاحب الكود على هذا العمل الذي طوّره بالاستعانة بالذكاء الاصطناعي.
صاحب الكود: كونان2000
مثال على الكود
شرح تركيب الكود
القوالب (التمبلايت)التومبلايتات والقوالب ← إدارة عامة ← قالب discover
ابحث عن التالي:
HTML:
<!-- BEGIN has_activity -->واستبدله بالتالي:
HTML:
<div class="activity-Expand">
<p id="number-photos"></p>
<button id="toggle-replies" style="margin: 10px 0; padding: 8px 15px; background-color: #007bff; color: white; border: none; border-radius: 4px; cursor: pointer;">
توسيع
</button>
</div>
<!-- BEGIN has_activity -->ثم انشر القالب.
كود Javascript
العنوان: اختيارك
المكان: جميع الصفحات
JavaScript:
$(function () {
let repliesVisible = false;
let loaded = false;
function getCookie(name) {
const value = "; " + document.cookie;
const parts = value.split("; " + name + "=");
if (parts.length === 2) return parts.pop().split(";").shift();
}
function setCookie(name, value, days = 30) {
const d = new Date();
d.setTime(d.getTime() + days * 24 * 60 * 60 * 1000);
const expires = "expires=" + d.toUTCString();
document.cookie = name + "=" + value + ";" + expires + ";path=/";
}
const $toggleBtn = $('#toggle-replies');
function loadReplies() {
$('.activity-feed .feed-item').each(function () {
const $item = $(this);
const $link = $item.find('a[href^="/r"], a[href^="/t"]').first();
if (!$link.length) return;
const href = $link.attr('href');
let postId = null;
let url = href.split('#')[0];
if (href.startsWith('/r')) {
const match = href.match(/r(\d+)/);
if (!match) return;
postId = match[1];
}
if ($item.find('.reply-preview').length) {
$item.find('.reply-preview').slideDown();
return;
}
const $container = $('<div class="reply-preview" style="margin-top:-3px;margin-bottom:30px; padding:10px; background:#f5f5f5; border:1px solid #ccc; display:none;"></div>');
$item.append($container);
$.get(url, function (html) {
const doc = $(html);
const $post = postId ? doc.find('#post-' + postId) : doc.find('.post-wrap').first();
if (!$post.length) {
$container.html('none');
return;
}
const content = $post.find('.post-content').html();
$container.html(content || 'none');
const $deleteLink = $post.find('.btn-delete a[href*="mode=delete"]').first();
if ($deleteLink.length) {
const deleteUrl = $deleteLink.attr('href');
const $deleteBtn = $(`
<a href="${deleteUrl}" target="_blank" style="float: left; padding:5px 10px; background:#dc3545; color:#fff; text-decoration:none; border-radius:4px;">
حذف
</a>
`);
$container.append('<hr>').append($deleteBtn);
}
const $likeList = $post.find('p.fa_like_list').clone();
if ($likeList.length) {
$likeList.css({
width: 'fit-content',
padding: '5px',
background: '#fffbe6',
border: '1px solid #ccc',
borderRadius: '4px'
});
$container.append($likeList);
}
$container.slideDown();
}).fail(function () {
$container.html('none').slideDown();
});
});
}
const cookieValue = getCookie('repliesVisible');
if (cookieValue === 'true') {
repliesVisible = true;
loaded = false;
$toggleBtn.text('تصغير').css('background-color', '#28a745');
loadReplies();
loaded = true;
}
$toggleBtn.on('click', function () {
repliesVisible = !repliesVisible;
if (repliesVisible) {
$(this).text('تصغير').css('background-color', '#28a745');
setCookie('repliesVisible', 'true');
if (!loaded) {
loadReplies();
loaded = true;
} else {
$('.reply-preview').slideDown();
}
} else {
$(this).text('توسيع').css('background-color', '#8b1d42');
setCookie('repliesVisible', 'false');
$('.reply-preview').slideUp();
}
});
});
$(document).ready(function() {
var count = 0;
$("ol.block-content.activity-feed li").each(function() {
var style = $(this).attr("style");
if (style && style.includes("--activity-image")) {
count++;
}
});
$("#number-photos").text("عدد الأنشطة: " + count);
});
document.write('<style type="text/css">.activity-Expand { background: #d7d7d7; color: #000000; border: solid #201f1f 1px; font-size: 23px; font-weight: 800; margin-bottom: 4px; border-radius: 20px; display: flex; align-items: center; justify-content: space-evenly;}</style>');
// كونان2000ثم اضغط على زر قدم.
بهذه الإضافة تتحول صفحة الأنشطة إلى أداة متابعة وإدارة متكاملة توفر الكثير من التنقل. كل الشكر لصاحب الكود على هذا العمل الذي طوّره بالاستعانة بالذكاء الاصطناعي.
صاحب الكود: كونان2000