Update Compass QoL Enhancer to 1.1.1

- Fix being able to close the file selection window by clicking on the
background while a file is being uploaded
This commit is contained in:
blankie 2023-07-24 17:20:44 +10:00
parent 67cb1e9072
commit 4a4dcd8bf5
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 11 additions and 4 deletions

View File

@ -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) {