MediaWiki:Common.js

From The Jadnix Codex

Revision as of 15:57, 9 February 2026 by Sinvrh (talk | contribs)

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.
/* ============================================================
   JADNIX CODEX: CORE SCRIPTS
   ============================================================ */

$(function() {
    // 1. DEFINE LOGOS
    const logos = {
        still:   'https://files.catbox.moe/0cmhjh.png',
        dealer:  'https://files.catbox.moe/73m0cp.png',
        skipper: 'https://files.catbox.moe/YOUR_SKIPPER_LOGO_URL_HERE.png' // <--- PASTE URL HERE
    };

    // 2. HELPER FUNCTION: FORCE LOGO SWAP
    function swapLogo(url) {
        // Target standard MW logo
        $('.mw-logo-icon').attr('src', url);
        // Target Citizen Header logo
        $('.citizen-header__logo img').attr('src', url);
        // Target Footer logo
        $('.citizen-footer__logo img').attr('src', url);
        // Target Mobile/Drawer logo
        $('.citizen-drawer__logo img').attr('src', url);
    }

    // 3. APPLY THEMES & LOGOS
    
    // DEALERS
    if ($('.faction-dealer').length) {
        $('body').addClass('theme-dealer');
        swapLogo(logos.dealer);
    }
    // SKIPPERS
    else if ($('.faction-skipper').length) {
        $('body').addClass('theme-skipper');
        swapLogo(logos.skipper);
    }
    // THE STILL (Default/Home)
    else if ($('.faction-still').length) {
        $('body').addClass('theme-still');
        swapLogo(logos.still);
    }
    
    // 4. CRDD CALCULATOR LOGIC (Keep the calculator working!)
    if ($('#crdd-interface').length) {
        $('.crdd-range').on('input', function() {
            $(this).next('.crdd-value-display').text($(this).val());
        });
        
        // (Re-paste the calculator logic function here if you lost it, 
        // or just ensure the calculator part from the previous step is included)
    }
});