Greasy Fork is available in English.
Hameln Narou Kakuyomu Ranking Page Filtering by AuthorID and Tag
当前为
// ==UserScript==
// @name Novel Ranking Filter
// @namespace http://greasyfork.icu/en/users/1264733
// @version 2024-02-25
// @description Hameln Narou Kakuyomu Ranking Page Filtering by AuthorID and Tag
// @author LE37
// @license MIT
// @match https://kakuyomu.jp/rankings/*
// @match https://kakuyomu.jp/*recent_works
// @match https://syosetu.org/?mode=rank*
// @match https://yomou.syosetu.com/rank/*
// @exclude https://yomou.syosetu.com/rank/top/
// ==/UserScript==
(function() {
'use strict';
let a_re, a_lst, n_nc, n_ic, t_nc;
// Settings Begin
// Show type: 0 Blur 1 Hide
const s_type = 0;
switch (location.host) {
case "syosetu.org":
a_re = /\d+/;
// Hameln disliked AuthorID list https://syosetu.org/user/AuthorID/
a_lst = ["111", "222", "333"];
n_nc = "section3";
n_ic = "all_arasuji";
t_nc = "all_keyword";
break;
case "kakuyomu.jp":
a_re = /users\/(.*)$/;
// Kakuyomu disliked AuthorID list https://kakuyomu.jp/users/AuthorID
a_lst = ["aaa", "bbb", "ccc"];
n_nc = "widget-work";
n_ic = "widget-workCard-introduction";
t_nc = "widget-workCard-tags";
break;
case "yomou.syosetu.com":
a_re = /\d+/;
// Narou disliked AuthorID list https://mypage.syosetu.com/AuthorID/
a_lst = ["111", "222", "333"];
n_nc = "p-ranklist-item";
n_ic = "p-ranklist-item__synopsis";
t_nc = "p-ranklist-item__keyword";
break;
}
// Disliked Tag list
const t_lst = ["BL", "TS", "性転"];
// Settings End
const no = document.getElementsByClassName(n_nc);
let i = no.length;
while (i--) {
let dislike = false;
const aid = no[i].getElementsByTagName("a")[1].href.match(a_re);
if (a_lst.some(v => aid.includes(v))) {
dislike = true;
} else {
const k_ele = no[i].getElementsByClassName(t_nc)[0];
if (k_ele !== undefined) {
const kwd = k_ele.getElementsByTagName("a");
let k = kwd.length;
while (k--) {
const kdt = kwd[k].text;
if (t_lst.some(v => kdt.includes(v))) {
dislike = true;
break;
}
}
}
}
const ss = no[i].getElementsByClassName(n_ic)[0];
if (dislike === true) {
switch (s_type) {
case 0:
no[i].style.filter = "opacity(50%)";
if (ss !== undefined) {
ss.style.display = "none";
}
break;
case 1:
no[i].style.display = "none";
break;
}
} else {
// Novel isn't on any list
//no[i].style.backgroundColor = "#0099FF";
if (ss !== undefined) {
ss.style.maxHeight = "120px";
ss.style.overflow = "hidden";
}
}
}
})();