跳转到内容

MediaWiki:Common.js

来自简中Robloxian Wiki
DarkEccentric(留言 | 贡献)2026年9月6日 (日) 09:46的版本

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的更改的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
  • Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
  • Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5。
// ========== RSCA 顶栏替换 ==========

$(function() {
    // 隐藏 Vector 默认元素
    var toHide = ['p-logo', 'p-navigation', 'p-search', 'p-personal', 'p-tb', 'p-lang',
                   'mw-panel', 'mw-head-base', 'mw-page-base', 'p-banner', 'siteNotice',
                   'footer', 'catlinks', 'firstHeading'];
    toHide.forEach(function(id) {
        var el = document.getElementById(id);
        if (el) el.style.display = 'none';
    });
    
    // 隐藏 Vector 菜单和标题
    var menus = document.querySelectorAll('.vector-menu, .vector-menu-tabs, .vector-menu-content, .vector-user-links, .vector-user-menu, .vector-search-box, .firstHeading, .mw-page-title, .page-title');
    menus.forEach(function(m) { m.style.display = 'none'; });
    
    // 替换导航栏
    var nav = document.getElementById('mw-navigation');
    if (nav) {
        nav.innerHTML = '<div style="width:100%;background:#1a1a1a;border-bottom:2px solid #c41e3a;padding:0;margin:0;">' +
            '<div style="max-width:960px;margin:0 auto;padding:12px 20px;display:flex;align-items:center;justify-content:space-between;">' +
                '<div style="display:flex;align-items:center;gap:14px;">' +
                    '<span style="font-size:1.6em;font-weight:900;letter-spacing:0.12em;color:#ccc;text-transform:uppercase;">RSCA</span>' +
                    '<span style="font-size:0.78em;color:#888;letter-spacing:0.06em;">Roblox Simplified Chinese Archives</span>' +
                '</div>' +
                '<div style="display:flex;gap:2px;">' +
                    '<a href="/index.php/帮助:入门" style="padding:7px 16px;color:#b0b0b0;font-size:0.88em;letter-spacing:0.05em;border-radius:4px;transition:all 0.2s;" onmouseover="this.style.background=\'#333\';this.style.color=\'#fff\'" onmouseout="this.style.background=\'\';this.style.color=\'#b0b0b0\'">入门</a>' +
                    '<a href="/index.php/帮助:联系我们" style="padding:7px 16px;color:#b0b0b0;font-size:0.88em;letter-spacing:0.05em;border-radius:4px;transition:all 0.2s;" onmouseover="this.style.background=\'#333\';this.style.color=\'#fff\'" onmouseout="this.style.background=\'\';this.style.color=\'#b0b0b0\'">联系</a>' +
                    '<a href="/index.php/特殊:随机" style="padding:7px 16px;color:#b0b0b0;font-size:0.88em;letter-spacing:0.05em;border-radius:4px;transition:all 0.2s;" onmouseover="this.style.background=\'#333\';this.style.color=\'#fff\'" onmouseout="this.style.background=\'\';this.style.color=\'#b0b0b0\'">随机</a>' +
                    '<a href="/index.php/特殊:最近更改" style="padding:7px 16px;color:#b0b0b0;font-size:0.88em;letter-spacing:0.05em;border-radius:4px;transition:all 0.2s;" onmouseover="this.style.background=\'#333\';this.style.color=\'#fff\'" onmouseout="this.style.background=\'\';this.style.color=\'#b0b0b0\'">最近更改</a>' +
                '</div>' +
            '</div>' +
        '</div>';
        nav.style.display = 'block';
        nav.style.background = '#1a1a1a';
        nav.style.borderBottom = '2px solid #c41e3a';
        nav.style.height = 'auto';
        nav.style.position = 'relative';
        nav.style.width = '100%';
        nav.style.margin = '0';
        nav.style.padding = '0';
    }
    
    // 隐藏搜索框
    var search = document.getElementById('p-search');
    if (search) search.style.display = 'none';
    
    // 隐藏用户菜单
    var personal = document.getElementById('p-personal');
    if (personal) personal.style.display = 'none';
    
    // 隐藏侧边栏
    var panel = document.getElementById('mw-panel');
    if (panel) panel.style.display = 'none';
    
    // 隐藏页脚
    var footer = document.getElementById('footer');
    if (footer) footer.style.display = 'none';
    
    // 隐藏 logo
    var logo = document.getElementById('p-logo');
    if (logo) logo.style.display = 'none';
    
    // 隐藏 Vector 的页面标题和面包屑
    var titles = document.querySelectorAll('h1.firstHeading, .mw-page-title, .page-title, #contentSub, .subpages, .breadcrumb');
    titles.forEach(function(t) { t.style.display = 'none'; });
});