diff --git a/Compass QoL Enhancer.user.js b/Compass QoL Enhancer.user.js index bc9c9a6..e9fe3f1 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.5.0 +// @version 1.6.0 // @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 @@ -202,18 +202,20 @@ let observer = new MutationObserver(function(mutations, observer) { }); observer.observe(document.body, {childList: true, subtree: true}); document.body.addEventListener("click", function(event) { - // Add the ability to close windows by clicking on the background - 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; + if (event.target.classList.contains("x-mask")) { + // Add the ability to close windows by clicking on the background + 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(); + document.querySelector(".x-window-closable.x-window-active .x-tool-close").click(); + } else if (event.target.classList.contains("x-form-file-btn")) { + // Make Link Hints work with uploading files + event.target.querySelector("input[type=file]").click(); + } }, {passive: true}); // Suppress that annoying barebones context menu that only has Copy diff --git a/README.md b/README.md index 6dca88c..36b5765 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ A userscript that adds small but useful features for Compass. Features include: open. you can also ctrl+click on them) - Files and folders in Resources is now marked clickable ([Link Hints] can now open them!) +- File upload buttons now work with [Link Hints] - Links inside lesson plans now open in the parent tab by default instead of creating a new tab - The context menu that only says "Copy" is now suppressed