Update Compass QoL Enhancer to 1.4.0

- Display calendar events' end time now without having to hover over them
This commit is contained in:
blankie 2023-08-01 16:55:53 +10:00
parent ea2571b756
commit 906974ae67
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
2 changed files with 9 additions and 4 deletions

View File

@ -2,7 +2,7 @@
// @name Compass QoL Enhancer
// @namespace blankie-scripts
// @match http*://*.compass.education/*
// @version 1.3.0
// @version 1.4.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
@ -84,8 +84,8 @@ function handleNewNode(node) {
if (node.localName === "td") {
node.setAttribute("role", "button");
}
for (let expander of node.querySelectorAll("td, .x-tree-expander")) {
expander.setAttribute("role", "button");
for (let element of node.querySelectorAll("td, .x-tree-expander")) {
element.setAttribute("role", "button");
}
}
}
@ -119,9 +119,13 @@ function handleNewCalendarEvent(element) {
let calendarElement = element.closest(".x-component.ext-cal-ct, .x-component.ext-cal-body-ct");
let calendar = unsafeWindow.Ext.getCmp(calendarElement.id);
if (a.classList.contains("activity-type-1")) {
// Add a link for activities/"standard classes"
// Add a link and show the finish time for activities/"standard classes"
let data = calendar.getEventRecordFromEl(element).data;
let startString = unsafeWindow.Ext.util.Format.date(data.start, unsafeWindow.Compass.TIME_NO_PERIOD_FORMAT);
let finishString = unsafeWindow.Ext.util.Format.date(data.finish, unsafeWindow.Compass.TIME_NO_PERIOD_FORMAT);
a.href = `/Organise/Activities/Activity.aspx?targetUserId=${data.targetStudentId}#session/${data.instanceId}`;
// yes, innerHTML. longTitleWithoutTime can apparently contain HTML. lets hope that startString and finishString don't
a.querySelector("span").innerHTML = `${startString} - ${finishString}: ${data.longTitleWithoutTime}`;
preventCompassHandler = true;
} else if (a.classList.contains("activity-type-10")) {
// Add a link for learning tasks

View File

@ -22,6 +22,7 @@ A userscript that adds small but useful features for Compass. Features include:
- The ability to close windows by clicking on the background
- Calendar events are now links (they work with [Link Hints] now! you can also
ctrl+click on "standard classes" and learning tasks)
- Calendar events now show their end time without having to being hovered
- Tabs are now links (you can refresh pages and the tab will automatically
open. you can also ctrl+click on them)
- Files and folders in Resources is now marked clickable ([Link Hints] can now