MediaWiki:Common.js: Difference between revisions

From The Jadnix Codex

No edit summary
Tag: Reverted
No edit summary
Tag: Reverted
Line 228: Line 228:


/* ============================================================
/* ============================================================
   THE YELLOW KILLER (UNCONDITIONAL)
   THE YELLOW KILLER (SCORCHED EARTH PROTOCOL)
   ============================================================ */
   ============================================================ */
$(function() {
(function() {
     // 1. Define the Target
     // Define the Nuke Function
     var navbar = $('#mw-navbar');
     function nukeTheme() {
        console.log("JADNIX: Executing Theme Override...");


    // 2. Execute Immediate Order 66 on the Navbar
        // 1. Target the Navbar (The Yellow Bar)
    if (navbar.length) {
        var navbar = document.getElementById('mw-navbar');
        // Remove the yellow class
        if (navbar) {
        navbar.removeClass('bg-ws');
            navbar.classList.remove('bg-ws'); // Strip the class
          
            // Force Inline Styles with !important
         // Force the Void Style (Black + Purple Border)
            navbar.style.cssText = 'background-color: #0a0a0f !important; background-image: none !important; border-bottom: 2px solid #a020f0 !important; color: white !important; box-shadow: none !important;';
         // We use .attr('style') to overwrite any existing inline styles
         }
         navbar.attr('style', 'background-color: #0a0a0f !important; background-image: none !important; border-bottom: 2px solid #a020f0 !important; color: #fff !important;');
 
       
         // 2. Target the White Containers (The Flashbang)
         // Log victory
         // We target .container-fluid specifically because your screenshot showed it was white
         console.log("JADNIX: Yellow Header neutralized.");
        var containers = document.querySelectorAll('.container-fluid, .mw-body, #content, .medik-wrap');
         containers.forEach(function(el) {
            el.style.cssText = 'background-color: #13131a !important; color: #d1d1d1 !important; border-color: #333 !important;';
        });
 
         // 3. Target the Footer
         var footer = document.querySelector('.mw-footer');
        if (footer) {
            footer.style.cssText = 'background-color: #0a0a0f !important; color: #666 !important;';
        }
     }
     }


     // 3. Clean up any other "bg-ws" elements (like mobile menus)
     // TRIGGER 1: Run Immediately
     $('.bg-ws').not('#mw-navbar').each(function() {
    nukeTheme();
        $(this).removeClass('bg-ws');
 
        $(this).css('background-color', '#0a0a0f');
    // TRIGGER 2: Run on jQuery Ready
    });
     $(function() { nukeTheme(); });
 
    // TRIGGER 3: Run on Window Load (When all scripts/images are done)
    $(window).on('load', function() { nukeTheme(); });


     // 4. Force Special Page Bodies (Preferences/Login) to be Dark
     // TRIGGER 4: The Poller (Keep checking for 2 seconds to fight the Skin's JS)
     // We check for the generic "mw-body" inside the special namespace wrapper
     var checks = 0;
     $('.ns-special #content, .ns-special .mw-body').css({
     var poller = setInterval(function() {
         'background-color': '#13131a',
         nukeTheme();
         'color': '#d1d1d1',
         checks++;
         'border': '1px solid #333'
         if (checks > 20) clearInterval(poller);
     });
     }, 100);
});
})();

Revision as of 20:42, 10 February 2026

/* ============================================================
   JADNIX CODEX: CORE SCRIPTS (Themes + Calculator + Logos)
   ============================================================ */

