Greasy Fork is available in English.
把不想看到的资源从列表中抹去 动漫花园 (share.dmhy.org)
当前为
// ==UserScript==
// @name dmhy block
// @namespace https://github.com/tautcony
// @license GPL version 3
// @encoding utf-8
// @version 0.04
// @date 2017/12/30
// @modified 2018/01/20
// @description 把不想看到的资源从列表中抹去 动漫花园 (share.dmhy.org)
// @author TautCony
// @match *://share.dmhy.org/*
// @run-at document-end
// ==/UserScript==
var UserBlockList = [
{ id: 693146, keywords: ["2的召唤", "2的召喚"] },
{ id: 585619, keywords: ["浩天个人发布"] },
{ id: 690113, keywords: ["ACG调查小队"] },
];
var KeywordBlockList = [
"我的狗死了",
];
var IndexOfTitle = 2;
var IndexOfUserID = 8;
var First = function (array) {
return array[0];
};
var Last = function (array) {
return array[array.length - 1];
};
var RemoveTorrentInBlockList = function () {
var tableList = $("table#topic_list tbody tr");
tableList.each(function (index, elem) {
var tds = $(elem).find("td");
var id = parseInt(Last($(tds[IndexOfUserID]).find("a").attr("href").split("/")), 10);
var title = First($(tds[IndexOfTitle]).text().trim().split("\n"));
for (var _i = 0, UserBlockList_1 = UserBlockList; _i < UserBlockList_1.length; _i++) {
var user = UserBlockList_1[_i];
var remove = false;
if (id === user.id) {
remove = true;
}
else {
if (user.keywords === undefined) {
break;
}
for (var _a = 0, _b = user.keywords; _a < _b.length; _a++) {
var keyword = _b[_a];
if (title.indexOf(keyword) >= 0) {
remove = true;
}
}
}
if (remove) {
console.log("Remove " + title + " because of it was published by or related to " + JSON.stringify(user));
$(elem).remove();
return;
}
}
for (var _c = 0, KeywordBlockList_1 = KeywordBlockList; _c < KeywordBlockList_1.length; _c++) {
var keyword = KeywordBlockList_1[_c];
if (title.indexOf(keyword) >= 0) {
console.log("Remove " + title + " because of its title contains key word=\"" + keyword + "\"");
$(elem).remove();
return;
}
}
});
};
var RemoveCommentInBlockList = function () {
var container = document.querySelector("table#comment_recent");
if (container === null) {
return;
}
window.removeEventListener("scroll", RemoveCommentInBlockList);
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.addEventListener("scroll", RemoveCommentInBlockList);
}
else {
RemoveTorrentInBlockList();
$("th.{sorter:.'text'}.header").click(function () {
setTimeout(RemoveTorrentInBlockList, 500);
});
}