Update Compass QoL Enhancer to 1.13.2

- Fix getting the correct tab to open from the URL
This commit is contained in:
blankie 2023-09-01 11:35:11 +10:00
parent b251d9c2e5
commit 2e251efbdf
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 3 additions and 2 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.13.1 // @version 1.13.2
// @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
@ -223,6 +223,7 @@ function handleNewCalendarEvent(element, calendar) {
function handlePanelItem(panel, panelItem, isDefault, tabToOpen) { function handlePanelItem(panel, panelItem, isDefault, tabToOpen) {
let panelId = panelItem.itemId || panelItem.id; let panelId = panelItem.itemId || panelItem.id;
let panelItemHash = getPanelItemHash(panelId, isDefault); let panelItemHash = getPanelItemHash(panelId, isDefault);
// Automatically open tab specified in fragment // Automatically open tab specified in fragment
if (panelId === tabToOpen) { if (panelId === tabToOpen) {
// if the sessions tab is automatically opened, the currently selected tab is still dashboard for some reason, // if the sessions tab is automatically opened, the currently selected tab is still dashboard for some reason,
@ -331,7 +332,7 @@ function handleNewNode(node, observer) {
let panel = unsafeWindow.Ext.getCmp(topMostPanel.id); let panel = unsafeWindow.Ext.getCmp(topMostPanel.id);
let tabToOpen = window.location.pathname === "/Organise/Activities/Activity.aspx" let tabToOpen = window.location.pathname === "/Organise/Activities/Activity.aspx"
? getHashSearch().get("qol_open_tab") ? getHashSearch().get("qol_open_tab")
: (window.location.hash.replace(/^#(.+?)&.*$/, "$1") || null); : (window.location.hash.replace(/^#(.+?)(?:&.*)?$/, "$1") || null);
for (let i = 0; i < panel.items.items.length; i++) { for (let i = 0; i < panel.items.items.length; i++) {
handlePanelItem(panel, panel.items.items[i], i === 0, tabToOpen); handlePanelItem(panel, panel.items.items[i], i === 0, tabToOpen);
} }