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
This commit is contained in:
blankie 2023-07-23 15:30:36 +10:00
parent c35511a219
commit 67cb1e9072
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
2 changed files with 17 additions and 8 deletions

View File

@ -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);
}
};
// 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;
}

View File

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