Compare commits

..

No commits in common. "c13f837c62bdc6ca727f63e7c63594837cac019f" and "a0f8954ba485e2402d33372de34e83defff4b635" have entirely different histories.

4 changed files with 55 additions and 102 deletions

View File

@ -2,7 +2,7 @@
// @name Compass QoL Enhancer
// @namespace blankie-scripts
// @match http*://*.compass.education/*
// @version 1.24.0
// @version 1.23.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
@ -85,24 +85,6 @@ if (Window) {
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) {
productNavBar.style.zIndex = 20000;
@ -343,17 +325,6 @@ 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;
};
}
@ -578,7 +549,7 @@ function handleNewNode(node, observer) {
handleLearningTasksTable(node);
} else if (node.classList.contains("x-grid-view") && unsafeWindow.Ext.getCmp(node.id).up("#submissionsPanel")) {
handleLearningTaskSubmissionTable(node);
} else if (node.classList.contains("x-window") && node.querySelector(".x-window-header-text").textContent.startsWith("View Permissions for ")) {
} else if (node.classList.contains("x-window") && node.querySelector(".x-window-header-text").innerText.startsWith("View Permissions for ")) {
handlePermissionsWindow(node);
}
@ -691,23 +662,6 @@ for (let element of document.querySelectorAll("#productNavBar a[target='_blank']
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
if (unsafeWindow.CKEDITOR) {
// Suppress that annoying barebones context menu that only has Copy

View File

@ -1,46 +0,0 @@
// ==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;
}

View File

@ -62,9 +62,6 @@ A userscript that adds small but useful features for Compass. Features are:
- 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
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 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
@ -87,11 +84,6 @@ elements
Removes image loading placeholders from images loaded via Javascript, such as
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
A script to add [nightly.link](https://nightly.link) buttons on artifacts and
@ -101,6 +93,16 @@ 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)
## 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
A userscript that replaces the "close this toolbar" button with one that lets

43
RESser.user.js Normal file
View File

@ -0,0 +1,43 @@
// ==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})