打开/关闭搜索
搜索
打开/关闭菜单
7
260
74
1380
失传媒体中文维基
导航
首页
最近更改
随机页面
特殊页面
上传文件
帮助
维基语法
编者入门
社区
最近评论
其他
最近更改
特殊页面
所有页面
管理
编辑侧栏
通用CSS
主题CSS
打开/关闭外观设置菜单
通知
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
user-interface-preferences
个人工具
创建账号
登录
查看“︁MediaWiki:Common.js”︁的源代码
MediaWiki界面页面
更多操作
←
MediaWiki:Common.js
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
此页面为本wiki上的软件提供界面文本,并受到保护以防止滥用。 如欲修改所有wiki的翻译,请访问
translatewiki.net
上的MediaWiki本地化项目。
您无权编辑此JavaScript页面,因为编辑此页面可能会影响所有访问者。
您可以查看和复制此页面的源代码。
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */ // 等待页面内容加载完成 mw.hook('wikipage.content').add(function() { // 仅在 Minerva 皮肤下生效 if (mw.config.get('skin') !== 'minerva') return; // 1. 获取当前页面信息 const pageTitle = mw.config.get('wgPageName'); const isTalkPage = mw.config.get('wgNamespaceNumber') % 2 === 1; // 判断是否为讨论页 const isExistingPage = mw.config.get('wgArticleId') > 0; // 判断页面是否存在 // 2. 构造核心链接 const editUrl = mw.util.getUrl(pageTitle, { action: 'edit' }); const historyUrl = mw.util.getUrl(pageTitle, { action: 'history' }); const talkTitle = isTalkPage ? pageTitle.replace(/^Talk:/, '') : `Talk:${pageTitle}`; const talkUrl = mw.util.getUrl(talkTitle); // 3. 创建底部按钮容器(样式模仿 Wikidot 的简洁风格) const bottomBar = document.createElement('div'); bottomBar.id = 'custom-wiki-bottom-bar'; bottomBar.style.cssText = ` margin: 3rem auto 1rem; padding: 1rem 0; border-top: 1px solid #e0e0e0; text-align: center; max-width: 800px; `; // 4. 定义按钮组 const buttons = [ { url: editUrl, text: isExistingPage ? '编辑页面' : '创建页面', color: '#3366cc' // 经典 MediaWiki 蓝 }, { url: historyUrl, text: '查看历史', color: '#72777d' // 中性灰 }, { url: talkUrl, text: isTalkPage ? '返回条目' : '讨论页', color: '#202122' // 深灰 } ]; // 5. 生成按钮并插入容器 buttons.forEach(btn => { const link = document.createElement('a'); link.href = btn.url; link.textContent = btn.text; link.style.cssText = ` display: inline-block; margin: 0 0.75rem; padding: 0.5rem 1.25rem; background-color: ${btn.color}; color: white; text-decoration: none; border-radius: 4px; font-size: 0.95rem; font-weight: 500; transition: opacity 0.2s; `; link.onmouseover = () => link.style.opacity = '0.85'; link.onmouseout = () => link.style.opacity = '1'; bottomBar.appendChild(link); }); // 6. 将按钮栏插入到页面最底部(页脚上方) const footer = document.querySelector('footer, .mw-footer'); const content = document.getElementById('content'); if (footer && footer.parentNode) { footer.parentNode.insertBefore(bottomBar, footer); } else if (content) { content.appendChild(bottomBar); } });
返回
MediaWiki:Common.js
。
查看“︁MediaWiki:Common.js”︁的源代码
MediaWiki界面页面