Greasy Fork

来自缓存

Greasy Fork is available in English.

dmhy block

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

当前为 2017-12-30 提交的版本,查看 最新版本

// ==UserScript==
// @name         dmhy block
// @namespace    https://github.com/tautcony
// @license      GPL version 3
// @encoding     utf-8
// @version      0.02
// @date         2017/12/30
// @modified     2017/12/30
// @description  把不想看到的资源从列表中抹去 动漫花园 (share.dmhy.org)
// @author       TautCony
// @match        *://share.dmhy.org/*
// @run-at       document-end
// ==/UserScript==

const UserBlockList = [693146, 585619];
const KeyWordBlockList = ["2的召唤", "2的召喚", "浩天个人发布"];

const IndexOfTitle  = 2;
const IndexOfUserID = 8;

let RemoveUsersInBlockList = () => {
    const tableList = $("table#topic_list tbody tr");
    tableList.each((index, elem) => {
        const tds = $(elem).find("td");
        const id = parseInt($(tds[IndexOfUserID]).find("a").attr("href").split("/").slice(-1)[0], 10);
        const 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 (const keyWord of KeyWordBlockList) {
            if (title.indexOf(keyWord) >= 0) {
                console.log(`Remove ${title} because of its title contains key word="${keyWord}"`);
                $(elem).remove();
                return;
            }
        }
    });
};

RemoveUsersInBlockList();

$("th.{sorter:.'text'}.header").click(() => {
    setTimeout(RemoveUsersInBlockList, 500);
});