Update Compass QoL Enhancer to 1.27.0
- Make files submitted to learning tasks also links
This commit is contained in:
parent
25e4f6e593
commit
32711ae01e
|
@ -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.26.0
|
// @version 1.27.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
|
||||||
|
@ -547,19 +547,28 @@ function handleLearningTasksTable(element) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make links submitted to a learning task actual links
|
// Make files and links submitted to a learning task actual links
|
||||||
function handleLearningTaskSubmissionTable(element) {
|
function handleLearningTaskSubmissionTable(element) {
|
||||||
|
let LearningTasksSubmissionFileType = unsafeWindow.Compass.enums.LearningTasksSubmissionFileType;
|
||||||
|
let taskId = unsafeWindow.Ext.getCmp(element.closest(".x-window").id).learningTask.data.id;
|
||||||
let items = unsafeWindow.Ext.getCmp(element.id).store.data.items;
|
let items = unsafeWindow.Ext.getCmp(element.id).store.data.items;
|
||||||
let lastColumns = element.querySelectorAll(".x-grid-cell-last img");
|
let lastColumns = element.querySelectorAll(".x-grid-cell-last img");
|
||||||
|
|
||||||
for (let i = 0; i < items.length; i++) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
let item = items[i].data;
|
let item = items[i].data;
|
||||||
let img = lastColumns[i];
|
let img = lastColumns[i];
|
||||||
if (item.submissionFileType !== unsafeWindow.Compass.enums.LearningTasksSubmissionFileType.SubmissionUrl) {
|
let url;
|
||||||
|
|
||||||
|
if (item.submissionFileType === LearningTasksSubmissionFileType.File) {
|
||||||
|
url = `/Services/FileDownload/FileRequestHandler?FileDownloadType=2&taskId=${taskId}&submissionId=${item.id}`;
|
||||||
|
} else if (item.submissionFileType === LearningTasksSubmissionFileType.SubmissionUrl) {
|
||||||
|
url = item.fileName;
|
||||||
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let a = document.createElement("a");
|
let a = document.createElement("a");
|
||||||
a.href = item.fileName;
|
a.href = url;
|
||||||
a.addEventListener("click", function(event) {
|
a.addEventListener("click", function(event) {
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
}, {passive: true});
|
}, {passive: true});
|
||||||
|
|
|
@ -43,8 +43,8 @@ A userscript that adds small but useful features for Compass. Features are:
|
||||||
- Fix submitting links by simply pressing Enter
|
- Fix submitting links by simply pressing Enter
|
||||||
- Links inside lesson plans now open in the parent tab by default instead of
|
- Links inside lesson plans now open in the parent tab by default instead of
|
||||||
creating a new tab
|
creating a new tab
|
||||||
- Links submitted to learning tasks are now actual links (they now work with
|
- Files and links submitted to learning tasks are now actual links (they now
|
||||||
[Link Hints] and they can be ctrl-clicked)
|
work with [Link Hints] and they can be ctrl-clicked)
|
||||||
- Ctrl-clicking an activity in a user's learning tasks tab no longer collapses
|
- Ctrl-clicking an activity in a user's learning tasks tab no longer collapses
|
||||||
everything else
|
everything else
|
||||||
- Learning tasks now being links (you can ctrl-click them)
|
- Learning tasks now being links (you can ctrl-click them)
|
||||||
|
|
Loading…
Reference in New Issue