Guanghu Domestic Migration d1e47f4565
Some checks are pending
自动更新代码和重启 / update-and-restart (push) Waiting to run
CI检查 + 自动部署 / check (push) Waiting to run
CI检查 + 自动部署 / deploy (push) Blocked by required conditions
重启聊天服务 / restart (push) Waiting to run
chore: import sanitized domestic snapshot for REPO-002
Source snapshot: ca48d3ddf926d79aa138306164169baf764bb829
2026-07-17 15:54:41 +08:00

49 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 频道标签过滤
document.querySelectorAll('.channel-tag').forEach(tag => {
tag.addEventListener('click', () => {
const channel = tag.dataset.channel;
document.querySelectorAll('.announcement').forEach(ann => {
ann.style.display = channel === 'all' || ann.dataset.channel === channel ? 'block' : 'none';
});
});
});
// 置顶悬浮动画
document.querySelectorAll('.pin-icon').forEach(pin => {
pin.addEventListener('click', () => {
const announcement = pin.closest('.announcement');
announcement.classList.toggle('pinned');
});
});
// ✨ 动态数据加载M24 核心!)
fetch('data.json')
.then(response => response.json())
.then(data => {
const announcements = document.querySelector('.announcements-container');
announcements.innerHTML = '';
data.forEach(item => {
const announcement = document.createElement('div');
announcement.className = nnouncement ;
announcement.dataset.channel = item.channel;
announcement.innerHTML =
<div class="announcement-content">
<h3></h3>
<p></p>
</div>
<i class="pin-icon"></i>
;
announcements.appendChild(announcement);
});
// 重新绑定事件
document.querySelectorAll('.pin-icon').forEach(pin => {
pin.addEventListener('click', () => {
const announcement = pin.closest('.announcement');
announcement.classList.toggle('pinned');
pin.textContent = announcement.classList.contains('pinned') ? '⭐' : '✨';
});
});
});