From 86e3646fa2e0444d16f5c0ba59cb93234246613b Mon Sep 17 00:00:00 2001 From: blankie Date: Thu, 10 Aug 2023 18:07:52 +1000 Subject: [PATCH] Update Compass QoL Enhancer to 1.8.1 - Fix `document.querySelector(...) is null` when clicking on the background of a window with no close button --- Compass QoL Enhancer.user.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Compass QoL Enhancer.user.js b/Compass QoL Enhancer.user.js index 67b9dbb..0f8806e 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.8.0 +// @version 1.8.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 @@ -228,7 +228,10 @@ document.body.addEventListener("click", function(event) { } } - document.querySelector(".x-window-closable.x-window-active .x-tool-close").click(); + let closeButton = document.querySelector(".x-window-closable.x-window-active .x-tool-close"); + if (closeButton) { + closeButton.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();