我在页眉中尝试了此代码
document.addEventListener("DOMContentLoaded", function() {
setTimeout(() => {
let userTrustLevel = parseInt(Discourse.User.current().trust_level);
if (userTrustLevel < 4) {
document.querySelectorAll(".pin-topic, .unpin-topic").forEach(button => {
button.style.pointerEvents = "none";
button.style.opacity = "0.5";
button.title = "您无权置顶主题";
});
}
}, 1000); complet
});
并在 CSS 中添加了以下代码
.d-header-icons .pin-topic,
.d-header-icons .unpin-topic,
.controls .pin-topic,
.controls .unpin-topic {
display: none !important;
}
但是,信任等级为 1 或 0 的普通用户仍然可以点击并看到置顶按钮。
默认情况下,当用户滚动到底部时自动取消置顶主题。 此选项已关闭
当用户滚动到底部时自动取消置顶主题。 此选项已关闭


