MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary Tag: Reverted |
No edit summary Tag: Manual revert |
||
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. */ | ||
document.addEventListener("DOMContentLoaded", function() { | document.addEventListener("DOMContentLoaded", function() { | ||
var captions = document.querySelectorAll(".clickable-caption .caption-text"); | |||
captions.forEach(function(caption) { | |||
caption.style.cursor = "pointer"; | |||
caption.addEventListener("click", function() { | |||
var expandedText = this.closest('.clickable-caption').querySelector('.expanded-text'); | |||
if (expandedText.style.display === "none" || expandedText.style.display === "") { | |||
expandedText.style.display = "block"; | |||
} else { | |||
expandedText.style.display = "none"; | |||
} | |||
}); | |||
}); | |||
}); | }); |
Revision as of 04:47, 19 May 2024
/* Any JavaScript here will be loaded for all users on every page load. */ document.addEventListener("DOMContentLoaded", function() { var captions = document.querySelectorAll(".clickable-caption .caption-text"); captions.forEach(function(caption) { caption.style.cursor = "pointer"; caption.addEventListener("click", function() { var expandedText = this.closest('.clickable-caption').querySelector('.expanded-text'); if (expandedText.style.display === "none" || expandedText.style.display === "") { expandedText.style.display = "block"; } else { expandedText.style.display = "none"; } }); }); });