feat(site): 隐私政策/服务条款/系统要求页面
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJ1g8XV1YhhmHRzhwWEW7o
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// 法律/信息页左侧目录滚动高亮
|
||||
(function () {
|
||||
var toc = document.getElementById('legalToc');
|
||||
if (!toc) return;
|
||||
var links = Array.prototype.slice.call(toc.querySelectorAll('a'));
|
||||
var sections = links
|
||||
.map(function (a) { return document.getElementById(a.getAttribute('href').slice(1)); })
|
||||
.filter(Boolean);
|
||||
if (!sections.length || !window.IntersectionObserver) return;
|
||||
|
||||
var active = null;
|
||||
function setActive(id) {
|
||||
if (id === active) return;
|
||||
active = id;
|
||||
links.forEach(function (a) {
|
||||
a.classList.toggle('active', a.getAttribute('href') === '#' + id);
|
||||
});
|
||||
}
|
||||
|
||||
var observer = new IntersectionObserver(function (entries) {
|
||||
entries.forEach(function (e) {
|
||||
if (e.isIntersecting) setActive(e.target.id);
|
||||
});
|
||||
}, { rootMargin: '-15% 0px -75% 0px', threshold: 0 });
|
||||
|
||||
sections.forEach(function (s) { observer.observe(s); });
|
||||
setActive(sections[0].id);
|
||||
})();
|
||||
Reference in New Issue
Block a user