匿名
未登录
创建账号
登录
Postal Wiki
搜索
查看“︁用户:Hehua/common.js”︁的源代码
来自Postal Wiki
命名空间
用户页
讨论
更多
更多
页面操作
阅读
查看源代码
历史
用户贡献
←
用户:Hehua/common.js
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您没有权限编辑此JavaScript页面,因为此页面包含另一位用户的个人设置。
您可以查看和复制此页面的源代码。
mw.loader.load('https://wikiplus-app.com/Main.js'); importScript('User:Hehua/hotcat.js'); // InPageEdit NEXT document.body.append( Object.assign(document.createElement('script'), { src: 'https://gcore.jsdelivr.net/npm/@inpageedit/core/dist/index.js', type: 'module', }) ); importScript('User:Hehua/easyarchive.js'); // User:Hehua/common.js // 这段代码只有你自己能看到 // 使用皮肤检测,确保只在Timeless皮肤运行 if (true) { console.log('Hehua的个人JS已加载,正在添加UTC时钟...'); // 等待所需模块 mw.loader.using(['mediawiki.util', 'mediawiki.api', 'jquery']).then(function() { function addPersonalClock() { // 避免重复添加 if ($('#utcdate-hehua').length) return true; // 添加到个人工具栏 var node = mw.util.addPortletLink( 'p-personal', mw.util.getUrl(mw.config.get('wgPageName'), {action: 'purge'}), '加载中...', 'utcdate-hehua', 'UTC时间(个人版)- 点击刷新页面' ); if (!node) { console.log('无法添加时钟到个人工具栏'); return false; } // 样式 $(node).find('a').css({ 'font-weight': 'bold', 'font-size': '110%', 'color': '#36c', // 蓝色,便于识别 'border-left': '1px solid #ccc', 'padding-left': '10px' }); // 点击事件 $(node).on('click', function(e) { e.preventDefault(); new mw.Api().post({ action: 'purge', titles: mw.config.get('wgPageName') }).then(function() { location.reload(); }, function() { mw.notify('刷新失败', {type: 'error'}); }); }); // 更新时间函数 function updateClock() { var now = new Date(); var hh = now.getUTCHours().toString().padStart(2, '0'); var mm = now.getUTCMinutes().toString().padStart(2, '0'); var ss = now.getUTCSeconds().toString().padStart(2, '0'); $(node).find('a').text(hh + ':' + mm + ':' + ss + ' UTC'); // 精确计时 setTimeout(updateClock, 1000 - now.getUTCMilliseconds()); } updateClock(); console.log('个人版UTC时钟添加成功'); return true; } // 尝试添加(Timeless可能延迟加载DOM) var attempts = 0; var interval = setInterval(function() { if (addPersonalClock() || attempts >= 8) { clearInterval(interval); if (attempts >= 8) { console.log('添加个人时钟失败,尝试8次后放弃'); } } attempts++; }, 500); }).catch(function(err) { console.error('加载依赖模块失败:', err); }); }; //[T - Sunny00217] if ( [ "zh-hant", "zh-tw", "zh-hk", "zh-mo" ].indexOf( mw.config.get( "wgUserLanguage" ) ) !== -1 ) { $( "#pt-mycontris a" ).text( "我的貢獻 (" + mw.config.get( "wgUserEditCount" ) + ")" ); } else if ( [ "zh", "zh-hans", "zh-cn", "zh-my", "zh-sg" ].indexOf( mw.config.get( "wgUserLanguage" ) ) !== -1 ) { $( "#pt-mycontris a" ).text( "我的贡献 (" + mw.config.get( "wgUserEditCount" ) + ")" ); } else if ( mw.config.get( "wgUserLanguage" ) === "qqx" ) { $( "#pt-mycontris a" ).text( "(mycontris)-(wgUserEditCount)" ); } else { $( "#pt-mycontris a" ).text( $( "#pt-mycontris a" ).text() + "(" + mw.config.get( "wgUserEditCount" ) + ")" ); }
返回
用户:Hehua/common.js
。
导航
导航
首页
讨论版
最近更改
随机页面
深色模式
帮助
规章制度
编辑规范
格式指导
管理员公示板
人员任免方针
沙盒
链接
QQ群
Discord社区服务器
wiki工具
wiki工具
特殊页面
页面工具
页面工具
用户页面工具
日志
查看用户组
更多
链入页面
相关更改
页面信息
页面日志