LLWiki正在建设中,欢迎
加入我们
!
查看“User:Bhsd/widget/songposition.js”的源代码
←
User:Bhsd/widget/songposition.js
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您没有权限编辑此JavaScript页面,因为此页面包含另一位用户的个人设置。
您可以查看和复制此页面的源代码。
//<nowiki> // 用于[[Widget:Songposition]],可以使用ES6语法 /** * @Function: 鼠标移动至歌曲站位图标上方时提示角色姓名 * @Dependencies: oojs-ui-core, ext.gadget.site-lib * @Author: [[User:Bhsd]] */ "use strict"; /* global mw, $ */ (() => { const main = () => { mw.widget = mw.widget || {}; if (mw.widget.songposition) { return; } const targets = ['.member-symbol', '.member-graph'], target = targets.join(), map = new Map(), $body = $( '#bodyContent' ); mw.hook( 'wikipage.content' ).add($content => { // 更新图片对应关系 if ($content.find( '.member-symbol-image' ).length === 0) { return; } console.log('Hook: wikipage.content, 开始更新songposition的图片映射'); $content.find( target ).each(function() { map.set(this, $(this).next().find( 'img' )); }); }); mw.loader.using(['oojs-ui-core', 'ext.gadget.site-lib']).then(() => { for (const t of targets) { const $label = $('<div>', {html: '<div>'}); $body.on('mouseenter', t, function() { $label.children( 'div' ).html( map.get(this) ); }); mw.tipsy($body, t, {id: `${t.slice(1)}-popup`}, $label); } }); mw.widget.songposition = true; }; if (window.jQuery) { main(); } else { window.addEventListener('jquery', main); } }) (); //</nowiki> // [[category:jQuery小部件]] {{DEFAULTSORT:Songposition}}
返回
User:Bhsd/widget/songposition.js
。
导航菜单
个人工具
创建账号
登录
命名空间
用户页
讨论
变体
查看
阅读
查看源代码
查看历史
更多
搜索
导航
首页
随机页面
最近更改
沙盒
互助客栈
方针与指引
帮助
工具
链入页面
相关更改
用户贡献
日志
查看用户组
特殊页面
页面信息