赚吧优化

赚吧优化插件

// ==UserScript==
// @name            赚吧优化
// @description     赚吧优化插件
// @include         *://*.zuanke8.com/*
// @version         1.0.5
// @namespace       zuanke8
// @require         http://cdn.staticfile.org/jquery/1.12.4/jquery.min.js
// ==/UserScript==

(function() {
    var keywords = ["关键字a", "关键字b"];
    var usernames = ["用户a", "用户b"];
    var highlights = ["bug"];

    blockTopicsByUsernames(usernames);
    blockTopicsByKeywords(keywords);
    blockRepliesByUsernames(usernames);
    highlightTopicByHighlights(highlights);

    function blockTopicsByUsernames(usernames) {
        $('tbody[id^=normalthread] cite>a').filter(function() {
            return usernames.includes($(this).text());
        }).closest('tbody').remove();

    }

    function blockTopicsByKeywords(keywords) {
        $('tbody[id^=normalthread]>tr>th>a').filter(function(){
            var subject = $(this).text().toUpperCase();
            for(var i in keywords) {
                if(subject.includes(keywords[i].toUpperCase())) {
                    return true;
                }
            }
        }).closest('tbody').remove();
    }

    function blockRepliesByUsernames(usernames) {
        $('div.authi>a').filter(function() {
            return usernames.includes($(this).text());
        }).closest('tbody').remove();
    }

    function highlightTopicByHighlights(highlights) {
        $('tbody[id^=normalthread]>tr>th>a').filter(function(){
            var subject = $(this).text().toUpperCase();
            for(var i in highlights) {
                if(subject.includes(highlights[i].toUpperCase())) {
                    return true;
                }
            }
        }).css({'color': '#EE1B2E', 'font-weight': 'bold'});
    }

})();