$(function() {
    /* --- PART A: LOGO & THEME SYSTEM --- */
    
    // 1. DEFINE LOGOS
    const logos = {
        still:   'https://files.catbox.moe/0cmhjh.png',
        dealer:  'https://files.catbox.moe/73m0cp.png',
        skipper: 'https://files.catbox.moe/8gs8n5.png'
    };

    // 2. HELPER: FORCE LOGO SWAP
    function swapLogo(url) {
        $('#p-logo a').css('background-image', 'url(' + url + ')');
    }

    // 3. DETECT FACTION -> APPLY CLASS & LOGO
    if ($('.faction-dealer').length) {
        $('body').addClass('theme-dealer');
        swapLogo(logos.dealer);
    }
    else if ($('.faction-skipper').length) {
        $('body').addClass('theme-skipper');
        swapLogo(logos.skipper);
    }
    else if ($('.faction-still').length) {
        $('body').addClass('theme-still');
    }

    /* --- PART B: CRDD CALCULATOR LOGIC --- */
    
    // Only run if calculator is present
    if ($('#crdd-interface').length) {
        
        // Update number displays instantly
        $('.crdd-range').on('input', function() {
            $(this).next('.crdd-value-display').text($(this).val());
        });

        // The Calculation Function
        function updateCRDD() {
            let totalScore = 0;
            let activeMaxScore = 0;
            let criticalOverride = false;
            
            // SECTION 1: SUBJECT
            let subjSkip = $('#skip-subject').is(':checked');
            if (!subjSkip) {
                let s1 = parseInt($('#s-strength').val()) || 0;
                let s2 = parseInt($('#s-durability').val()) || 0;
                let s3 = parseInt($('#s-mobility').val()) || 0;
                let s4 = parseInt($('#s-intel').val()) || 0;
                let s5 = parseInt($('#s-stamina').val()) || 0;
                let s6 = parseInt($('#s-threat').val()) || 0;
                let s7 = parseInt($('#s-swarm').val()) || 0;
                
                // Critical Check
                if (s6 > 24) criticalOverride = true;
                
                let avg = (s1+s2+s3+s4+s5+s6+s7) / 7;
                totalScore += avg;
                activeMaxScore += 33;
                
                let rating = "DOCILE";
                if (avg > 8) rating = "NEUTRAL";
                if (avg > 16) rating = "HOSTILE";
                if (avg > 24) rating = "VILE";
                $('#result-subject').text(avg.toFixed(1) + " (" + rating + ")");
                
                if (avg > 24) criticalOverride = true;
            } else {
                 $('#result-subject').text("SKIPPED");
            }

            // SECTION 2: ITEM
            let itemSkip = $('#skip-item').is(':checked');
            if (!itemSkip) {
                let i1 = parseInt($('#i-entropy').val()) || 0;
                let i2 = parseInt($('#i-instability').val()) || 0;
                let i3 = parseInt($('#i-radiation').val()) || 0;
                let i4 = parseInt($('#i-corrupt').val()) || 0;
                let i5 = parseInt($('#i-volatility').val()) || 0;
                let i6 = parseInt($('#i-unport').val()) || 0;
                let i7 = parseInt($('#i-anomalous').val()) || 0;
                let i8 = parseInt($('#i-qty').val()) || 0;

                if (i7 > 24) criticalOverride = true;

                let avg = (i1+i2+i3+i4+i5+i6+i7+i8) / 8;
                totalScore += avg;
                activeMaxScore += 33;
                
                let rating = "FUNCTIONAL";
                if (avg > 8) rating = "ALTERED";
                if (avg > 16) rating = "UNSTABLE";
                if (avg > 24) rating = "VOID";
                $('#result-item').text(avg.toFixed(1) + " (" + rating + ")");
            } else {
                $('#result-item').text("SKIPPED");
            }

            // SECTION 3: SEAM
            let seamSkip = $('#skip-seam').is(':checked');
            if (!seamSkip) {
                let m1 = parseInt($('#m-instability').val()) || 0;
                let m2 = parseInt($('#m-leakage').val()) || 0;
                let m3 = parseInt($('#m-geo').val()) || 0;
                let m4 = parseInt($('#m-atmo').val()) || 0;
                let m5 = parseInt($('#m-topo').val()) || 0;
                let m6 = parseInt($('#m-dead').val()) || 0;
                let m7 = parseInt($('#m-laws').val()) || 0;

                // Critical Checks
                if (m3 > 24 || m4 > 24 || m6 > 24 || m7 > 24) criticalOverride = true;

                let avg = (m1+m2+m3+m4+m5+m6+m7) / 7;
                totalScore += avg;
                activeMaxScore += 33;
                
                let rating = "ANCHORED";
                if (avg > 8) rating = "VOLATILE";
                if (avg > 16) rating = "FRACTURED";
                if (avg > 24) rating = "NULL";
                $('#result-seam').text(avg.toFixed(1) + " (" + rating + ")");
                
                if (avg > 24) criticalOverride = true;
            } else {
                $('#result-seam').text("SKIPPED");
            }

            // FINAL RESULT LOGIC
            let finalBox = $('#crdd-final-output');
            let finalLabel = $('#crdd-final-label');
            
            if (activeMaxScore === 0) {
                finalBox.text("ERROR: NO DATA");
                finalBox.css('color', 'red');
                return;
            }

            let percent = (totalScore / activeMaxScore) * 100;
            
            // STATE 1: CRITICAL OVERRIDE (Specific stat > 24)
            // Visual: Blinding White, Red Text, "LEAVE NOW"
            if (criticalOverride) {
                finalLabel.text("CRITICAL THREAT DETECTED");
                finalBox.text("NULL (" + percent.toFixed(1) + "% - LEAVE NOW)");
                finalBox.css({
                    'background-color': '#ffffff',
                    'color': '#000000',
                    'border-color': '#ff0000',
                    'text-shadow': '0 0 10px red',
                    'box-shadow': '0 0 30px rgba(255, 0, 0, 0.8)'
                });
            } 
            // STATE 2: NORMAL CALCULATION (Including Organic Null)
            else {
                let finalRating = "ANCHORED";
                let finalColor = "#00ff9f"; // Green
                let finalMsg = "YOU ARE SAFE";
                let finalShadow = finalColor;
                let finalBg = "transparent";
                let finalBoxShadow = "none";

                if (percent > 25) { 
                    finalRating = "VOLATILE"; 
                    finalColor = "#ffd700"; // Gold
                    finalMsg = "PROCEED WITH CAUTION"; 
                    finalShadow = finalColor;
                }
                if (percent > 50) { 
                    finalRating = "FRACTURED"; 
                    finalColor = "#ff4500"; // Orange-Red
                    finalMsg = "YOU ARE IN DANGER"; 
                    finalShadow = finalColor;
                }
                
                // ORGANIC NULL (Math > 75%, but no critical trigger)
                // Visual: Dead Grey, "REALITY FAILURE"
                if (percent > 75) { 
                    finalRating = "NULL"; 
                    finalColor = "#888888"; // Grey
                    finalMsg = "REALITY FAILURE"; 
                    finalShadow = "#000000"; // No Glow
                }

                finalLabel.text(finalMsg);
                finalBox.text(finalRating + " (" + percent.toFixed(1) + "%)");
                
                finalBox.css({
                    'background-color': finalBg,
                    'color': finalColor,
                    'border-color': finalColor,
                    'text-shadow': '0 0 10px ' + finalShadow,
                    'box-shadow': finalBoxShadow
                });
            }
        }

        // Trigger update on any change
        $('.crdd-range, input[type=checkbox]').on('input change', updateCRDD);
    }
});

