commit bf05fbc51427cc72be8016b5618486057a185f59 Author: blank X Date: Fri Jul 1 21:43:46 2022 +0700 Initial commit diff --git a/Anti-Thot.user.js b/Anti-Thot.user.js new file mode 100644 index 0000000..3021ba1 --- /dev/null +++ b/Anti-Thot.user.js @@ -0,0 +1,19 @@ +// ==UserScript== +// @name Anti-Thot +// @namespace blankie-scripts +// @match *://*/* +// @grant none +// @version 1.0 +// @author blankie +// @description fuck thots +// @inject-into page +// @run-at document-start +// ==/UserScript== + +var real_atob = window.atob; +unsafeWindow.atob = function(a) { + if (a === "eyJhZGJsb2NrIjp7fSwiZXhjbHVkZXMiOiIifQ==") { + throw new Error("fuck thots"); + } + return real_atob(a); +} \ No newline at end of file diff --git a/Auto Cloudflare Email Protection Decoder.user.js b/Auto Cloudflare Email Protection Decoder.user.js new file mode 100644 index 0000000..24f6caf --- /dev/null +++ b/Auto Cloudflare Email Protection Decoder.user.js @@ -0,0 +1,47 @@ +// ==UserScript== +// @name Auto Cloudflare Email Protection Decoder +// @namespace blankie-scripts +// @match *://*/* +// @grant none +// @version 1.2.1 +// @author blankie +// @description Automatically decodes Cloudflare Email Protected URLs +// @inject-into content +// @run-at document-end +// ==/UserScript== + +function decode_cf_email(cf_email) { + var decoded = '', right_xor_arg = parseInt(cf_email.substring(0, 2), 16); + for (var i = 2; i < cf_email.length; i += 2) { + decoded += String.fromCharCode(parseInt(cf_email.substring(i, i + 2), 16) ^ right_xor_arg); + } + return decodeURIComponent(escape(decoded)); +} + +function parse_document(document) { + var tags = document.querySelectorAll('a'); + for (var i = 0; i < tags.length; i++) { + var tag = tags[i], index_of = tag.href.indexOf('/cdn-cgi/l/email-protection#'); + if (index_of > -1) { + tag.href = 'mailto:' + decode_cf_email(tag.href.substring(index_of + 28)) + } + } + + var tags = document.querySelectorAll('.__cf_email__'); + for (var i = 0; i < tags.length; i++) { + var tag = tags[i], text_node = document.createTextNode(decode_cf_email(tag.getAttribute('data-cfemail'))); + tag.parentNode.replaceChild(text_node, tag); + } + + var tags = document.querySelectorAll('template'); + for (var i = 0; i < tags.length; i++) { + parse_document(tags[i].content); + } +} + +try { + parse_document(unsafeWindow.document); +} catch (e) { + unsafeWindow.console.error(e); + throw e; +} \ No newline at end of file diff --git a/Catbox Max Files Disabler.user.js b/Catbox Max Files Disabler.user.js new file mode 100644 index 0000000..2843ba5 --- /dev/null +++ b/Catbox Max Files Disabler.user.js @@ -0,0 +1,18 @@ +// ==UserScript== +// @name Catbox Max Files Disabler +// @namespace blankie-scripts +// @match https://catbox.moe/ +// @match https://litterbox.catbox.moe/ +// @grant none +// @version 1.0 +// @author blankie +// @description Disables Catbox's max files limit +// @inject-into document-end +// @run-as page +// ==/UserScript== + +setTimeout(function() { + for (var i=0; i < unsafeWindow.Dropzone.instances.length; i++ ) { + unsafeWindow.Dropzone.instances[i].options.maxFiles = null; + } +}, 5000); \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..db5ef43 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2022 blankie + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Quizizz Force Show Answer.user.js b/Quizizz Force Show Answer.user.js new file mode 100644 index 0000000..2f97904 --- /dev/null +++ b/Quizizz Force Show Answer.user.js @@ -0,0 +1,26 @@ +// ==UserScript== +// @name Quizizz Force Show Answer +// @namespace blankie-scripts +// @match https://quizizz.com/* +// @grant none +// @version 1.0 +// @author blankie +// @description Allow you to show answers on Quizizz even if you're not logged in +// @inject-into page +// @run-at document-end +// ==/UserScript== + +unsafeWindow.user = new Proxy(unsafeWindow.user, { + get: function(target, prop, receiver) { + if (prop === 'id') { + var e = new Error(); + var stack_items = e.stack.split('\n'); + for (var i = 0; i < stack_items.length; i++) { + if (stack_items[i].startsWith('click -> .show-answers-btn@')) { + return true; + } + } + } + return Reflect.get(...arguments); + } +}); \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e0e4928 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# User Scripts + +User scripts that I made to deal with some itches + +## Anti-Thot + +Hacky script to get rid of thot notifications + +## Auto Cloudflare Email Protection Decoder + +A reimplementation of Cloudflare's email protection code so that I don't have +to enable scripts to see emails again. Inspired by +[this article](https://web.archive.org/web/20210120041753/https://resynth1943.net/articles/cloudflares-email-protection-does-not-work/). + +## Catbox Max Files Disabler + +Hacky script to disable the client-side file limit per tab + +## Quizizz Force Show Answer + +![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 diff --git a/RESser.user.js b/RESser.user.js new file mode 100644 index 0000000..c4f580d --- /dev/null +++ b/RESser.user.js @@ -0,0 +1,43 @@ +// ==UserScript== +// @name RESser +// @namespace blankie-scripts +// @match https://old.reddit.com/* +// @grant GM_openInTab +// @version 1.4 +// @author blankie +// @inject-into page +// @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}) \ No newline at end of file diff --git a/accounts.jpg b/accounts.jpg new file mode 100644 index 0000000..c9c8ad5 Binary files /dev/null and b/accounts.jpg differ