Войти в систему
Home - Создать дневник - Написать в дневник - Подробный режим
LJ.Rossia.org - Новости сайта - Общие настройки - Sitemap - Оплата - ljr-fif
Редактировать... - Настройки - Список друзей - Дневник - Картинки - Пароль - Вид дневника
Сообщества
Настроить S2
Помощь - Забыли пароль? - FAQ - Тех. поддержка
(Добавить комментарий)
(Ответить) (Ветвь дискуссии)
(Ответить) (Уровень выше) (Ветвь дискуссии)
(Ответить) (Уровень выше)
(Ответить)
// ==UserScript== // @name lj.rossia.org antispam // @namespace http://tampermonkey.net/ // @version 2024-08-20 // @description Скрывает комменты неугодных пользователей. // @match https://lj.rossia.org/* // ==/UserScript== function addToSpamList(who) { const s = localStorage.getItem("spammers"); if (s !== null) { localStorage.setItem("spammers", `${s},${who}`); } else { localStorage.setItem("spammers", who); } hideSpam(); } function addBlockButtons() { const comments = document.querySelectorAll("div#Comments > form > table"); for (let i = 0; i < comments.length; i++) { const comment = comments[i]; const ljuser = comment.querySelector(".ljuser"); if (ljuser) { const author = ljuser.children[0].href.match(/(?<=\=)\w+/)[0]; const a = document.createElement("span"); a.innerHTML = "[Скрыть]"; a.addEventListener("click", () => addToSpamList(author)); ljuser.appendChild(a); } else { const a = document.createElement("span"); a.innerHTML = "[Скрыть]"; a.addEventListener("click", () => addToSpamList("(Анонимно)")); comment.querySelector("i").appendChild(a); } } } function hideSpam() { const spammers = localStorage.getItem("spammers").split(","); let cur_depth = 0, prev_depth = 0; let parent_authors = []; let tainted = false; const comments = document.querySelectorAll("div#Comments > form > table"); for (let i = 0; i < comments.length; i++) { const comment = comments[i]; cur_depth = comment.children[0].children[0].children[0].children[0].width; const ljuser = comment.querySelector(".ljuser"); if (ljuser) { comment._author = ljuser.children[0].href.match(/(?<=\=)\w+/)[0]; } else { comment._author = "(Анонимно)"; } if (cur_depth > prev_depth) { parent_authors.push(comments[i - 1]._author); } else { let i = cur_depth; while (i < prev_depth) { parent_authors.pop(); i += 25; } } for (let i = 0; i < spammers.length; i++) { if (comment._author === spammers[i] || parent_authors.some(x => x === spammers[i])) { tainted = true; break; } else { tainted = false; } } if (tainted) { comment.remove(); } prev_depth = cur_depth; } } addBlockButtons(); hideSpam();
javascript:(function() { function addToSpamList(who) { const s = localStorage.getItem("spammers"); if (s !== null) { localStorage.setItem("spammers", `${s},${who}`); } else { localStorage.setItem("spammers", who); } hideSpam(); } function addBlockButtons() { const comments = document.querySelectorAll("div#Comments > form > table"); for (let i = 0; i < comments.length; i++) { const comment = comments[i]; const ljuser = comment.querySelector(".ljuser"); if (ljuser) { const author = ljuser.children[0].href.match(/(?<=\=)\w+/)[0]; const a = document.createElement("span"); a.innerHTML = "[Скрыть]"; a.addEventListener("click", () => addToSpamList(author)); ljuser.appendChild(a); } else { const a = document.createElement("span"); a.innerHTML = "[Скрыть]"; a.addEventListener("click", () => addToSpamList("(Анонимно)")); comment.querySelector("i").appendChild(a); } } } function hideSpam() { const spammers = localStorage.getItem("spammers").split(","); let cur_depth = 0, prev_depth = 0; let parent_authors = []; let tainted = false; const comments = document.querySelectorAll("div#Comments > form > table"); for (let i = 0; i < comments.length; i++) { const comment = comments[i]; cur_depth = comment.children[0].children[0].children[0].children[0].width; const ljuser = comment.querySelector(".ljuser"); if (ljuser) { comment._author = ljuser.children[0].href.match(/(?<=\=)\w+/)[0]; } else { comment._author = "(Анонимно)"; } if (cur_depth > prev_depth) { parent_authors.push(comments[i - 1]._author); } else { let i = cur_depth; while (i < prev_depth) { parent_authors.pop(); i += 25; } } for (let i = 0; i < spammers.length; i++) { if (comment._author === spammers[i] || parent_authors.some(x => x === spammers[i])) { tainted = true; break; } else { tainted = false; } } if (tainted) { comment.remove(); } prev_depth = cur_depth; } } addBlockButtons(); hideSpam(); })();