ktuBeF
BANNED | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Простенький фильтр, вырезает/скрывает сообщения неадекватных личностей. Изначально быдлокодился писался для другой доски. Легко может быть адаптирован к любой борде/форуму. Оригинальная идея позаимствована у Runtime_err0r Код: // ==UserScript== // @name Hide_an_Asshat // @namespace http:// // @version 0.3a // @description // @author // @match http://forum.ru-board.com/topic.cgi* // @include http://forum.ru-board.com/topic.cgi* // @grant GM_getValue // @grant GM_setValue // ==/UserScript== /* jshint multistr: true */ var asshat = []; asshat [0] = "Lepar"; asshat [1] = "MR_DesigneR"; //asshat [2] = "IFkO"; asshat [3] = "CoolXazker"; asshat [4] = "slaileb"; asshat [5] = "mmt"; asshat [6] = "VdV"; //asshat [7] = ""; //asshat [8] = ""; //asshat [9] = ""; //==================== var scroller; var header; var branch0; var branch1; var branch2; var block0; var block1; var block2; //var block3; var cnt = 0; var behavior = GM_getValue("paramX", ""); var isEnabled = GM_getValue("paramY", ""); var pwr = isEnabled ? "(I)" : "(0)"; var spc = isEnabled ? " " : " "; var input = document.createElement("input"); input.type = "button"; input.value = ( behavior == 0 ) ? "Стереть придурков нафиг \xA0 " + spc : "Спрятать недоумков \xA0\xA0 " + spc; input.onclick = toggleA; input.setAttribute("style", "font-size: 22px; position: absolute; top: 90px; left: 300px;"); document.body.appendChild(input); var input = document.createElement("input"); input.type = "button"; input.value = ( isEnabled == 1 ) ? "\xA0 Фильтр работает\xA0 \xA0 \xA0\xA0\xA0" + pwr : "\xA0-Фильтр остановлен-\xA0\xA0 " + pwr; input.onclick = toggleB; input.setAttribute("style", "font-size: 22px; position: absolute; top: 90px; left: 630px;"); document.body.appendChild(input); function toggleA() { if( !isEnabled ) { alert('FILTERING IS DISABLED, \nPLEASE ENABLE IT FIRST.'); return; } behavior ^= 1; GM_setValue("paramX", behavior); location.reload(); } function toggleB() { isEnabled ^= 1; GM_setValue("paramY", isEnabled); location.reload(); } function Apprehend() { if (typeof GM_getValue("paramY") != "number") { GM_setValue("paramY", 0); } if (typeof GM_getValue("paramX") != "number") { GM_setValue("paramX", 0); } behavior = GM_getValue("paramX", ""); if ( behavior == 0 ) { branch0 = document.getElementsByClassName("tb"); // top tag branch1 = document.getElementsByClassName("post"); // msg body branch2 = document.getElementsByClassName("m"); // bottom tag } header = document.getElementsByClassName("tb"); scroller = document.getElementsByClassName("post"); block0 = document.getElementsByClassName("tb"); //dats block1 = document.getElementsByClassName("m"); block2 = document.getElementsByClassName("post"); if(!GM_getValue("paramY", "")) return; for(var i = 0; i < header.length; i++) { var dick = block1[i].textContent; for(var y = 0; y <= asshat.length; y++) { var n = dick.indexOf(asshat[y]); if ( n >= 0 ) { if ( behavior == 1 ) { scroller[i].textContent = "\xA0 \xA0 \xA0 \xA0 \xA0 \xA0 \xA0 \xA0 \xA0 \xA0 \xA0 \xA0 \xA0 \xA0 \xA0 \xA0 \ \xA0 \xA0 \xA0 \xA0 \xA0 \xA0 \xA0 \xA0 \xA0 \xA0 \xA0 ~~~~~~~~~~~ тут был какой-то бред ~~~~~~~~~~~ "; header[i].getElementsByClassName("dats")[0].getElementsByTagName('img')[0].src = 'http://i.ru-board.com/avatars/Kermit.gif'; var trollMask0 = header[i].getElementsByClassName("dats")[0]; trollMask0.lastChild.textContent = "ТРОЛЛЬ"; } else { branch0[i].style.display = 'none'; branch1[i].style.display = 'none'; branch2[i].style.display = 'none'; } } } } } Apprehend(); if ( behavior == 0 ) { for(var i = 0; i < 8; i++) Apprehend(); } |
|