Jump to content

MediaWiki:Common.js

From ZenithXI
Revision as of 15:03, 4 July 2026 by Sargonnas (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// Wait for the DOM to be fully loaded
$(document).ready(function() {
  // Target the logo wordmark
  var wordmark = $('.mw-logo-wordmark');
  
  if (wordmark.length) {
    // Get the current text
    var text = wordmark.text();
    
    // If the text is "ZenithXI", split it
    if (text === "ZenithXI") {
      // Empty the current content
      wordmark.empty();
      
      // Set inline style with !important via attribute
      wordmark.attr('style', 'font-size: 40px !important');
      
      // Add the colored spans
      wordmark.append(
        $('<span>').text("ZENITH").css("color", "#0077B6"),
        $('<span>').text("XI").css("color", "#F4A261")
      );
    }
  }
});

// Workaround to auto enable sidemenu for anon users.

if (!mw.config.get('wgUserName')) {
    const observer = new MutationObserver((mutationsList, observer) => {
        for (const mutation of mutationsList) {
            if (mutation.target.classList.contains('vector-animations-ready')) {
                document.querySelector(
                    '[data-event-name="pinnable-header.vector-main-menu.pin"]'
                ).click()
                observer.disconnect();
                break;
            }
        }
    });
    observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });
}