MediaWiki:Gadget-Modal.js

var modal = document.getElementById("modalDialog");

// When the user clicks anywhere outside of the modal, close it window.onclick = function(event) { if (event.target == modal) { modal.style.display = "none"; } }