MediaWiki:Common.js

From Ultimate Dragon Ball Online Wiki

Revision as of 05:30, 26 February 2025 by Ravenalien (talk | contribs) (Created page with "→‎Any JavaScript here will be loaded for all users on every page load.: →‎Tab Navigation System for UltimateDBOWiki: (function() { 'use strict'; // Initialize when document is ready $(document).ready(function() { initializeTabs(); }); function initializeTabs() { // Find all tab containers on the page $('.tab-navigation').each(function(index) { var tabContainerId = 'tab-container-' + index;...")
(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)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */
/* Tab Navigation System for UltimateDBOWiki */
(function() {
    'use strict';
    
    // Initialize when document is ready
    $(document).ready(function() {
        initializeTabs();
    });
    
    function initializeTabs() {
        // Find all tab containers on the page
        $('.tab-navigation').each(function(index) {
            var tabContainerId = 'tab-container-' + index;
            $(this).attr('id', tabContainerId);
            
            var $container = $('#' + tabContainerId);
            var $tabButtons = $container.find('.tab-button');
            var $tabPanes = $container.find('.tab-pane');
            
            // Add click handlers to tab buttons
            $tabButtons.on('click', function() {
                var $this = $(this);
                var targetId = $this.data('target');
                
                // Remove active class from all buttons and panes in this container
                $container.find('.tab-button').removeClass('active');
                $container.find('.tab-pane').removeClass('active');
                
                // Add active class to clicked button and corresponding pane
                $this.addClass('active');
                $container.find('#' + targetId).addClass('active');
            });
        });
    }
})();

/* Add Tooltip functionality for map links */
(function() {
    'use strict';
    
    $(document).ready(function() {
        $('span.material-button a').each(function() {
            var href = $(this).attr('href');
            if (href && href.indexOf('world-map') !== -1) {
                $(this).parent().attr('title', 'Click to view location on map');
                
                // Optional: Add map icon
                $(this).prepend('<span class="map-icon">🗺️ </span>');
            }
        });
    });
})();

/* Enhanced Image Previews */
(function() {
    'use strict';
    
    $(document).ready(function() {
        $('.thumbimage').on('mouseenter', function() {
            $(this).css('transform', 'scale(1.05)');
            $(this).css('transition', 'transform 0.3s ease');
            $(this).css('box-shadow', '0 8px 16px rgba(0,0,0,0.2)');
        }).on('mouseleave', function() {
            $(this).css('transform', '');
            $(this).css('box-shadow', '');
        });
    });
})();