Compare commits
3 Commits
a0f8954ba4
...
c13f837c62
Author | SHA1 | Date |
---|---|---|
blankie | c13f837c62 | |
blankie | 2f94174353 | |
blankie | 148f9eb43d |
|
@ -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.23.0
|
// @version 1.24.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
|
||||||
|
@ -85,6 +85,24 @@ if (Window) {
|
||||||
this.on("close", handleWindowClose);
|
this.on("close", handleWindowClose);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
// example of message boxes: remove device on /Configure/LoginAndSecurity.aspx
|
||||||
|
// for some reason, listening on Ext.window.MessageBox does nothing
|
||||||
|
let Msg = unsafeWindow.Ext ? unsafeWindow.Ext.Msg : null;
|
||||||
|
if (Msg) {
|
||||||
|
let original = Msg.show;
|
||||||
|
Msg.show = function(options) {
|
||||||
|
let originalFn = options.fn;
|
||||||
|
|
||||||
|
options.fn = function() {
|
||||||
|
handleWindowClose();
|
||||||
|
if (originalFn) {
|
||||||
|
originalFn.apply(this, arguments);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
handleWindowShow();
|
||||||
|
original.apply(this, arguments);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (productNavBar) {
|
if (productNavBar) {
|
||||||
productNavBar.style.zIndex = 20000;
|
productNavBar.style.zIndex = 20000;
|
||||||
|
@ -325,6 +343,17 @@ if (WikiBrowserPanel) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let originalUpdateNodePermissions = WikiBrowserPanel.prototype.updateNodePermissions;
|
||||||
|
WikiBrowserPanel.prototype.updateNodePermissions = function() {
|
||||||
|
// prevent a network request from coming out to prevent arousing suspicion and to speed up things
|
||||||
|
let originalPostWithCallback = unsafeWindow.Compass.postWithCallback;
|
||||||
|
unsafeWindow.Compass.postWithCallback = function(url, data, callback) {
|
||||||
|
callback({d: false});
|
||||||
|
};
|
||||||
|
originalUpdateNodePermissions.apply(this, arguments);
|
||||||
|
unsafeWindow.Compass.postWithCallback = originalPostWithCallback;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -549,7 +578,7 @@ function handleNewNode(node, observer) {
|
||||||
handleLearningTasksTable(node);
|
handleLearningTasksTable(node);
|
||||||
} else if (node.classList.contains("x-grid-view") && unsafeWindow.Ext.getCmp(node.id).up("#submissionsPanel")) {
|
} else if (node.classList.contains("x-grid-view") && unsafeWindow.Ext.getCmp(node.id).up("#submissionsPanel")) {
|
||||||
handleLearningTaskSubmissionTable(node);
|
handleLearningTaskSubmissionTable(node);
|
||||||
} else if (node.classList.contains("x-window") && node.querySelector(".x-window-header-text").innerText.startsWith("View Permissions for ")) {
|
} else if (node.classList.contains("x-window") && node.querySelector(".x-window-header-text").textContent.startsWith("View Permissions for ")) {
|
||||||
handlePermissionsWindow(node);
|
handlePermissionsWindow(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -662,6 +691,23 @@ for (let element of document.querySelectorAll("#productNavBar a[target='_blank']
|
||||||
element.removeAttribute("target");
|
element.removeAttribute("target");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prevent clicking "Loading Class Items..." from reloading the current page
|
||||||
|
let loadingClassItems = document.querySelector(".toolbar-classes-loading");
|
||||||
|
if (loadingClassItems) {
|
||||||
|
loadingClassItems.addEventListener("click", function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Preload subjects and classes when the page loads
|
||||||
|
let teachingAndLearning = document.querySelector(".toolbar-clickable-teaching-and-learning");
|
||||||
|
if (teachingAndLearning) {
|
||||||
|
new MutationObserver(function(mutations, observer) {
|
||||||
|
observer.disconnect();
|
||||||
|
teachingAndLearning.dispatchEvent(new MouseEvent("mouseover"));
|
||||||
|
}).observe(teachingAndLearning, {attributes: true});
|
||||||
|
}
|
||||||
|
|
||||||
// unsafeWindow.CKEDITOR may not be set if you're on the login page, for example
|
// unsafeWindow.CKEDITOR may not be set if you're on the login page, for example
|
||||||
if (unsafeWindow.CKEDITOR) {
|
if (unsafeWindow.CKEDITOR) {
|
||||||
// Suppress that annoying barebones context menu that only has Copy
|
// Suppress that annoying barebones context menu that only has Copy
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
// ==UserScript==
|
||||||
|
// @name MediaWiki Redirects Fixer
|
||||||
|
// @namespace blankie-scripts
|
||||||
|
// @match https://*.wikipedia.org/*
|
||||||
|
// @grant none
|
||||||
|
// @version 1.0.0
|
||||||
|
// @author blankie
|
||||||
|
// @description Fixes redirects of pages with anchors on Wikipedia/MediaWiki instances when Javascript is disabled
|
||||||
|
// @inject-into content
|
||||||
|
// @run-at document-end
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function scrollToHash(scrollTo) {
|
||||||
|
if (!scrollTo) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let element = document.querySelector(scrollTo);
|
||||||
|
if (element) {
|
||||||
|
element.scrollIntoView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let script of document.querySelectorAll("script")) {
|
||||||
|
let match = /;RLCONF=({"[\s\S]+?});RLSTATE={"/.exec(script.textContent);
|
||||||
|
if (!match) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let rlconf = JSON.parse(match[1]);
|
||||||
|
if (rlconf.wgInternalRedirectTargetUrl) {
|
||||||
|
let url = new URL(rlconf.wgInternalRedirectTargetUrl, location);
|
||||||
|
let scrollTo = url.hash;
|
||||||
|
if (location.hash) {
|
||||||
|
url.hash = location.hash;
|
||||||
|
scrollTo = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
history.replaceState(null, "", url);
|
||||||
|
scrollToHash(scrollTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
18
README.md
18
README.md
|
@ -62,6 +62,9 @@ A userscript that adds small but useful features for Compass. Features are:
|
||||||
- Reopening panel tabs and learning tasks when the URL changes
|
- Reopening panel tabs and learning tasks when the URL changes
|
||||||
- The main navigation bar is no longer hidden behind masks that don't span the
|
- The main navigation bar is no longer hidden behind masks that don't span the
|
||||||
entire viewport
|
entire viewport
|
||||||
|
- Clicking on "Loading Class Items..." does nothing now instead of reloading
|
||||||
|
the current page
|
||||||
|
- Preload subjects and classes when the page loads
|
||||||
- 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
|
||||||
- Pages can no longer be scrolled if a window is currently open
|
- Pages can no longer be scrolled if a window is currently open
|
||||||
|
@ -84,6 +87,11 @@ elements
|
||||||
Removes image loading placeholders from images loaded via Javascript, such as
|
Removes image loading placeholders from images loaded via Javascript, such as
|
||||||
https://closeronline.co.uk, https://wired.com, and https://knowyourmeme.com.
|
https://closeronline.co.uk, https://wired.com, and https://knowyourmeme.com.
|
||||||
|
|
||||||
|
## MediaWiki Redirects Fixer
|
||||||
|
|
||||||
|
Fixes redirects of pages with anchors on Wikipedia/MediaWiki instances when
|
||||||
|
Javascript is disabled
|
||||||
|
|
||||||
## nightly.link buttons
|
## nightly.link buttons
|
||||||
|
|
||||||
A script to add [nightly.link](https://nightly.link) buttons on artifacts and
|
A script to add [nightly.link](https://nightly.link) buttons on artifacts and
|
||||||
|
@ -93,16 +101,6 @@ build logs to view them without logging in
|
||||||
|
|
||||||
![A man yelling "I DON'T WANNA", followed by sign up/login boxes](https://gitlab.com/blankX/userscripts/-/raw/master/accounts.jpg)
|
![A man yelling "I DON'T WANNA", followed by sign up/login boxes](https://gitlab.com/blankX/userscripts/-/raw/master/accounts.jpg)
|
||||||
|
|
||||||
## RESser
|
|
||||||
|
|
||||||
A script to add more keyboard shortcuts to old reddit that I feel too hacky to
|
|
||||||
add into RES (requires RES).
|
|
||||||
Keyboard shortcuts:
|
|
||||||
- `v`/`n`: Reveal all text spoilers
|
|
||||||
- `Enter`/`Shift+Enter` on a crosspoted item: Open a crossposted item instead
|
|
||||||
of its link (sometimes also opens its link, no idea how to fix)
|
|
||||||
- `Shift+Enter` on Continue this thread: Opens a thread in a new tab
|
|
||||||
|
|
||||||
## Wayback Machine Toolbar Toggler
|
## Wayback Machine Toolbar Toggler
|
||||||
|
|
||||||
A userscript that replaces the "close this toolbar" button with one that lets
|
A userscript that replaces the "close this toolbar" button with one that lets
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
// ==UserScript==
|
|
||||||
// @name RESser
|
|
||||||
// @namespace blankie-scripts
|
|
||||||
// @match https://old.reddit.com/*
|
|
||||||
// @grant GM_openInTab
|
|
||||||
// @version 1.4.1
|
|
||||||
// @author blankie
|
|
||||||
// @inject-into content
|
|
||||||
// @run-at document-start
|
|
||||||
// ==/UserScript==
|
|
||||||
|
|
||||||
document.addEventListener('keydown', function(e) {
|
|
||||||
switch (e.keyCode) {
|
|
||||||
case 86: // v
|
|
||||||
case 78: // n
|
|
||||||
// v/n to expose text spoilers
|
|
||||||
document.querySelectorAll('.RES-keyNav-activeElement .md-spoiler-text:not(.revealed)').forEach((e) => {
|
|
||||||
e.classList.add('revealed');
|
|
||||||
e.click();
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 13: // return/enter
|
|
||||||
// [shift-]enter on crossposted item to go to crossposted item instead of link
|
|
||||||
const crosspostA = document.querySelector('.RES-keyNav-activeElement .crosspost-preview a');
|
|
||||||
if (crosspostA !== null) {
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
if (e.shiftKey) {
|
|
||||||
// TODO fix duplicate link from res lmao
|
|
||||||
GM_openInTab(crosspostA.href, {active: true});
|
|
||||||
} else {
|
|
||||||
location.href = crosspostA.href;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// shift-enter on 'Continue this thread'
|
|
||||||
if (e.shiftKey) {
|
|
||||||
const continueThing = document.querySelector('.RES-keyNav-activeElement > span.deepthread > a');
|
|
||||||
if (continueThing !== null) {
|
|
||||||
GM_openInTab(continueThing.href, {active: true});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}, {capture: true, useCapture: true})
|
|
Loading…
Reference in New Issue