Update Compass QoL Enhancer to 1.6.0

- Make Link Hints work with file upload buttons
This commit is contained in:
blankie 2023-08-03 21:35:10 +10:00
parent 7bef678880
commit 1c576bf970
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
2 changed files with 14 additions and 11 deletions

View File

@ -2,7 +2,7 @@
// @name Compass QoL Enhancer // @name Compass QoL Enhancer
// @namespace blankie-scripts // @namespace blankie-scripts
// @match http*://*.compass.education/* // @match http*://*.compass.education/*
// @version 1.5.0 // @version 1.6.0
// @author blankie // @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 // @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 // @inject-into page
@ -202,18 +202,20 @@ let observer = new MutationObserver(function(mutations, observer) {
}); });
observer.observe(document.body, {childList: true, subtree: true}); observer.observe(document.body, {childList: true, subtree: true});
document.body.addEventListener("click", function(event) { document.body.addEventListener("click", function(event) {
// Add the ability to close windows by clicking on the background if (event.target.classList.contains("x-mask")) {
if (!event.target.classList.contains("x-mask")) { // Add the ability to close windows by clicking on the background
return; let maskZIndex = BigInt(event.target.style.zIndex);
} for (let maskMsg of document.querySelectorAll(".x-mask-msg")) {
let maskZIndex = BigInt(event.target.style.zIndex); if (BigInt(maskMsg.style.zIndex) >= maskZIndex && maskMsg.style.display !== "none") {
for (let maskMsg of document.querySelectorAll(".x-mask-msg")) { return;
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}); }, {passive: true});
// Suppress that annoying barebones context menu that only has Copy // Suppress that annoying barebones context menu that only has Copy

View File

@ -27,6 +27,7 @@ A userscript that adds small but useful features for Compass. Features include:
open. you can also ctrl+click on them) open. you can also ctrl+click on them)
- Files and folders in Resources is now marked clickable ([Link Hints] can now - Files and folders in Resources is now marked clickable ([Link Hints] can now
open them!) open them!)
- File upload buttons now work with [Link Hints]
- Links inside lesson plans now open in the parent tab by default instead of - Links inside lesson plans now open in the parent tab by default instead of
creating a new tab creating a new tab
- The context menu that only says "Copy" is now suppressed - The context menu that only says "Copy" is now suppressed