Jump to content

MediaWiki:Common.js: Difference between revisions

Editingthingsforlife (talk | contribs)
Created page with "// Madness Descent Wiki – Custom JS for Vector-2022 skin // Place in MediaWiki:Common.js $(document).ready(function () { // Add theme class to body for easier CSS targeting document.body.classList.add('madness-theme'); // === Header Enhancements === const $heading = $('#firstHeading'); if ($heading.length) { $heading.css({ 'font-size': '3em', 'font-weight': 'bold', 'color': '#ff2c2c', 'text-s..."
 
Editingthingsforlife (talk | contribs)
No edit summary
Line 1: Line 1:
// Madness Descent Wiki – Custom JS for Vector-2022 skin
// Place in MediaWiki:Common.js
$(document).ready(function () {
$(document).ready(function () {
    // Add theme class to body for easier CSS targeting
  // === Add Global Theme Class ===
    document.body.classList.add('madness-theme');
  document.body.classList.add('madness-theme');
 
    // === Header Enhancements ===
    const $heading = $('#firstHeading');
    if ($heading.length) {
        $heading.css({
            'font-size': '3em',
            'font-weight': 'bold',
            'color': '#ff2c2c',
            'text-shadow': '0 0 8px #ff0000',
            'text-align': 'center',
            'margin-bottom': '20px'
        });
    }
 
    // === Homepage Enhancements ===
    if (mw.config.get('wgPageName') === 'Main_Page') {
        const content = $('#bodyContent');
 
        // Center the content
        content.css({
            'text-align': 'center',
            'padding': '20px',
            'background-color': '#2a1b14',
            'border': '2px solid #ff3b3b',
            'border-radius': '10px',
            'box-shadow': '0 0 12px #ff0000',
        });
 
        // Add a glowing welcome box
        const welcomeBox = `
            <div id="madness-welcome" style="
                margin-top: 1em;
                background-color: #120a07;
                color: #ffffff;
                padding: 20px;
                border: 2px solid #ff2c2c;
                border-radius: 12px;
                box-shadow: 0 0 15px #ff0000;
                font-size: 1.2em;
                line-height: 1.6em;
            ">
                <strong>Welcome to the official Madness Descent Wiki!</strong><br>
                Madness Descent is an asymmetrical Roblox game inspired by Pillar Chase 2.
            </div>
        `;
 
        content.prepend(welcomeBox);
 
        // Add a call-to-action "Explore" button
        const exploreBtn = `
            <div style="margin-top: 30px;">
                <button style="
                    background-color: #ff4646;
                    border: none;
                    color: white;
                    font-weight: bold;
                    font-size: 1.2em;
                    padding: 15px 30px;
                    border-radius: 12px;
                    box-shadow: 0 0 10px #ff2c2c;
                    cursor: pointer;
                " onclick="location.href='/wiki/Monsters'">Explore Monsters</button>
            </div>
        `;


        content.append(exploreBtn);
  // === Toggle Sidebar Tools Panel ===
     }
  const tools = document.getElementById('p-tb');
  if (tools) {
     tools.classList.add('collapsed');


     // === Sidebar Enhancements (Navigation & Community) ===
     const toggleBtn = document.createElement('div');
    const enhanceSidebarSection = (selector, title) => {
    toggleBtn.id = 'p-tb-toggle';
        const section = $(selector);
    toggleBtn.innerText = 'Tools';
        if (section.length) {
    document.body.appendChild(toggleBtn);
            section.find('h3').css({
                'color': '#ff3b3b',
                'font-family': 'Impact, sans-serif',
                'font-size': '1.2em',
                'border-bottom': '2px solid #ff4444',
                'margin-bottom': '10px'
            });


            section.find('ul li a').css({
    toggleBtn.addEventListener('click', () => {
                'background-color': '#1a120e',
      tools.classList.toggle('collapsed');
                'color': '#ffd966',
    });
                'padding': '8px',
  }
                'border-radius': '5px',
                'display': 'block',
                'margin-bottom': '5px',
                'text-decoration': 'none'
            }).hover(function () {
                $(this).css({
                    'background-color': '#333',
                    'color': '#fff'
                });
            });
        }
    };


    enhanceSidebarSection('#p-navigation');
  // === Enhance Editing/History/Actions Pages ===
     enhanceSidebarSection('#p-Community');
  $('.mw-editform, .mw-changeslist, .mw-page-info').css({
    'background-color': '#1f1410',
     'border': '2px solid #ff2c2c',
    'padding': '20px',
    'border-radius': '8px',
    'box-shadow': '0 0 10px #ff0000'
  });


    // === Add favicon (optional) ===
  $('textarea, input, select').css({
    $('head').append('<link rel="icon" type="image/png" href="https://example.com/path/to/icon.png">');
    'background-color': '#2b1b15',
    'color': '#fff',
    'border': '1px solid #ff3b3b'
  });
});
});
Cookies help us deliver our services. By using our services, you agree to our use of cookies.