Toggle Anilist Scores Script

21/10/2025, 13.21.43

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name        Toggle Anilist Scores Script
// @namespace   Violentmonkey Scripts
// @match       https://anilist.co/search/*
// @grant       none
// @version     1.2.1
// @author      AnzoDK
// @license     MIT
// @description 21/10/2025, 13.21.43
// ==/UserScript==
var state = localStorage.getItem("anilist_toggleScoresState") === "true" ? true : false;
var styleNode = null;
var stateCss = ".score:not(.form) {display:none!important;}";
var targetNode = document.getElementsByClassName("filters")[0];
var toggleBtn = null;
function toggleScoresAndSaveState()
{
  toggleScores();
  localStorage.setItem("anilist_toggleScoresState", state);
}
function toggleScores()
{
  if(state)
  {
    styleNode.innerHTML = "";
    state = false;
    toggleBtn.style.backgroundColor = "#182a34";
    return;
  }
  styleNode.innerHTML = stateCss;
  toggleBtn.style.backgroundColor = "#3db4f2";
  state = true;
}
function createToggleButton()
{
  var btn = document.createElement("button");
  btn.id = "toggleScoresBtn";
  btn.appendChild(document.createTextNode("Toggle Scores!!"));
  btn.onclick = toggleScoresAndSaveState;
  btn.style.backgroundColor = "#182a34";
  btn.style.color = "white";
  btn.style.borderRadius = "6px";
  targetNode.appendChild(btn);
  toggleBtn = btn;

}
function createStyleNode()
{
  styleNode = document.createElement("style");
  styleNode.id = "toggleScoresStyles";
  document.getElementsByTagName("head")[0].appendChild(styleNode);
  styleNode = document.getElementById("toggleScoresStyles");

}
function Init_ScoreToggle()
{
  createStyleNode();
  createToggleButton();
  console.log("Toggle Anilist Scores: Button initilized");
  console.log("Syncing button state with localStorage...");
  if(state)
  {
    styleNode.innerHTML = stateCss;
    toggleBtn.style.backgroundColor = "#3db4f2";
  }
}

function CheckForTarget(mutationList, observer)
{
  for (const mutation of mutationList)
    {
      if(document.getElementsByClassName("filters")[0])
        {
          targetNode = document.getElementsByClassName("filters")[0];
          Init_ScoreToggle();
          observer.disconnect();
          return;
        }
    }
}

const mo = new MutationObserver(CheckForTarget);
if(!targetNode)
  {
    console.log("Toggle Anilist Scores: Failed to locate filters - Observing page for changes...")
    mo.observe(document.body, { attributes: false, childList: true, subtree: true });
  }
else
  {
    Init_ScoreToggle();
  }