Compare commits
No commits in common. "03debb468afb892ac79d4e3ee8644c5a4265d485" and "ea2571b7566eb6ff84124a2dc1c58e5ef812ace1" have entirely different histories.
03debb468a
...
ea2571b756
|
@ -2,7 +2,7 @@
|
|||
// @name Compass QoL Enhancer
|
||||
// @namespace blankie-scripts
|
||||
// @match http*://*.compass.education/*
|
||||
// @version 1.4.0
|
||||
// @version 1.3.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
|
||||
|
@ -84,8 +84,8 @@ function handleNewNode(node) {
|
|||
if (node.localName === "td") {
|
||||
node.setAttribute("role", "button");
|
||||
}
|
||||
for (let element of node.querySelectorAll("td, .x-tree-expander")) {
|
||||
element.setAttribute("role", "button");
|
||||
for (let expander of node.querySelectorAll("td, .x-tree-expander")) {
|
||||
expander.setAttribute("role", "button");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -119,13 +119,9 @@ function handleNewCalendarEvent(element) {
|
|||
let calendarElement = element.closest(".x-component.ext-cal-ct, .x-component.ext-cal-body-ct");
|
||||
let calendar = unsafeWindow.Ext.getCmp(calendarElement.id);
|
||||
if (a.classList.contains("activity-type-1")) {
|
||||
// Add a link and show the finish time for activities/"standard classes"
|
||||
// Add a link for activities/"standard classes"
|
||||
let data = calendar.getEventRecordFromEl(element).data;
|
||||
let startString = unsafeWindow.Ext.util.Format.date(data.start, unsafeWindow.Compass.TIME_NO_PERIOD_FORMAT);
|
||||
let finishString = unsafeWindow.Ext.util.Format.date(data.finish, unsafeWindow.Compass.TIME_NO_PERIOD_FORMAT);
|
||||
a.href = `/Organise/Activities/Activity.aspx?targetUserId=${data.targetStudentId}#session/${data.instanceId}`;
|
||||
// yes, innerHTML. longTitleWithoutTime can apparently contain HTML. lets hope that startString and finishString don't
|
||||
a.querySelector("span").innerHTML = `${startString} - ${finishString}: ${data.longTitleWithoutTime}`;
|
||||
preventCompassHandler = true;
|
||||
} else if (a.classList.contains("activity-type-10")) {
|
||||
// Add a link for learning tasks
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
// @grant GM_getResourceURL
|
||||
// @require https://cdn.jsdelivr.net/npm/dialog-polyfill@0.5.6/dist/dialog-polyfill.min.js#sha256-cec1a2e320aab77e28bad4ad6bc5e532a6ef5757345c19bb5158aa880b7162a6
|
||||
// @resource dialogPolyfillCSS https://cdn.jsdelivr.net/npm/dialog-polyfill@0.5.6/dist/dialog-polyfill.min.css#sha256-4dcb3ab62e545f30bf06a4824c253641ee889ca85ca28d5447590557922496ab
|
||||
// @version 1.0.12
|
||||
// @version 1.0.11
|
||||
// @author blankie
|
||||
// @description A userscript that adds a "Show elements popup" option to the Monkey Menu which lists all elements with an ID
|
||||
// @inject-into content
|
||||
|
@ -19,9 +19,7 @@ const ACCENT_COLOR = "#962AC3";
|
|||
const BRIGHT_ACCENT_COLOR = "#DE6DE6";
|
||||
|
||||
const DIALOG_WRAPPER_CSS = `
|
||||
/* https://lamplightdev.com/blog/2019/03/26/why-is-my-web-component-inheriting-styles/ */
|
||||
all: initial;
|
||||
|
||||
all: unset;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
|
@ -34,6 +32,7 @@ dialog {
|
|||
max-height: 90%;
|
||||
max-width: 90%;
|
||||
font-size: 11pt;
|
||||
text-align: left;
|
||||
font-family: sans-serif;
|
||||
color-scheme: dark;
|
||||
overflow-y: auto;
|
||||
|
@ -144,7 +143,7 @@ function hideElementList() {
|
|||
function getElementList() {
|
||||
let elements = [];
|
||||
|
||||
for (let element of document.body.querySelectorAll("[id], a[name]")) {
|
||||
for (let element of document.body.querySelectorAll("[id]")) {
|
||||
if (shouldIgnoreElement(element)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -156,12 +155,9 @@ function getElementList() {
|
|||
|
||||
function shouldIgnoreElement(element) {
|
||||
// Check if the element is not visible
|
||||
// https://wayland.freedesktop.org/docs/html/apb.html has <a name=...> elements with no size
|
||||
if (element.localName !== "a") {
|
||||
let rect = element.getBoundingClientRect();
|
||||
if (rect.height === 0 || rect.width === 0) {
|
||||
return true;
|
||||
}
|
||||
let rect = element.getBoundingClientRect();
|
||||
if (rect.height === 0 || rect.width === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if the element is a svg or a part of one
|
||||
|
@ -178,15 +174,11 @@ function shouldIgnoreElement(element) {
|
|||
|
||||
function getElementListItem(element) {
|
||||
let newLocation = new URL(location.href);
|
||||
let id = element.id;
|
||||
if (!id && element.localName === "a") {
|
||||
id = element.name;
|
||||
}
|
||||
|
||||
let li = document.createElement("li");
|
||||
|
||||
let a = document.createElement("a");
|
||||
newLocation.hash = a.innerText = "#" + id;
|
||||
newLocation.hash = a.innerText = "#" + element.id;
|
||||
a.href = newLocation.href;
|
||||
a.addEventListener("click", function(e) {
|
||||
if (e.ctrlKey) {
|
||||
|
@ -206,12 +198,7 @@ function getElementListItem(element) {
|
|||
|
||||
function getElementDescription(element) {
|
||||
let addEilipses = false;
|
||||
// Attempt to get text by going up the DOM, as https://wayland.freedesktop.org/docs/html/apb.html has elements with no content
|
||||
let text = "";
|
||||
while (!text && element) {
|
||||
text = (element.innerText || "").trim();
|
||||
element = element.parentElement;
|
||||
}
|
||||
let text = (element.innerText || "").trim();
|
||||
|
||||
let newlineIndex = text.indexOf("\n");
|
||||
if (newlineIndex !== -1) {
|
||||
|
|
|
@ -22,7 +22,6 @@ A userscript that adds small but useful features for Compass. Features include:
|
|||
- The ability to close windows by clicking on the background
|
||||
- Calendar events are now links (they work with [Link Hints] now! you can also
|
||||
ctrl+click on "standard classes" and learning tasks)
|
||||
- Calendar events now show their end time without having to being hovered
|
||||
- Tabs are now links (you can refresh pages and the tab will automatically
|
||||
open. you can also ctrl+click on them)
|
||||
- Files and folders in Resources is now marked clickable ([Link Hints] can now
|
||||
|
|
Loading…
Reference in New Issue