MediaWiki:Common.js: Difference between revisions

From yangwa
(Created page with "// Only run on Main Page if (mw.config.get('wgPageName') === 'Main_Page') { const style = document.createElement('style'); style.innerHTML = ` body { background-color: #ffffcc !important; } #mw-head-base, #mw-head, #p-personal, #mw-navigation { position: fixed !important; top: auto !important; bottom: 0 !important; width: 100%; z-index: 999; background-color: #f8f9fa; padding...")
 
No edit summary
 
Line 38: Line 38:
     document.head.appendChild(style);
     document.head.appendChild(style);
}
}
mw.loader.using('mediawiki.util', function () {
  $(document).ready(function () {
    const footer = document.getElementById('footer');
    if (footer) {
      const icp = document.createElement('div');
      icp.style.textAlign = 'center';
      icp.style.fontSize = '12px';
      icp.style.marginTop = '10px';
      icp.style.color = '#666';
      icp.innerHTML = '© 2025 Yangwa Lab. <a href="https://beian.miit.gov.cn" target="_blank" style="color:#666;text-decoration:none;">蜀ICP备2025131392号</a>';
      footer.appendChild(icp);
    }
  });
});

Latest revision as of 18:45, 11 April 2025

// Only run on Main Page
if (mw.config.get('wgPageName') === 'Main_Page') {
    const style = document.createElement('style');
    style.innerHTML = `
    body {
        background-color: #ffffcc !important;
    }

    #mw-head-base,
    #mw-head,
    #p-personal,
    #mw-navigation {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        width: 100%;
        z-index: 999;
        background-color: #f8f9fa;
        padding: 10px 20px;
        box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
        display: flex !important;
        justify-content: space-between;
        align-items: center;
    }

    #bodyContent {
        margin-bottom: 140px !important;
    }

    .vector-page-title {
        display: none !important;
    }

    .mw-logo-wordmark {
        display: none !important;
    }
    `;
    document.head.appendChild(style);
}

mw.loader.using('mediawiki.util', function () {
  $(document).ready(function () {
    const footer = document.getElementById('footer');
    if (footer) {
      const icp = document.createElement('div');
      icp.style.textAlign = 'center';
      icp.style.fontSize = '12px';
      icp.style.marginTop = '10px';
      icp.style.color = '#666';
      icp.innerHTML = '© 2025 Yangwa Lab. <a href="https://beian.miit.gov.cn" target="_blank" style="color:#666;text-decoration:none;">蜀ICP备2025131392号</a>';
      footer.appendChild(icp);
    }
  });
});