Niconico Seiga Block

ニコニコ静画にユーザー名ブロック機能を追加します

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Niconico Seiga Block
// @namespace    https://greasyfork.org/ja/scripts/406305-niconico-seiga-block/
// @version      0.1
// @description  ニコニコ静画にユーザー名ブロック機能を追加します
// @match        https://seiga.nicovideo.jp/illust/*
// @match        https://seiga.nicovideo.jp/tag/*
// @grant        none
// ==/UserScript==

const blockTarget = [
        "sample1",
        /^sample2$/,
      ],
      element = (() => {
        const loc = location.href
        if (loc.includes("ranking/point")) {
          return document.getElementsByClassName("ranking_single")
        } else if (loc.includes("ranking")) {
          return document.getElementsByClassName("rank_list_block")
        } else {
          return document.querySelectorAll("[class^=list_item]")
        }
      })()

Array.from(element).forEach(e => {
  const userName = (e.getElementsByClassName("user")[0] || e.getElementsByClassName("rank_txt_user")[0]).textContent.replace(/\n\s+/g, "")
  blockTarget.forEach(b => {
    if (userName.match(b)) e.style.display = "none"
  })
})