diff --git a/Compass QoL Enhancer.user.js b/Compass QoL Enhancer.user.js index a162aeb..1633096 100644 --- a/Compass QoL Enhancer.user.js +++ b/Compass QoL Enhancer.user.js @@ -2,7 +2,7 @@ // @name Compass QoL Enhancer // @namespace blankie-scripts // @match http*://*.compass.education/* -// @version 1.1.0 +// @version 1.1.1 // @author blankie // @description A userscript that adds small but useful features for Compass, such as the ability to close windows by clicking on the background // @inject-into page @@ -46,10 +46,17 @@ function handleNewNode(node) { document.body.addEventListener("click", function(event) { // Add the ability to close windows by clicking on the background - // 0px check to make sure that the mask is masking the entire background and not just a small subsection (e.g. a calendar) - if (event.target.classList.contains("x-mask") && event.target.style.left === "0px") { - document.querySelector(".x-window-closable.x-window-active .x-tool-close").click(); + if (!event.target.classList.contains("x-mask")) { + return; } + let maskZIndex = BigInt(event.target.style.zIndex); + for (let maskMsg of document.querySelectorAll(".x-mask-msg")) { + if (BigInt(maskMsg.style.zIndex) >= maskZIndex && maskMsg.style.display !== "none") { + return; + } + } + + document.querySelector(".x-window-closable.x-window-active .x-tool-close").click(); }, {passive: true}); function handleNewCalendarEvent(element) {