Remove spammers comments livejournal-users

Hide spam-authors by list.

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Remove spammers comments livejournal-users
// @name:ru     Удаление спамерских комментариев пользователей livejournal
// @version     0.2
// @description Hide spam-authors by list.
// @description:ru Скрывает спам-авторов по списку
// @include     http://livejournal.com/
// @include     http://*.livejournal.com/
// @include     http://*.livejournal.com/*
// @include     https://livejournal.com/
// @include     https://*.livejournal.com/
// @include     https://*.livejournal.com/*
// @namespace https://greasyfork.org/users/828699
// ==/UserScript==

(function(){

    var spamSList = [

        //insert your own list of spammers
    ];

    var wrapperS = [
        {q:'.comment-wrap .comment-head-in >span .i-ljuser >.i-ljuser-username'
         +',.comments-body .comment-meta .i-ljuser >.i-ljuser-username b'
         +',.b-tree .b-leaf-inner .i-ljuser >.i-ljuser-username'
         ,parent: 5},
        {q:'.comment-wrap.partial >.i-ljuser >.i-ljuser-username'
         +',.comments-body .collapsed-comment .i-ljuser >.i-ljuser-username'
         ,parent: 2},
    ];
    var win = typeof unsafeWindow !='undefined'? unsafeWindow : window;
	var $q = function(q, f){return (f||document).querySelector(q)};
	var setLocStor = function(name, hh){
		if(!localStorage) return;
		localStorage['removeLj_'+ name] = JSON.stringify({h: hh});
	};
	var getLocStor = function(name){
		return (JSON.parse(localStorage && localStorage['removeLj_'+ name] ||'{}')).h;
	};
	var removeLocStor = function(name){localStorage.removeItem('removeLj_'+ name);};
	var cleaning = function(){
		for(let i =0; i < wrapperS.length; i++){
			let wI = wrapperS[i];
            let wQA = [].slice.call(document.querySelectorAll(wI.q) );

            for(let j =0; j < wQA.length; j++){
				var wJ = wQA[j];
				//block spam
                var isSpam =0;
                for(let k =0; k < spamSList.length; k++){
                    if(wJ.innerHTML.replace(/<.*?>/g,'') == spamSList[k]){
                        isSpam =1;
                        break;
                    }
                }
                if(isSpam) {
                    for(let k =0; k < wI.parent; k++) {
                        wJ = wJ.parentNode;
                    }
                    wJ.style.display ='none';
                    //TODO add grey blocks
                }
            }
			//TODO add supress by click
		}
    };
    cleaning();
    LJ.Event.on("afterCommentExpand", cleaning);
	//spamSList = getLocStor('spamList') || spamSList;
	//TODO button to add to spamList

})();