Update Compass QoL Enhancer to 1.29.0
- Fix opening links with ampersands submitted in Learning Tasks
This commit is contained in:
parent
cbebfa5995
commit
65a219c844
|
@ -2,7 +2,7 @@
|
|||
// @name Compass QoL Enhancer
|
||||
// @namespace blankie-scripts
|
||||
// @match http*://*.compass.education/*
|
||||
// @version 1.28.0
|
||||
// @version 1.29.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
|
||||
|
@ -129,16 +129,18 @@ function handleNewsItemClick(event) {
|
|||
this.expandTruncated();
|
||||
}
|
||||
}
|
||||
function handleNewsItem(newsItem) {
|
||||
if (!newsItem.priority) {
|
||||
return;
|
||||
}
|
||||
let img = document.createElement("img");
|
||||
img.src = `${newsItem.m_AssetPath}Pix/16x16/flag_orange.png`;
|
||||
img.classList.add("priority-flag");
|
||||
img.dataset.qtip = "This news item has been flagged as important";
|
||||
newsItem.newsItemDetails.el.dom.querySelector("div > span > div > span").append(img);
|
||||
}
|
||||
let NewsfeedItemWidget = getExtClass("Compass.widgets.NewsfeedItemWidget");
|
||||
if (NewsfeedItemWidget) {
|
||||
function addImportantFlag(newsItem) {
|
||||
let img = document.createElement("img");
|
||||
img.src = `${newsItem.m_AssetPath}Pix/16x16/flag_orange.png`;
|
||||
img.classList.add("priority-flag");
|
||||
img.dataset.qtip = "This news item has been flagged as important";
|
||||
newsItem.newsItemDetails.el.dom.querySelector("div > span > div > span").append(img);
|
||||
}
|
||||
|
||||
let originalRenderLayout = NewsfeedItemWidget.prototype.renderLayout;
|
||||
NewsfeedItemWidget.prototype.renderLayout = function() {
|
||||
originalRenderLayout.apply(this, arguments);
|
||||
|
@ -148,9 +150,7 @@ if (NewsfeedItemWidget) {
|
|||
// Expand news feed items by clicking on them
|
||||
this.el.on("click", handleNewsItemClick.bind(this), this.el);
|
||||
// Add important flag to priority news items
|
||||
if (this.priority) {
|
||||
addImportantFlag(this);
|
||||
}
|
||||
handleNewsItem(this);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -597,7 +597,10 @@ function handleLearningTaskSubmissionTable(element) {
|
|||
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;
|
||||
// Fix opening submitted links with ampersands
|
||||
let parser = new DOMParser();
|
||||
let document = parser.parseFromString(item.fileName, "text/html");
|
||||
url = document.documentElement.textContent;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
@ -827,7 +830,7 @@ if (unsafeWindow.CKEDITOR) {
|
|||
for (let attr of script.attributes) {
|
||||
scriptClone.setAttribute(attr.name, attr.value);
|
||||
}
|
||||
scriptClone.innerText = script.innerText;
|
||||
scriptClone.innerText = script.textContent;
|
||||
script.replaceWith(scriptClone);
|
||||
}
|
||||
this.$.dispatchEvent(new Event("DOMContentLoaded"));
|
||||
|
|
|
@ -41,6 +41,7 @@ A userscript that adds small but useful features for Compass. Features are:
|
|||
permission information)
|
||||
- File upload buttons now work with [Link Hints]
|
||||
- Fix submitting links by simply pressing Enter
|
||||
- Fix opening links with ampersands submitted in Learning Tasks
|
||||
- Links inside lesson plans now open in the parent tab by default instead of
|
||||
creating a new tab
|
||||
- Files and links submitted to learning tasks are now actual links (they now
|
||||
|
|
Loading…
Reference in New Issue