MediaWiki:Common.js
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.
$(document).ready(function() { // Tab switching $('.tab').click(function() { // Remove active class from all tabs $('.tab').removeClass('active'); // Add active class to clicked tab $(this).addClass('active'); // Content switching (if tabs control content) var tabId = $(this).data('tab'); // Assumes data-tab attribute (e.g., data-tab="tab1") if (tabId) { $('.tab-content').hide(); // Hide all tab content $('#' + tabId).show(); // Show content for active tab } }); // Collapsible sections (only if native mw-collapsible is unavailable or customized) $('.mw-collapsible').each(function() { var $this = $(this); // Hide content initially $this.find('.mw-collapsible-content').hide(); // Create toggle link if not present if (!$this.find('.mw-collapsible-toggle').length) { $this.prepend('<span class="mw-collapsible-toggle" style="cursor:pointer; color:blue; text-decoration:underline;">Expand</span>'); } // Toggle on click $this.find('.mw-collapsible-toggle').click(function() { $this.toggleClass('mw-collapsed'); var $content = $this.find('.mw-collapsible-content'); $content.slideToggle(); // Update toggle text $(this).text($content.is(':visible') ? 'Hide' : 'Expand'); }); }); });