Greasy Fork

Greasy Fork is available in English.

dmhy block

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

当前为 2018-01-02 提交的版本,查看 最新版本

// ==UserScript==
// @name         dmhy block
// @namespace    https://github.com/tautcony
// @license      GPL version 3
// @encoding     utf-8
// @version      0.03
// @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的召唤", "2的召喚", "浩天个人发布"];
var IndexOfTitle = 2;
var IndexOfUserID = 8;
var RemoveTorrentInBlockList = 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;
            }
        }
    });
};
var skip = false;
var RemoveCommentInBlockList = function () {
    if (skip) {
        return;
    }
    var container = document.querySelector("table#comment_recent");
    if (container === null) {
        return;
    }
    $(window).unbind("scroll", RemoveCommentInBlockList); //wtf, don't work
    skip = true;
    var comments = $("table#comment_recent tbody tr");
    comments.each(function (index, elem) {
        var userName = $(elem).find("td.infotable span.username").text().trim();
        if (KeyWordBlockList.indexOf(userName) >= 0) {
            $(elem).remove();
        }
    });
};
if (location.href.indexOf("topics/view") > 0) {
    $(window).bind("scroll", RemoveCommentInBlockList);
}
else {
    RemoveTorrentInBlockList();
    $("th.{sorter:.'text'}.header").click(function () {
        setTimeout(RemoveTorrentInBlockList, 500);
    });
}