diff --git a/userscripts/thalia-filter.user.js b/userscripts/thalia-filter.user.js new file mode 100644 index 0000000..644227b --- /dev/null +++ b/userscripts/thalia-filter.user.js @@ -0,0 +1,299 @@ +// ==UserScript== +// @name Thalia Filter +// @namespace https://sebastian-tobie.de/ +// @version 0.1 +// @match https://www.thalia.de/kategorie/* +// @match https://www.thalia.de/kategorie/*/ +// @match https://www.thalia.de/kategorie/*?* +// @match https://www.thalia.de/ebook/kategorien/*/neuheiten +// @icon https://www.google.com/s2/favicons?sz=64&domain=thalia.de +// @run-at document-end +// @grant GM_registerMenuCommand +// ==/UserScript== + +var prefixes = [ + "#drcl", + "10 erste male", + "A Couple of Cuckoos", + "Aristia", + "Asterix", + "Café Liebe", + "Charon", + "Cheering up in the underworld", + "Colette beschließt zu sterben", + "D.N. Angel", + "Definitely Love", + "Der Sommer", + "Die mit dem Teufel tanzt", + "Ein Zeichen der Zuneigung", + "Elainas Reise", + "Galerie einer neuen Galaxis", + "Gespielte Liebe", + "Go! Go! Loser Ranger", + "Hallo, ich bin eine Hexe und mein Schwarm wünscht sich einen Liebestrank von mir", + "Himmelblaue Zeiten", + "How to train a newbie", + "Ich habe 300 Jahre lang", + "Ich täuschte Amnesie vor, um meinen Verlobten loszuwerden", + "Kleiner Tai & Omi Sue", + "Kreative Kurzaufgaben", + "Lone Wolf & Cub Master", + "Manga! Manga!", + "Merit und der ägyptische", + "Murciélago", + "Peter Grill", + "Real Account", + "Red Apple", + "Ripper", + "Solo Leveling Roman Taschenbuchausgabe", + "Star Wars", + "Tokyo Aliens", + "Touring after the apocalypse", + "Wiedergeburt in Maydare", + "Yuzu", + "ab sofort schwester!", + "adou", + "after school", + "alice in borderland", + "alice und die halbbluthexe", + "all you want, whenever you want", + "and then i know love", + "and then i love you", + "angels of death", + "anyway, i love you", + "arifureta - der kampf zurück in meine welt", + "assassin's creed", + "auf und ab", + "bakemonogatari", + "barakamon", + "beast after school", + "birds of shangri-la", + "bitter playmate", + "black butler", + "bloody bites at boarding school", + "blue eye lie", + "boruto", + "canis", + "crossing borders", + "dahlia lässt den kopf nicht hängen", + "das band der unterwelt", + "das kind, das ich in meinen träumen sah", + "das magische baumhaus", + "das opfer des", + "dead mount death play", + "deadlock", + "der dieb und das biest", + "der fuchs und der kleine tanuki", + "der geschmack nach melone", + "der stärkste held mit dem mal der schwäche", + "die for me, my darling", + "die hexe und das biest", + "die hexe und ihr drache", + "die hohe", + "die nacht hinter dem dreiecksfenster", + "die rachsüchtige", + "die schokohexe ", + "die walkinder", + "don't lie to me", + "dr. stone", + "drachenregen", + "edens zero", + "ein bund fürs leben", + "ein landei aus dem dorf vor dem letzten dungeon sucht das abenteuer in der stadt", + "elden ring kapitel", + "elden ring", + "eliana", + "enceladus - die graphic novel", + "fairy tale", + "fangirl", + "final fantasy", + "fire force", + "flüster mir ein liebeslied", + "folge den wolken nach nord-nordwest", + "from bottom to lover", + "gachiakuta", + "gannibal", + "gestatten, ich bin's", + "goblin slayer!", + "harahara sensei", + "hiraeth", + "human extinction", + "hunter x hunter", + "i hear the sunspot", + "i'll be here for you", + "im schatten der fabriken", + "in/spectre", + "insomniacs", + "interviews mit Monster-mädchen", + "is love the answer?", + "isekai office worker", + "jagaaan", + "jealousy blinds love", + "just mary", + "kabukicho bad trip", + "kijin gentosho", + "konosuba", + "küsse", + "lass meine hand nicht los", + "lieb mich noch, bevor du stirbst", + "liebe ist (k)ein wettkampf", + "lightning and romance", + "lonely castle in the mirror", + "love escape", + "lullaby of the dawn", + "madk", + "manga love story", + "meet me online", + "megumi & tsugumi", + "mein isekai-leben", + "mein nachbar", + "mein untergang", + "meine arbeit als missionar in einer gottlosen welt", + "meine wiedergeburt als schleim in einer anderen welt", + "midnight scandal sex", + "minato's coin laundry", + "mord im dekagon", + "moriarty the patriot", + "mpd psycho", + "mr nobody", + "mushoku tensei", + "my dear curse-casting vampiress", + "my genderless boyfriend", + "my hero academia", + "my love will last till the end of time", + "my senpai is annoying", + "my younger senpai", + "nana & kaoru: das letzte jahr", + "never love an egoist", + "nina - die sterne sind dein schicksal", + "one piece", + "one room dog", + "overlord", + "penelope", + "planetes perfect edition", + "planetes perfect", + "pluto: urasawa x tezuka", + "prince never give up", + "prinz freya", + "radiant", + "raeliana", + "re:zero", + "relife", + "religiöse helden", + "rental girlfriend", + "requiem of the rose king", + "rosen blood", + "saint seiya", + "saraba, yoki hi", + "saturn return", + "schattenprinzessin des drachenkönigs", + "servamp, band", + "seven deadly sins", + "severed", + "shaman king", + "shojo nach der schule", + "silent witch", + "skip & loafer", + "skip beat", + "sleeping dead", + "smoking behind the supermarket", + "stigmata", + "sugar apple fairy tale", + "suzume", + "sword art online", + "takopi und die sache mit dem glück", + "teach me how to kill you", + "the beast must die", + "the beginning after the end", + "the dungeon of black company", + "the elusive samurai", + "the gender of mona lisa", + "the guy she was interested in wasn't a guy at all", + "the heroic legend of arslan", + "the ichinose family's deadly sins", + "the male bride", + "the man who shattered my world", + "the most distant love", + "the reprise", + "the saint's magic power is omnipotent", + "threesome", + "to the abandoned sacred beasts", + "tokyo revengers", + "tokyopop", + "too close to love", + "touching your night", + "twin star", + "undead unluck", + "under ninja", + "unlimited lust", + "vampire knight", + "veil", + "verbotene allianz", + "verliebt in mehr als dein gesicht", + "victoria's electric coffin", + "vinland saga", + "virgin road", + "white light ceremony", + "wind breaker", + "wise man", + "wistoria", + "wolverine", + "yakuza angel", + "yona", + "you're my cutie!", + "your sweet scent", + "yuzu - die kleine tierärztin", + "zombie hide sex", +]; + +for (let i in prefixes) { + prefixes[i] = prefixes[i].toLowerCase(); +} +function titel(/** @type {Element} */book) { + return book.getElementsByClassName("element-text-standard-black tm-artikeldetails__titel")[0].innerHTML.toLowerCase() +} + +function blacklisted(/** @type {Element} */book) { + let titl = titel(book); + for (let i in prefixes) { + if (titl.startsWith(prefixes[i])) { + return true + }; + } + return false +} + +function clean() { + let books = document.getElementsByClassName("tm-produktliste__eintrag artikel"); + /** @type {string[]} */ + let not_found = []; + let removed = 0 + for (let i = 0; i < books.length; i++) { + let book = books.item(i); + if (book === null) { continue}; + if (book.style.display == "none") { + continue + } + if (blacklisted(book)) { + book.style.display = "none"; + removed += 1; + } else { not_found.push(titel(book)) } + }; + let artikel = document.getElementsByClassName("sichtbare-artikel"); + if (artikel.length != 0) { + artikel[0].innerHTML = not_found.length; + } + console.debug(artikel) + console.debug("titel nicht in der blacklist:", not_found); +} + +(async function () { + 'use strict'; + GM_registerMenuCommand("Clean results", function (event) { console.debug(event); event.preventDefault(); clean() }, "c"); + let button = document.getElementsByTagName("suche-button-mehr-laden"); + if (button.length != 0) { + for (let i = 0; i < 10; i++) { await button[0].load(); } + } + clean(); + console.debug(prefixes); +})(); \ No newline at end of file