Update Compass QoL Enhancer to 1.20.0
- Prevent scrolling if a window is open - Hide user's last name on learning tasks
This commit is contained in:
parent
52a151ae36
commit
40268aade6
|
@ -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.19.1
|
// @version 1.20.0
|
||||||
// @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
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
let qolTabOpened = false;
|
let qolTabOpened = false;
|
||||||
let qolLearningTaskOpened = false;
|
let qolLearningTaskOpened = false;
|
||||||
|
let shownWindows = 0;
|
||||||
|
|
||||||
// needed because .toString() adds a trailing = for empty values
|
// needed because .toString() adds a trailing = for empty values
|
||||||
URLSearchParams.prototype.laxToString = function() {
|
URLSearchParams.prototype.laxToString = function() {
|
||||||
|
@ -60,6 +61,27 @@ function getPanelItemHash(panelId, isDefault) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Prevent scrolling if a window is open
|
||||||
|
function handleWindowShow() {
|
||||||
|
shownWindows++;
|
||||||
|
document.documentElement.style.overflow = "hidden";
|
||||||
|
}
|
||||||
|
function handleWindowClose() {
|
||||||
|
shownWindows--;
|
||||||
|
if (shownWindows <= 0) {
|
||||||
|
document.documentElement.style.overflow = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let Window = getExtClass("Ext.window.Window");
|
||||||
|
if (Window) {
|
||||||
|
let original = Window.prototype.initComponent;
|
||||||
|
Window.prototype.initComponent = function() {
|
||||||
|
original.apply(this, arguments);
|
||||||
|
this.on("show", handleWindowShow);
|
||||||
|
this.on("close", handleWindowClose);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Prevent the dashboard tab in the user page being "dsh"
|
// Prevent the dashboard tab in the user page being "dsh"
|
||||||
let UserProfileNewWidget = getExtClass("Compass.widgets.UserProfileNewWidget");
|
let UserProfileNewWidget = getExtClass("Compass.widgets.UserProfileNewWidget");
|
||||||
if (UserProfileNewWidget) {
|
if (UserProfileNewWidget) {
|
||||||
|
@ -292,8 +314,12 @@ function handleNewCalendarEvent(element, calendar) {
|
||||||
if (calendarPanel.targetUserId !== undefined) {
|
if (calendarPanel.targetUserId !== undefined) {
|
||||||
a.href += `?userId=${calendarPanel.targetUserId}`;
|
a.href += `?userId=${calendarPanel.targetUserId}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link specifically to the learning task
|
// Link specifically to the learning task
|
||||||
a.href += `#learningTasks&qol_learning_task=${calendarData.learningTaskId}`;
|
a.href += `#learningTasks&qol_learning_task=${calendarData.learningTaskId}`;
|
||||||
|
|
||||||
|
// Hide user's last name on learning tasks
|
||||||
|
calendarData.longTitleWithoutTime = calendarData.longTitleWithoutTime.replace(/^.+?, /, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show the finish time for applicable calendar events
|
// Show the finish time for applicable calendar events
|
||||||
|
|
|
@ -59,6 +59,8 @@ A userscript that adds small but useful features for Compass. Features are:
|
||||||
- Files and folders in Resources are now sorted alphabetically
|
- Files and folders in Resources are now sorted alphabetically
|
||||||
- The option to remember logins is unchecked by default
|
- The option to remember logins is unchecked by default
|
||||||
- The dashboard tab in a user's profile no longer points you to #dsh
|
- 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
|
||||||
|
- The user's last name is hidden on learning tasks
|
||||||
|
|
||||||
[Link Hints]: https://lydell.github.io/LinkHints/
|
[Link Hints]: https://lydell.github.io/LinkHints/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue