Skip to content

Instantly share code, notes, and snippets.

@motbob
Last active August 18, 2021 23:45
Show Gist options
  • Save motbob/92af48bcf554427213ded5aa07a302c1 to your computer and use it in GitHub Desktop.
Save motbob/92af48bcf554427213ded5aa07a302c1 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name nyaablock
// @namespace motbob
// @include https://nyaa.si/*
// @exclude https://nyaa.si/user/*
// @exclude https://nyaa.si/view/*
// @exclude https://nyaa.si/?f=0&c=0_0&q=-filteri*
// @version 1
// @grant none
// ==/UserScript==
// INSTRUCTIONS: Comment/uncomment the relevant lines depending on what categories you want to block. Then, modify the list in the line starting with "var searchText" to block certain tags. For example, if you wanted to block all MTBB releases, you could add "[MTBB]"
// var animeMusicVideo = Array.prototype.slice.call(document.querySelectorAll("[href='/?c=1_1']"));
// var englishTranslatedAnime = Array.prototype.slice.call(document.querySelectorAll("[href='/?c=1_2']"));
var foreignTranslatedAnime = Array.prototype.slice.call(document.querySelectorAll("[href='/?c=1_3']"));
// var rawAnime = Array.prototype.slice.call(document.querySelectorAll("[href='/?c=1_4']"));
// var losslessAudio = Array.prototype.slice.call(document.querySelectorAll("[href='/?c=2_1']"));
// var lossyAudio = Array.prototype.slice.call(document.querySelectorAll("[href='/?c=2_2']"));
// var englishTranslatedLiterature = Array.prototype.slice.call(document.querySelectorAll("[href='/?c=3_1']"));
var foreignTranslatedLiterature = Array.prototype.slice.call(document.querySelectorAll("[href='/?c=3_2']"));
var rawLiterature = Array.prototype.slice.call(document.querySelectorAll("[href='/?c=3_3']"));
var liveactionEnglishTranslated = Array.prototype.slice.call(document.querySelectorAll("[href='/?c=4_1']"));
var liveactionIdolPV = Array.prototype.slice.call(document.querySelectorAll("[href='/?c=4_2']"));
var liveactionForeignTranslated = Array.prototype.slice.call(document.querySelectorAll("[href='/?c=4_3']"));
var liveactionRaw = Array.prototype.slice.call(document.querySelectorAll("[href='/?c=4_4']"));
var picturesGraphics = Array.prototype.slice.call(document.querySelectorAll("[href='/?c=5_1']"));
var picturesPhotos = Array.prototype.slice.call(document.querySelectorAll("[href='/?c=5_2']"));
var softwareApplications = Array.prototype.slice.call(document.querySelectorAll("[href='/?c=6_1']"));
var softwareGames = Array.prototype.slice.call(document.querySelectorAll("[href='/?c=6_2']"));
var nuke = [];
// nuke.push.apply(nuke, animeMusicVideo);
// nuke.push.apply(nuke, englishTranslatedAnime);
nuke.push.apply(nuke, foreignTranslatedAnime);
// nuke.push.apply(nuke, rawAnime);
// nuke.push.apply(nuke, losslessAudio);
// nuke.push.apply(nuke, lossyAudio);
// nuke.push.apply(nuke, englishTranslatedLiterature);
nuke.push.apply(nuke, foreignTranslatedLiterature);
nuke.push.apply(nuke, rawLiterature);
nuke.push.apply(nuke, liveactionEnglishTranslated);
nuke.push.apply(nuke, liveactionIdolPV);
nuke.push.apply(nuke, liveactionForeignTranslated);
nuke.push.apply(nuke, liveactionRaw);
nuke.push.apply(nuke, picturesGraphics);
nuke.push.apply(nuke, picturesPhotos);
nuke.push.apply(nuke, softwareApplications);
nuke.push.apply(nuke, softwareGames);
var i;
var j;
for (i = 0; i < nuke.length; i++) {
nuke[i].parentElement.parentElement.id = "nukethis";
var elmDeleted = document.getElementById("nukethis");
elmDeleted.parentNode.removeChild(elmDeleted);
}
var aTags = Array.prototype.slice.call(document.getElementsByTagName("a"));
var searchText = ["[Golumpa]", "[FreakCrSuBuS]", "[Erai-raws]", "[Anime Land]", "[Leopard-Raws]", "HEVC2 AAC", "[AAC-tan]", "[SSA]", "[FFA]", "[ASW]", "[Anime Time]", "[Pantsu]", "NVENC", "[EMBER]"];
for (i = 0; i < aTags.length; i++) {
if (aTags.title == "") {continue;}
for (j = 0; j < searchText.length; j++) {
if (aTags[i].title.indexOf(searchText[j]) != -1) {
aTags[i].parentElement.parentElement.id = "nukethistoo";
var deleted = document.getElementById("nukethistoo");
deleted.parentNode.removeChild(deleted);
}
}
if ((aTags[i].title.indexOf("HorribleSubs") != -1) && (aTags[i].title.indexOf("480p") != -1)) {
aTags[i].parentElement.parentElement.id = "nukethistoo";
var deleted = document.getElementById("nukethistoo");
deleted.parentNode.removeChild(deleted);
}
}
@ArjixWasTaken
Copy link

this

for (i = 0; i < nuke.length; i++) {
    nuke[i].parentElement.parentElement.id = "nukethis";
    var elmDeleted = document.getElementById("nukethis");
    elmDeleted.parentNode.removeChild(elmDeleted);
} 

could be changed to

for (i = 0; i < nuke.length; i++) {
    nuke[i].parentElement.remove()
} 

iirc

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