Last active
December 7, 2023 15:34
-
-
Save vijnv/5469d2c62464b83018c86a912138ac6e to your computer and use it in GitHub Desktop.
Brightspace assignment links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Brightspace assignment links | |
// @description Open links included in assignment submission comments in a new window/tab | |
// @match https://dlo.mijnhva.nl/d2l/lms/dropbox/admin/mark/folder_submissions_users* | |
// @match https://dlo.mijnhva.nl/d2l/le/activities/iterator/* | |
// @downloadURL https://gist.github.com/vijnv/5469d2c62464b83018c86a912138ac6e/raw/Brightspace%2520assignment%2520links.user.js | |
// @version 0.2 | |
// ==/UserScript== | |
document.addEventListener( | |
"click", | |
() => { | |
if (window.location.pathname.includes("folder_submissions_users")) { | |
// List of assignment submissions | |
document.querySelectorAll("div.d2l-htmlblock-assignments-comments d2l-html-block").forEach(el => { | |
el.shadowRoot.querySelectorAll("a").forEach(el => { | |
el.setAttribute("target", "_blank"); | |
}); | |
}); | |
} else { | |
// Individual assignment submission | |
document | |
.querySelector("d2l-consistent-evaluation") | |
.shadowRoot.querySelector("d2l-consistent-evaluation-page") | |
.shadowRoot.querySelector("d2l-consistent-evaluation-left-panel") | |
.shadowRoot.querySelector("d2l-consistent-evaluation-evidence-assignment") | |
.shadowRoot.querySelector("d2l-consistent-evaluation-assignments-submissions-page") | |
.shadowRoot.querySelectorAll("d2l-consistent-evaluation-assignments-submission-item") | |
.forEach(el => { | |
el.shadowRoot | |
.querySelector("d2l-html-block.d2l-submission-item-text") | |
.shadowRoot.querySelectorAll("a") | |
.forEach(el => el.setAttribute("target", "_blank")); | |
}); | |
} | |
}, | |
{ once: true } | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment