MediaWiki:Common.js:修订间差异
无编辑摘要 标签:已被回退 |
无编辑摘要 标签:已被回退 |
||
| 第3行: | 第3行: | ||
mw.loader.load( '/w/index.php?title=MediaWiki:ExpandAndCollapse.js&action=raw&ctype=text/javascript' ); | mw.loader.load( '/w/index.php?title=MediaWiki:ExpandAndCollapse.js&action=raw&ctype=text/javascript' ); | ||
/* 公告栏的滚动 */ | |||
/* | |||
$(function () { | $(function () { | ||
var self = $('#siteNoticeScroll'); | var self = $('#siteNoticeScroll'); | ||
| 第51行: | 第27行: | ||
}); | }); | ||
/* | /* 动态 Tooltip */ | ||
document.querySelectorAll('.dynamic-tooltip-trigger').forEach(element => { | |||
const tooltip = document.createElement('div'); | |||
tooltip.className = 'mw-dynamic-tooltip'; | |||
document.body.appendChild(tooltip); | |||
element.addEventListener('mouseover', function(e) { | |||
const rect = e.target.getBoundingClientRect(); | |||
tooltip.innerHTML = e.target.dataset.mwDynamic; // 动态内容 | |||
tooltip.style.display = 'block'; | |||
tooltip.style.top = `${rect.bottom + window.scrollY}px`; | |||
tooltip.style.left = `${rect.left + window.scrollX}px`; | |||
}); | |||
element.addEventListener('mouseout', () => { | |||
tooltip.style.display = 'none'; | |||
}); | }); | ||
}); | }); | ||