generalize thread hider & improve URL matching

This commit is contained in:
17ms 2022-11-15 14:12:30 +02:00
parent feb3fb7bb4
commit 7c1f2d9d75
2 changed files with 6 additions and 7 deletions

View File

@ -1,8 +1,8 @@
// ==UserScript==
// @name Expand all images - 4chan.org
// @namespace Violentmonkey Scripts
// @match *://boards.4channel.org/*
// @match *://boards.4chan.org/*
// @match *://boards.4channel.org/*/thread/*
// @match *://boards.4chan.org/*/thread/*
// @version 1.0
// ==/UserScript==

View File

@ -1,5 +1,5 @@
// ==UserScript==
// @name Hide topics from catalog - 4chan.org
// @name Hide threads with certain keywords from catalog - 4chan.org
// @namespace Violentmonkey Scripts
// @match *://boards.4channel.org/*/catalog
// @match *://boards.4chan.org/*/catalog
@ -8,14 +8,13 @@
window.addEventListener("load", function () {
const topics = [] // e.g. ["sdg", "dmp"]
const keywords = [] // e.g. ["/sdg/", "luke smith"]
const data = document.getElementsByClassName("teaser")
for (let i = 0; i < data.length; ++i) {
let inner_txt = data[i].innerText
for (let j = 0; j < topics.length; ++j) {
let topic_str = "/" + topics[j] + "/"
if (inner_txt.includes(topic_str)) {
for (let j = 0; j < keywords.length; ++j) {
if (inner_txt.includes(keywords[j])) {
data[i].offsetParent.style.display = "none"
}
}