Skip to content

Instantly share code, notes, and snippets.

@NO-ob
Last active March 28, 2024 11:59
Show Gist options
  • Save NO-ob/fb37faaef9b3f2153a8daefb6bc4d760 to your computer and use it in GitHub Desktop.
Save NO-ob/fb37faaef9b3f2153a8daefb6bc4d760 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name sanitizeNexus
// @icon https://www.nexusmods.com/favicon.ico
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Removes unwanted trash from nexus mods
// @author kannalo
// @match https://www.nexusmods.com/*
// @grant none
// @run-at document-end
// ==/UserScript==
var badCat = ["Characters"];
var badWords = ["reshade","shader","savegame","save game","savegames","save games","preset","presets","savefile","savefiles","save file","saved file","save files","starting save","starting saves","starter save","starter saves","fresh start","mode plus","save location"];
(function() {
let modList = document.getElementById("mod-list");
if (modList){
(new MutationObserver(checkCategories)).observe(document, {childList: true, subtree: true});
}
})();
function checkCategories(){
let tiles = document.querySelectorAll("ul.tiles > li.mod-tile");
if (tiles){
tiles.forEach( tile => {
badCat.forEach( bad => {
let categories = tile.querySelectorAll("div.category > a");
for(let i = 0; i < categories.length; i++){
if(categories[i].innerHTML.toLowerCase() === bad.toLowerCase()){
tile.remove();
console.log("killed");
break;
}
}
});
});
}
checkWords();
}
function checkWords(){
let tiles = document.querySelectorAll("ul.tiles > li.mod-tile");
if (tiles){
tiles.forEach( tile => {
badWords.forEach( bad => {
if (tile.querySelector("p.tile-name").innerHTML.toLowerCase().includes(bad.toLowerCase())){
tile.remove();
console.log("killed");
} else if (tile.querySelector("p.desc").innerHTML.toLowerCase().includes(bad.toLowerCase())){
tile.remove();
console.log("killed");
}
});
});
}
}
@SamShoking
Copy link

Hi. I tried to add some more "bad words", but its not working. Why?

@NO-ob
Copy link
Author

NO-ob commented Mar 27, 2024

Hi. I tried to add some more "bad words", but its not working. Why?

Hi the script might be broken i'll take a look

@NO-ob
Copy link
Author

NO-ob commented Mar 27, 2024

Hi. I tried to add some more "bad words", but its not working. Why?

Just updated the script try the new version

@SamShoking
Copy link

Thank you!

@NO-ob
Copy link
Author

NO-ob commented Mar 28, 2024

Thank you!

How did you find the script btw? I thought i posted on nexus forum but logged into my account and didn't see any posts there lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment