From 67cb1e9072218a6143204b162e52b2e7d7c3e623 Mon Sep 17 00:00:00 2001 From: blankie Date: Sun, 23 Jul 2023 15:30:36 +1000 Subject: [PATCH] Update Compass QoL Enhancer to 1.1.0 - Prevent a Uncaught TypeError: unsafeWindow.CKEDITOR is undefined from showing - Uncheck the Remember Me box by default --- Compass QoL Enhancer.user.js | 24 ++++++++++++++++-------- README.md | 1 + 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Compass QoL Enhancer.user.js b/Compass QoL Enhancer.user.js index d2194ea..a162aeb 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.0.0 +// @version 1.1.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 @@ -107,10 +107,18 @@ function handleActivityTabClick(element) { // Suppress that annoying barebones context menu that only has Copy // why is it not obvious that you can just hold ctrl or shift to suppress it??? // i know it's compass' fault but i'm still frustrated -// https://stackoverflow.com/a/10815581 -let originalOn = unsafeWindow.CKEDITOR.dom.domObject.prototype.on; -unsafeWindow.CKEDITOR.dom.domObject.prototype.on = function(type, listener) { - if (type !== "contextmenu") { - return originalOn.apply(this, arguments); - } -}; \ No newline at end of file +// unsafeWindow.CKEDITOR may not be set if you're on the login page, for example +if (unsafeWindow.CKEDITOR) { + let originalOn = unsafeWindow.CKEDITOR.dom.domObject.prototype.on; + unsafeWindow.CKEDITOR.dom.domObject.prototype.on = function(type, listener) { + // https://stackoverflow.com/a/10815581 + if (type !== "contextmenu") { + return originalOn.apply(this, arguments); + } + }; +} + +// Uncheck the Remember Me button by default +if (window.location.pathname === "/login.aspx") { + document.querySelector("#rememberMeChk").checked = false; +} \ No newline at end of file diff --git a/README.md b/README.md index 767c457..db0f4b3 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ A userscript that adds small but useful features for Compass. Features include: - `&openLearningTaskTab` is automatically added whenever you go to the Learning Tasks tab and removed whenever you go to another tab - The context menu that only says "Copy" is now suppressed +- The option to remember logins is unchecked by default ## Elements with ID lister