MediaWiki:Common.js:修订间差异

HW
HW留言 | 贡献 (创建页面,内容为“这里的任何JavaScript将为所有用户在每次页面加载时加载。:​ // 等待页面内容加载完成 mw.hook('wikipage.content').add(function() { // 仅在 Minerva 皮肤下生效 if (mw.config.get('skin') !== 'minerva') return; // 1. 获取当前页面信息 const pageTitle = mw.config.get('wgPageName'); const isTalkPage = mw.config.get('wgNamespaceNumber') % 2 === 1; // 判断是否为讨论页 const isExistingPage = m…”)
 
HW
HW留言 | 贡献
第20行: 第20行:
     bottomBar.id = 'custom-wiki-bottom-bar';
     bottomBar.id = 'custom-wiki-bottom-bar';
     bottomBar.style.cssText = `
     bottomBar.style.cssText = `
        margin: 3rem auto 1rem;
        padding: 1rem 0;
        border-top: 1px solid #e0e0e0;
        text-align: center;
        max-width: 800px;
     `;
     `;


第68行: 第63行:
     });
     });


    // 6. 将按钮栏插入到页面最底部(页脚上方)
        // 6. 将按钮栏插入到 main#content 内部的最底部
     const footer = document.querySelector('footer, .mw-footer');
     const content = document.querySelector('main#content, #content');
    const content = document.getElementById('content');
      
      
     if (footer && footer.parentNode) {
     if (content) {
         footer.parentNode.insertBefore(bottomBar, footer);
         bottomBar.style.marginTop = '2.5rem';
    } else if (content) {
         content.appendChild(bottomBar);
         content.appendChild(bottomBar);
     }
     }
});
});