// ==UserScript==
// @name Hide Short Threads on 2ch.su/b/
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Скрывает треды, у которых стартовое сообщение короче 50 символов
// @match https://2ch.su/b/*
// @grant none
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
function hideShortThreads(root) {
// Каждая "тред"-обёртка имеет класс "thread"
const threads = (root || document).querySelectorAll('.thread');
threads.forEach(thread => {
// Находим OP‑пост внутри треда
const op = thread.querySelector('.post_type_oppost .post__message');
if (!op) return;
// Берём только текст (без HTML‑тегов)
const text = op.innerText.trim();
if (text.length < 50) {
thread.style.display = 'none';
}
});
}
// Скрываем текущие треды
hideShortThreads(document);
// Следим за динамическим подгружением новых тредов
const observer = new MutationObserver(mutations => {
mutations.forEach(m => {
m.addedNodes.forEach(node => {
if (node.nodeType === 1 && node.classList.contains('thread')) {
hideShortThreads(node.parentNode);
}
});
});
});
const container = document.getElementById('posts-form') || document.body;
observer.observe(container, { childList: true, subtree: true });
})();