Created
September 7, 2026 02:38
-
-
Save Mrfiregem/05839b4386c52ee76fe15c2fa6a4f6da to your computer and use it in GitHub Desktop.
NovelUpdates Frontpage COO Filter Userscript
This file contains hidden or 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 NovelUpdates COO Filter | |
| // @namespace https://github.com/Mrfiregem | |
| // @match https://www.novelupdates.com/ | |
| // @version 1.1.0 | |
| // @author Firegem | |
| // @description Remove stories from the main page from specific countries. | |
| // @require https://openuserjs.org/src/libs/sizzle/GM_config.js | |
| // @grant GM_getValue | |
| // @grant GM_setValue | |
| // @grant GM.getValue | |
| // @grant GM.setValue | |
| // @grant GM_registerMenuCommand | |
| // ==/UserScript== | |
| function waitForConfig(config) { | |
| return new Promise((resolve) => { | |
| config.init({ | |
| id: "nu-coo-filter", | |
| title: "Script Settings", | |
| fields: { | |
| langFilter: { | |
| label: "Filtered languages", | |
| type: "text", | |
| title: "Space-separated 2-letter language codes.", | |
| default: "CN", | |
| }, | |
| whitelist: { | |
| label: | |
| "Instead of using the languages above as a blacklist, use it as a whitelist.", | |
| type: "checkbox", | |
| title: "Only show allowed languages.", | |
| default: false, | |
| }, | |
| hideOverFade: { | |
| label: "Hide filtered entries completely instead of fading them.", | |
| type: "checkbox", | |
| default: false, | |
| }, | |
| }, | |
| events: { | |
| save: () => window.location.reload(), | |
| init: () => resolve(config), | |
| }, | |
| }); | |
| }); | |
| } | |
| (async () => { | |
| "use strict"; | |
| const gmc = await waitForConfig(new GM_config()); | |
| const langFilter = gmc.get("langFilter").trim().split(/\s+/); | |
| const whitelistMode = gmc.get("whitelist"); | |
| console.log("langFilter:", langFilter); | |
| const hideOverFade = gmc.get("hideOverFade"); | |
| GM_registerMenuCommand("Settings", () => gmc.open()); | |
| const filteredEntries = Array.from(document.querySelectorAll("tr")).filter( | |
| (row) => { | |
| const langElem = row.querySelector(".orgdefault"); | |
| if (!langElem) return; | |
| const lang = langElem.textContent?.trim().substring(1, 3); | |
| console.log(`Got lang "${lang}"`); | |
| return whitelistMode !== langFilter.includes(lang); | |
| }, | |
| ); | |
| filteredEntries.forEach((row) => | |
| hideOverFade ? (row.style.display = "none") : (row.style.opacity = 0.4), | |
| ); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment