userscripts/visual/4c-autohide.js

22 lines
667 B
JavaScript
Raw Normal View History

2022-10-25 19:39:14 +02:00
// ==UserScript==
2023-01-11 18:59:18 +01:00
// @name Keyword based thread hider
2022-10-25 19:39:14 +02:00
// @namespace Violentmonkey Scripts
// @match *://boards.4channel.org/*/catalog
// @match *://boards.4chan.org/*/catalog
2022-10-25 19:39:14 +02:00
// @version 1.0
// ==/UserScript==
2023-02-16 21:19:01 +01:00
window.addEventListener("load", () => {
2022-12-09 02:42:45 +01:00
const keywords = [] // e.g. ["/sdg/", "luke smith"]
const data = document.getElementsByClassName("teaser")
2022-10-25 19:39:14 +02:00
2022-12-09 02:42:45 +01:00
for (let i = 0; i < data.length; ++i) {
2023-02-16 21:19:01 +01:00
let innerText = data[i].innerText
2022-12-09 02:42:45 +01:00
for (let j = 0; j < keywords.length; ++j) {
2023-02-16 21:19:01 +01:00
if (innerText.includes(keywords[j]) && data[i].offsetParent !== null) {
2022-12-09 02:42:45 +01:00
data[i].offsetParent.style.display = "none"
}
2022-10-25 19:39:14 +02:00
}
2022-12-09 02:42:45 +01:00
}
2022-10-25 19:39:14 +02:00
})