LLWiki正在建设中,欢迎加入我们

“Widget:年表標籤/篩選”的版本间差异

来自LLWiki
跳转到导航 跳转到搜索
标签移动版网页编辑 移动版编辑
第5行: 第5行:
document.querySelectorAll('.filter').forEach(function(ele) {
document.querySelectorAll('.filter').forEach(function(ele) {
ele.addEventListener('click', function() {
ele.addEventListener('click', function() {
document.querySelectorAll('#mw-content-text dl').forEach(function(parent) {
setTimeout(function() {
var child = parent.querySelector('dd > :not(.mw-collapsed)');
document.querySelectorAll('#mw-content-text dl').forEach(function(parent) {
if(child)
var child = parent.querySelector('dd > :not(.mw-collapsed)');
parent.style.display = '';
if(child)
else
parent.style.display = '';
parent.style.display = 'none';
else
});
parent.style.display = 'none';
});
}, 50);
});
});
});
});

2020年9月1日 (二) 02:35的版本

JavaScript脚本:

window.addEventListener('load', function() {
    document.querySelectorAll('.filter').forEach(function(ele) {
        ele.addEventListener('click', function() {
            setTimeout(function() {
                document.querySelectorAll('#mw-content-text dl').forEach(function(parent) {
                    var child = parent.querySelector('dd > :not(.mw-collapsed)');
                    if(child)
                        parent.style.display = '';
                    else
                        parent.style.display = 'none';
                });
            }, 50);
        });
    });
});
//