MediaWiki:Common.js:修订间差异

来自新浪维基
跳转到导航 跳转到搜索
第1行: 第1行:
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
function nl_table_show_content(index) {
const nl_tb_headers = document.querySelectorAll('.nl-tb-header div');
    const contents = document.querySelectorAll('.nl-tb-content div');
const nl_tb_contents = document.querySelectorAll('.nl-tb-content div');
     contents.forEach(content => content.classList.remove('active'));
nl_tb_headers.forEach((nl_tb_header, index) => {
    contents[index].classList.add('active');
     nl_tb_header.addEventListener('click', () => {
}
        nl_tb_contents.forEach(item => item.classList.remove('active'));
        nl_tb_contents[index].classList.add('active');
    });
});

2024年10月29日 (二) 20:29的版本

/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
const nl_tb_headers = document.querySelectorAll('.nl-tb-header div');
const nl_tb_contents = document.querySelectorAll('.nl-tb-content div');
nl_tb_headers.forEach((nl_tb_header, index) => {
    nl_tb_header.addEventListener('click', () => {
        nl_tb_contents.forEach(item => item.classList.remove('active'));
        nl_tb_contents[index].classList.add('active');
    });
});