Jump to content

MediaWiki:Common.js: Difference between revisions

An idea by Jeff Lawlor
Created on 2025-04-25
No edit summary
No edit summary
Tags: Mobile edit Mobile web edit
Line 2: Line 2:




/* Any JavaScript here will be loaded for all users on every page load.  
/* Any JavaScript here will be loaded for all users on every page load. */
document.addEventListener('DOMContentLoaded', function () {
  document.querySelectorAll('.infobox-tab').forEach(button => {
  console.log("Found button");
    button.addEventListener('click', () => {
console.log("✅  Taba licked!");


      const tab = button.dataset.tab;
$('.infobox-tab').click(function(e) {
      document.querySelectorAll('.infobox-panel').forEach(panel => panel.style.display = 'none');
      document.querySelector('.infobox-panel.' + tab).style.display = 'block';
      document.querySelectorAll('.infobox-tab').forEach(b => b.classList.remove('active'));
      button.classList.add('active');
    });
  });
});
*/
 
$('.infobox-tab').click(function(e)
{
var tab = $(e.target).attr('data-tab');
var tab = $(e.target).attr('data-tab');
$('.infobox-panel').hide();
$('.infobox-panel').hide();
Line 27: Line 11:
$(e.target).addClass('active');
$(e.target).addClass('active');
});
});
$(document).ready(function() {
if ($(body).hasClass('skin-minerva')) {
$('#mw-content-text div section[class="mf-section-0"]').children().last()
.insertBefore('#mw-content-text div section[class="mf-section-0"] div[class="infobox-idea"]');
}
});

Revision as of 16:05, 20 May 2025

console.log("✅ MediaWiki:Common.js loaded");


/* Any JavaScript here will be loaded for all users on every page load. */

$('.infobox-tab').click(function(e)	{
		var tab = $(e.target).attr('data-tab');
		$('.infobox-panel').hide();
		$('.infobox-panel.' + tab).show();
		$('.infobox-tab').removeClass('active');
		$(e.target).addClass('active');
	});

$(document).ready(function() {
	if ($(body).hasClass('skin-minerva')) {
		$('#mw-content-text div section[class="mf-section-0"]').children().last()
			.insertBefore('#mw-content-text div section[class="mf-section-0"] div[class="infobox-idea"]');
	}
});