MediaWiki:Common.js:修订间差异

来自TRPG
跳转到导航 跳转到搜索
Uem留言 | 贡献
(测试)
标签替换 已被回退
Uem留言 | 贡献
(看起来问题不在这。)
标签撤销
 
第1行: 第1行:
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */

mw.loader.using('jquery').then(function() {
$('sup.reference').hover(function(e) {
var refId = $(this).find('a').attr('href');
var $ref = $(refId);
if ($ref.length) {
var tip = $('<div class="ref-tooltip"></div>')
.html($ref.html())
.css({
position: 'absolute',
top: e.pageY + 10,
left: e.pageX + 10,
padding: '5px',
background: '#fff',
border: '1px solid #ccc',
'max-width': '300px',
'z-index': 10000
})
.appendTo('body');
$(this).data('tooltip', tip);
}
}, function() {
var tip = $(this).data('tooltip');
if (tip) tip.remove();
}).mousemove(function(e) {
var tip = $(this).data('tooltip');
if (tip) tip.css({ top: e.pageY + 10, left: e.pageX + 10 });
});
});

2025年11月2日 (日) 02:56的最新版本

/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */

mw.loader.using('jquery').then(function() {
    $('sup.reference').hover(function(e) {
        var refId = $(this).find('a').attr('href');
        var $ref = $(refId);
        if ($ref.length) {
            var tip = $('<div class="ref-tooltip"></div>')
                .html($ref.html())
                .css({
                    position: 'absolute',
                    top: e.pageY + 10,
                    left: e.pageX + 10,
                    padding: '5px',
                    background: '#fff',
                    border: '1px solid #ccc',
                    'max-width': '300px',
                    'z-index': 10000
                })
                .appendTo('body');
            $(this).data('tooltip', tip);
        }
    }, function() {
        var tip = $(this).data('tooltip');
        if (tip) tip.remove();
    }).mousemove(function(e) {
        var tip = $(this).data('tooltip');
        if (tip) tip.css({ top: e.pageY + 10, left: e.pageX + 10 });
    });
});