dmhy block

把不想看到的资源从列表中抹去 动漫花园 (share.dmhy.org)

Version au 30/12/2017. Voir la dernière version.

// ==UserScript==
// @name         dmhy block
// @namespace    https://github.com/tautcony
// @license      GPL version 3
// @encoding     utf-8
// @version      0.01
// @date         2017/12/30
// @modified     2017/12/30
// @description  把不想看到的资源从列表中抹去 动漫花园 (share.dmhy.org)
// @author       TautCony
// @match        *://share.dmhy.org/*
// @run-at       document-end
// ==/UserScript==
var UserBlockList = [693146, 585619];
var KeyWordBlockList = ["2的召唤", "浩天个人发布"];
var IndexOfTitle = 2;
var IndexOfUserID = 8;
var RemoveUsersInBlockList = function () {
    var tableList = $("table#topic_list tbody tr");
    tableList.each(function (index, elem) {
        var tds = $(elem).find("td");
        var id = parseInt($(tds[IndexOfUserID]).find("a").attr("href").split("/").slice(-1)[0], 10);
        var title = $(tds[IndexOfTitle]).text().trim().split("\n")[0];
        if (UserBlockList.indexOf(id) >= 0) {
            console.log("Remove " + title + " because of it was published by userid=" + id);
            $(elem).remove();
            return;
        }
        for (var _i = 0, KeyWordBlockList_1 = KeyWordBlockList; _i < KeyWordBlockList_1.length; _i++) {
            var keyWord = KeyWordBlockList_1[_i];
            if (title.indexOf(keyWord) >= 0) {
                console.log("Remove " + title + " because of its title contains key word=\"" + keyWord + "\"");
                $(elem).remove();
                return;
            }
        }
    });
};
RemoveUsersInBlockList();