部落与弯刀Wiki
搜索
登录
↓
个人工具
创建账户
登录
导航菜单
导航
汉家松鼠官网
首页
游戏介绍
MOD开发者手册
MOD开发教学视频
新闻(Steam)
讨论区(Steam)
创意工坊(Steam)
下载(Steam)
语言
简体中文
English
查看“MediaWiki:Common.js”的源代码
来自部落与弯刀Wiki
←
MediaWiki:Common.js
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于这些用户组的用户使用:
管理员
、
界面管理员
该页提供此wiki软件的界面文字,它已被保护以防止恶意修改。如欲修改所有wiki的翻译,请到
translatewiki.net
上的MediaWiki本地化计划。
您无权编辑此JavaScript页面,因为它可能会影响所有访问者。
您可以查看与复制此页面的源代码。
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */ document.addEventListener("DOMContentLoaded", function () { const tocLinks = Array.from(document.querySelectorAll("#toc a")); const sections = tocLinks.map(link => { const target = document.getElementById(decodeURIComponent(link.getAttribute("href").substring(1))); return target ? { link, target } : null; }).filter(Boolean); function onScroll() { let currentSection = null; const scrollTop = window.scrollY + 100; // 提前一点触发高亮 for (let i = 0; i < sections.length; i++) { const sectionTop = sections[i].target.offsetTop; if (scrollTop >= sectionTop) { currentSection = sections[i]; } else { break; } } tocLinks.forEach(link => link.classList.remove("active-section")); if (currentSection) { currentSection.link.classList.add("active-section"); } } window.addEventListener("scroll", onScroll); onScroll(); // 初始加载时触发一次 });
返回至
MediaWiki:Common.js
。