MediaWiki:Fix tabbar.js:修订间差异

无编辑摘要
无编辑摘要
 
第1行: 第1行:
window.addEventListener('load', function () {
window.addEventListener('load', function () {
            var tabLinks = document.querySelectorAll('.tabber__tab');
var tabLinks = document.querySelectorAll('.tabber__tab');
            tabLinks.forEach(function (link) {
tabLinks.forEach(function (link) {
                // 同时监听 mouseover 和 touchstart 事件
// 定义事件处理函数
                ['mouseover', 'touchstart'].forEach(function (eventType) {
function handleEvent(event) {
                    link.addEventListener(eventType, function (event) {
event.stopImmediatePropagation();
                        event.stopImmediatePropagation();
event.preventDefault();
                        event.preventDefault();
}
                    }, true);
// 监听 mouseover 和 touch 系列事件
                });
link.addEventListener('mouseover', handleEvent, false);
            });
link.addEventListener('touchstart', handleEvent, false);
        });
link.addEventListener('touchmove', handleEvent, false);
link.addEventListener('touchend', handleEvent, false);
});
});

2025年4月6日 (日) 22:59的最新版本

window.addEventListener('load', function () {
var tabLinks = document.querySelectorAll('.tabber__tab');
tabLinks.forEach(function (link) {
// 定义事件处理函数
function handleEvent(event) {
event.stopImmediatePropagation();
event.preventDefault();
}
// 监听 mouseover 和 touch 系列事件
link.addEventListener('mouseover', handleEvent, false);
link.addEventListener('touchstart', handleEvent, false);
link.addEventListener('touchmove', handleEvent, false);
link.addEventListener('touchend', handleEvent, false);
});
});