【自用】优书网动态去除黑名单用户,去除自己关注的人给别人点赞的动态

如果有用户在发现页面使用“待看”、“mark”、“未看”等毫无营养的词大量刷屏,就可以复制他的ID到屏蔽词列表屏蔽他。

// ==UserScript==
// @name         【自用】优书网动态去除黑名单用户,去除自己关注的人给别人点赞的动态
// @namespace    http://www.lkong.net/home.php?mod=space&uid=516696
// @version      0.2.2
// @description  如果有用户在发现页面使用“待看”、“mark”、“未看”等毫无营养的词大量刷屏,就可以复制他的ID到屏蔽词列表屏蔽他。
// @author       myself
// @match        *://www.yousuu.com/explore*
// @include      *://www.yousuu.com/explore*
// @icon         http://www.yousuu.com/favicon.ico
// ==/UserScript==



//屏蔽词列表。
//屏蔽词的双引号为英文半角引号,逗号也是,请勿忘记加逗号。
    var blackList = [
        "某个人的id","第二个人的id"
    ];


function 屏蔽某人(){
    var target = document.querySelectorAll("div.BookCommentItem:not(.checked)");
    console.log("优书网刷屏用户屏蔽:");
    for (var i = 0;i < target.length; i++){
        if (target[i].querySelectorAll("div.comment-author-info>p")[0] != null){
            var node = target[i].querySelectorAll("div.comment-author-info>p")[0];
            for (var j = 0 ;j < blackList.length; j++){
                //用户名在黑名单中则删掉
                if (node.innerHTML.indexOf(blackList[j]) > -1 ){
                    target[i].remove();
                    console.log(node);
                    break;
                }
            }
            target[i].classList.add("checked");
        }
    }

    //去除动态点赞
    var feed = document.querySelectorAll("span.feed-from:not(.checked)");
    for(let i=0;i<feed.length; i++){
        if(feed[i].innerText.indexOf('点赞')!=-1){
            feed[i].parentNode.parentNode.remove();
        }else{
            feed[i].classList.add("checked");
        }
    }
}

setInterval(function(){屏蔽某人();}, 1000);