Update Compass QoL Enhancer to 1.17.0
- Sort files and folders alphabetically
This commit is contained in:
parent
eb1a4ab0a3
commit
77b73718a6
|
@ -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.16.0
|
// @version 1.17.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
|
||||||
|
@ -205,6 +205,36 @@ if (InstanceDetailsWidget) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort by name in wiki/resources
|
||||||
|
function wikiNodeSort(lhs, rhs) {
|
||||||
|
function isFolder(node) {
|
||||||
|
return node.data.type === unsafeWindow.Compass.enums.WikiNodeType.Folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFolder(lhs) && !isFolder(rhs)) {
|
||||||
|
return -1;
|
||||||
|
} else if (!isFolder(lhs) && isFolder(rhs)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
let lhsName = lhs.data.name.toLowerCase();
|
||||||
|
let rhsName = rhs.data.name.toLowerCase();
|
||||||
|
if (lhsName < rhsName) {
|
||||||
|
return -1;
|
||||||
|
} else if (lhsName === rhsName) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let WikiBrowserPanel = getExtClass("Compass.widgets.WikiBrowserPanel");
|
||||||
|
if (WikiBrowserPanel) {
|
||||||
|
let original = WikiBrowserPanel.prototype.renderLayout;
|
||||||
|
WikiBrowserPanel.prototype.renderLayout = function() {
|
||||||
|
original.apply(this, arguments);
|
||||||
|
this.treePanel.store.sort({sorterFn: wikiNodeSort});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function handleNewCalendarEvent(element, calendar) {
|
function handleNewCalendarEvent(element, calendar) {
|
||||||
|
|
|
@ -48,6 +48,7 @@ A userscript that adds small but useful features for Compass. Features are:
|
||||||
- The context menu that only says "Copy" is now suppressed
|
- The context menu that only says "Copy" is now suppressed
|
||||||
- Workaround a [Link Hints bug](https://github.com/lydell/LinkHints/issues/86)
|
- Workaround a [Link Hints bug](https://github.com/lydell/LinkHints/issues/86)
|
||||||
that prevents it from seeing links inside lesson plans and such
|
that prevents it from seeing links inside lesson plans and such
|
||||||
|
- 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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue