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:
parent
ea2571b756
commit
906974ae67
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue