Update Compass QoL Enhancer to 1.24.0
- Treat message boxes as windows - Prevent a network request from coming out when viewing a node's permissions to prevent arousing suspicion and to make it a tiny bit faster - Fix making the "View Permission for " window clearer if the node's name is empty - Prevent clicking "Loading Class Items..." from reloading the current page - Preload subjects and classes when the page loads
This commit is contained in:
		
							parent
							
								
									a0f8954ba4
								
							
						
					
					
						commit
						148f9eb43d
					
				| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
// @name        Compass QoL Enhancer
 | 
			
		||||
// @namespace   blankie-scripts
 | 
			
		||||
// @match       http*://*.compass.education/*
 | 
			
		||||
// @version     1.23.0
 | 
			
		||||
// @version     1.24.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
 | 
			
		||||
| 
						 | 
				
			
			@ -85,6 +85,24 @@ if (Window) {
 | 
			
		|||
        this.on("close", handleWindowClose);
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
// example of message boxes: remove device on /Configure/LoginAndSecurity.aspx
 | 
			
		||||
// for some reason, listening on Ext.window.MessageBox does nothing
 | 
			
		||||
let Msg = unsafeWindow.Ext ? unsafeWindow.Ext.Msg : null;
 | 
			
		||||
if (Msg) {
 | 
			
		||||
    let original = Msg.show;
 | 
			
		||||
    Msg.show = function(options) {
 | 
			
		||||
        let originalFn = options.fn;
 | 
			
		||||
 | 
			
		||||
        options.fn = function() {
 | 
			
		||||
            handleWindowClose();
 | 
			
		||||
            if (originalFn) {
 | 
			
		||||
                originalFn.apply(this, arguments);
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
        handleWindowShow();
 | 
			
		||||
        original.apply(this, arguments);
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (productNavBar) {
 | 
			
		||||
    productNavBar.style.zIndex = 20000;
 | 
			
		||||
| 
						 | 
				
			
			@ -325,6 +343,17 @@ if (WikiBrowserPanel) {
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    let originalUpdateNodePermissions = WikiBrowserPanel.prototype.updateNodePermissions;
 | 
			
		||||
    WikiBrowserPanel.prototype.updateNodePermissions = function() {
 | 
			
		||||
        // prevent a network request from coming out to prevent arousing suspicion and to speed up things
 | 
			
		||||
        let originalPostWithCallback = unsafeWindow.Compass.postWithCallback;
 | 
			
		||||
        unsafeWindow.Compass.postWithCallback = function(url, data, callback) {
 | 
			
		||||
            callback({d: false});
 | 
			
		||||
        };
 | 
			
		||||
        originalUpdateNodePermissions.apply(this, arguments);
 | 
			
		||||
        unsafeWindow.Compass.postWithCallback = originalPostWithCallback;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -549,7 +578,7 @@ function handleNewNode(node, observer) {
 | 
			
		|||
        handleLearningTasksTable(node);
 | 
			
		||||
    } else if (node.classList.contains("x-grid-view") && unsafeWindow.Ext.getCmp(node.id).up("#submissionsPanel")) {
 | 
			
		||||
        handleLearningTaskSubmissionTable(node);
 | 
			
		||||
    } else if (node.classList.contains("x-window") && node.querySelector(".x-window-header-text").innerText.startsWith("View Permissions for ")) {
 | 
			
		||||
    } else if (node.classList.contains("x-window") && node.querySelector(".x-window-header-text").textContent.startsWith("View Permissions for ")) {
 | 
			
		||||
        handlePermissionsWindow(node);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -662,6 +691,23 @@ for (let element of document.querySelectorAll("#productNavBar a[target='_blank']
 | 
			
		|||
    element.removeAttribute("target");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Prevent clicking "Loading Class Items..." from reloading the current page
 | 
			
		||||
let loadingClassItems = document.querySelector(".toolbar-classes-loading");
 | 
			
		||||
if (loadingClassItems) {
 | 
			
		||||
    loadingClassItems.addEventListener("click", function(event) {
 | 
			
		||||
        event.preventDefault();
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Preload subjects and classes when the page loads
 | 
			
		||||
let teachingAndLearning = document.querySelector(".toolbar-clickable-teaching-and-learning");
 | 
			
		||||
if (teachingAndLearning) {
 | 
			
		||||
    new MutationObserver(function(mutations, observer) {
 | 
			
		||||
        observer.disconnect();
 | 
			
		||||
        teachingAndLearning.dispatchEvent(new MouseEvent("mouseover"));
 | 
			
		||||
    }).observe(teachingAndLearning, {attributes: true});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// unsafeWindow.CKEDITOR may not be set if you're on the login page, for example
 | 
			
		||||
if (unsafeWindow.CKEDITOR) {
 | 
			
		||||
    // Suppress that annoying barebones context menu that only has Copy
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -62,6 +62,9 @@ A userscript that adds small but useful features for Compass. Features are:
 | 
			
		|||
- Reopening panel tabs and learning tasks when the URL changes
 | 
			
		||||
- The main navigation bar is no longer hidden behind masks that don't span the
 | 
			
		||||
  entire viewport
 | 
			
		||||
- Clicking on "Loading Class Items..." does nothing now instead of reloading
 | 
			
		||||
  the current page
 | 
			
		||||
- Preload subjects and classes when the page loads
 | 
			
		||||
- The option to remember logins is unchecked by default
 | 
			
		||||
- The dashboard tab in a user's profile no longer points you to #dsh
 | 
			
		||||
- Pages can no longer be scrolled if a window is currently open
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue