MediaWiki:Common.js: Difference between revisions

MediaWiki interface page
No edit summary
No edit summary
Line 1: Line 1:
/* 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. */
(function () {
(function () {
  var myElement = document.getElementById('team-toggle');
// If Participants team list with a toggle button is added, then make that button clickable
  if ( myElement ) {
var myElement = document.getElementById('team-toggle');
  myElement.addEventListener('click', function(e){
if ( myElement ) {
  console.log(e);
  myElement.addEventListener('click', function(e){
  document.querySelectorAll('.team-list .players').forEach(function(el){
  if ( e.target.innerHTML === 'Show Players' ) e.target.innerHTML = 'Hide Players';
  el.classList.toggle('show');
  else e.target.innerHTML = 'Show Players';
  });
  document.querySelectorAll('.team-list .players').forEach(function(el){
  });
  el.classList.toggle('show');
  }
  });
});
}
}());
}());

Revision as of 20:43, 11 September 2022

/* Any JavaScript here will be loaded for all users on every page load. */
(function () {
	// If Participants team list with a toggle button is added, then make that button clickable
	var myElement = document.getElementById('team-toggle');
	if ( myElement ) {
  		myElement.addEventListener('click', function(e){
	  	 	if ( e.target.innerHTML === 'Show Players' ) e.target.innerHTML = 'Hide Players';
	  	 	else e.target.innerHTML = 'Show Players';
		  	document.querySelectorAll('.team-list .players').forEach(function(el){
		  		el.classList.toggle('show');
		  	});
		});
	}
}());