/* ============================================================
   SPLASH SCREEN RANDOMIZER
   ============================================================ */
$(function() {
    if ($('body').hasClass('page-Warning')) {
        const factions = [
            { name: 'still', class: 'splash-purple', status: 'RECOGNIZED', pact: 'THE QUIESCENT PACT', target: 'ALPHA-EARTH' },
            { name: 'dealer', class: 'splash-gold', status: 'PAID IN FULL', pact: 'HOUSE VOIDSEED TERMS', target: 'THE GILDED GATE' },
            { name: 'skipper', class: 'splash-blue', status: 'SECURED', pact: 'R&R SAFETY PROTOCOLS', target: 'SUB-DIMENSION 00' }
        ];

        const roll = Math.floor(Math.random() * factions.length);
        const winner = factions[roll];

        $('body').addClass(winner.class);
        $('#splash-status').text(winner.status);
        $('#splash-pact').text(winner.pact);
        $('#splash-target').text(winner.target);
    }
});

/* ============================================================
   THE YELLOW KILLER (SCORCHED EARTH PROTOCOL)
   ============================================================ */
(function() {
    // Define the Nuke Function
    function nukeTheme() {
        console.log("JADNIX: Executing Theme Override...");

        // 1. Target the Navbar (The Yellow Bar)
        var navbar = document.getElementById('mw-navbar');
        if (navbar) {
            navbar.classList.remove('bg-ws'); // Strip the class
            // Force Inline Styles with !important
            navbar.style.cssText = 'background-color: #0a0a0f !important; background-image: none !important; border-bottom: 2px solid #a020f0 !important; color: white !important; box-shadow: none !important;';
        }

        // 2. Target the White Containers (The Flashbang)
        // We target .container-fluid specifically because your screenshot showed it was white
        var containers = document.querySelectorAll('.container-fluid, .mw-body, #content, .medik-wrap');
        containers.forEach(function(el) {
            el.style.cssText = 'background-color: #13131a !important; color: #d1d1d1 !important; border-color: #333 !important;';
        });

        // 3. Target the Footer
        var footer = document.querySelector('.mw-footer');
        if (footer) {
            footer.style.cssText = 'background-color: #0a0a0f !important; color: #666 !important;';
        }
    }

    // TRIGGER 1: Run Immediately
    nukeTheme();

    // TRIGGER 2: Run on jQuery Ready
    $(function() { nukeTheme(); });

    // TRIGGER 3: Run on Window Load (When all scripts/images are done)
    $(window).on('load', function() { nukeTheme(); });

    // TRIGGER 4: The Poller (Keep checking for 2 seconds to fight the Skin's JS)
    var checks = 0;
    var poller = setInterval(function() {
        nukeTheme();
        checks++;
        if (checks > 20) clearInterval(poller);
    }, 100);
})();