打开/关闭搜索
搜索
打开/关闭菜单
30
8
13
1.6K
陋室
导航
首页
最近更改
随机页面
特殊页面
社群首页
新闻动态
帮助
上传文件
内容
分类树
所有页面
导入页面
活跃用户列表
界面
侧边栏
站点公告
匿名用户通知
公共样式表
公共脚本
系统消息
打开/关闭外观设置菜单
通知
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
user-interface-preferences
中文(简体)
个人工具
登录
查看“︁MediaWiki:Gadget-RightToolbar.js”︁的源代码
MediaWiki界面页面
查看
阅读
查看源代码
查看历史
associated-pages
系统消息
讨论
更多操作
←
MediaWiki:Gadget-RightToolbar.js
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于这些用户组的用户执行:
用户
、
自动确认用户
此页面为本wiki上的软件提供界面文本,并受到保护以防止滥用。 如欲修改所有wiki的翻译,请访问
translatewiki.net
上的MediaWiki本地化项目。
您无权编辑此JavaScript页面,因为编辑此页面可能会影响所有访问者。
您可以查看和复制此页面的源代码。
mw.loader.using(['mediawiki.util'], function () { function updateClock() { var now = new Date(); var dateString = now.getFullYear() + "年" + (now.getMonth() + 1).toString().padStart(2, '0') + "月" + now.getDate().toString().padStart(2, '0') + "日"; var timeString = now.toLocaleTimeString(); $('#current-date').text(dateString); $('#current-time').text(timeString); } $(function () { var isMobile = window.innerWidth <= 768; // 判断是否为移动端 // 右下角按钮容器 var $container = $('<div id="mw-custom-tools"></div>').css({ position: 'fixed', bottom: '120px', // 避免与其他工具重叠 right: '40px', display: 'flex', flexDirection: 'column', alignItems: 'flex-end', gap: '5px', zIndex: 9999 }); // 统一按钮样式 function createButton(id, text, tooltip, clickHandler) { return $('<div></div>', { id: id, title: tooltip, text: text }).css({ padding: '5px 10px', fontSize: '12px', background: '#f1f1f1', border: '1px solid #aaa', borderRadius: '4px', boxShadow: '0 1px 3px rgba(0,0,0,0.2)', color: '#333', cursor: 'pointer', textAlign: 'center', opacity: 0.7, transition: 'background 0.3s, opacity 0.3s' }).hover(function () { $(this).css({ background: '#ddd', opacity: 1 }); }, function () { $(this).css({ background: '#f1f1f1', opacity: 0.7 }); }).click(clickHandler); } // 创建回到顶部按钮 var $topButton = createButton('mw-scroll-top', '▲', '回到顶部', function () { $('html, body').animate({ scrollTop: 0 }, 500); }); // 创建回到底部按钮 var $bottomButton = createButton('mw-scroll-bottom', '▼', '回到底部', function () { $('html, body').animate({ scrollTop: $(document).height() }, 500); }); // 创建时间显示区域(仅桌面端) if (!isMobile) { var $clockDiv = $('<div id="current-clock"></div>').css({ padding: '6px 12px', fontSize: '12px', background: '#f1f1f1', border: '1px solid #aaa', borderRadius: '4px', boxShadow: '0 1px 3px rgba(0,0,0,0.2)', color: '#333', textAlign: 'center', lineHeight: '1.4' }).append( $('<div id="current-date">加载中...</div>'), $('<div id="current-time"></div>') ); $container.append($clockDiv); } // 组装按钮 $container.append($topButton, $bottomButton); $('body').append($container); // 启动时钟更新(仅桌面端) if (!isMobile) { updateClock(); setInterval(updateClock, 1000); } }); });
返回
MediaWiki:Gadget-RightToolbar.js
。
查看“︁MediaWiki:Gadget-RightToolbar.js”︁的源代码
MediaWiki界面页面