MediaWiki:Common.js
外观
注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的更改的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5。
// 添加悬停计时器到行或段落
(function() {
// 目标元素选择器(可根据需要调整)
var selectors = 'tr, p';
document.querySelectorAll(selectors).forEach(function(element) {
var hoverTimer;
element.addEventListener('mouseenter', function() {
// 启动3秒计时器
hoverTimer = setTimeout(function() {
element.classList.add('line');
}, 3000);
});
element.addEventListener('mouseleave', function() {
// 清除计时器并移除样式
clearTimeout(hoverTimer);
element.classList.remove('line');
});
});
})();