ShikiUtils

Полезные утилиты для шикимори

// ==UserScript==
// @name         ShikiUtils
// @icon         https://www.google.com/s2/favicons?domain=shikimori.me
// @namespace    https://shikimori.one
// @version      2.8
// @description Полезные утилиты для шикимори
// @author       LifeH
// @match        *://shikimori.org/*
// @match        *://shikimori.one/*
// @match        *://shikimori.me/*
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_registerMenuCommand
// @grant        GM_xmlhttpRequest
// @connect      shikimori.one
// @license      MIT
// ==/UserScript==
(function () {
  "use strict";

  const config = loadConfig();
  const blockedUsers = JSON.parse(GM_getValue("blockedUsers", '["ID1", "ID2"]'));
  const allowedPaths = ['/ranobe', '/animes', '/mangas'];

  function аnimPage() {
    return window.location.href.includes("/animes");
  }

  const CopyIcon = `
  <svg width="16px" height="16px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path d="M17.5 14H19C20.1046 14 21 13.1046 21 12V5C21 3.89543 20.1046 3 19 3H12C10.8954 3 10 3.89543 10 5V6.5M5 10H12C13.1046 10 14 10.8954 14 12V19C14 20.1046 13.1046 21 12 21H5C3.89543 21 3 20.1046 3 19V12C3 10.8954 3.89543 10 5 10Z" stroke="#000000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></g></svg>
  `;
  const cssCopyIcon = `
  <svg width="16px" height="16px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"fill="#000000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="Dribbble-Light-Preview" transform="translate(-220.000000, -1239.000000)" fill="#000000"><g id="icons" transform="translate(56.000000, 160.000000)"> <path d="M183.7248,1085.149 L178.2748,1079.364 C178.0858,1079.165 177.8238,1079.001 177.5498,1079.001 L165.9998,1079.001 C164.8958,1079.001 163.9998,1080.001 163.9998,1081.105 L163.9998,1088.105 C163.9998,1088.657 164.4478,1089.105 164.9998,1089.105 C165.5528,1089.105 165.9998,1088.657 165.9998,1088.105 L165.9998,1082.105 C165.9998,1081.553 166.4478,1081.001 166.9998,1081.001 L175.9998,1081.001 L175.9998,1085.105 C175.9998,1086.21 176.8958,1087.001 177.9998,1087.001 L181.9998,1087.001 L181.9998,1088.105 C181.9998,1088.657 182.4478,1089.105 182.9998,1089.105 C183.5528,1089.105 183.9998,1088.657 183.9998,1088.105 L183.9998,1085.838 C183.9998,1085.581 183.9018,1085.335 183.7248,1085.149 L183.7248,1085.149 Z M182.9998,1091.001 L179.9998,1091.001 C178.8958,1091.001 177.9998,1092.001 177.9998,1093.105 L177.9998,1094.105 C177.9998,1095.21 178.8958,1096.001 179.9998,1096.001 L181.4998,1096.001 C181.7758,1096.001 181.9998,1096.224 181.9998,1096.501 C181.9998,1096.777 181.7758,1097.001 181.4998,1097.001 L178.9998,1097.001 C178.4528,1097.001 178.0098,1097.493 178.0028,1098.04 C178.0098,1098.585 178.4528,1099.001 178.9998,1099.001 L181.9998,1099.001 L182.0208,1099.001 C183.1138,1099.001 183.9998,1098.219 183.9998,1097.126 L183.9998,1096.084 C183.9998,1094.991 183.1138,1094.001 182.0208,1094.001 L181.9998,1094.001 L180.4998,1094.001 C180.2238,1094.001 179.9998,1093.777 179.9998,1093.501 C179.9998,1093.224 180.2238,1093.001 180.4998,1093.001 L182.9998,1093.001 C183.5528,1093.001 183.9998,1092.605 183.9998,1092.053 L183.9998,1092.027 C183.9998,1091.474 183.5528,1091.001 182.9998,1091.001 L182.9998,1091.001 Z M177.9998,1098.053 C177.9998,1098.048 178.0028,1098.044 178.0028,1098.04 C178.0028,1098.035 177.9998,1098.031 177.9998,1098.027 L177.9998,1098.053 Z M175.9998,1091.001 L172.9998,1091.001 C171.8958,1091.001 170.9998,1092.001 170.9998,1093.105 L170.9998,1094.105 C170.9998,1095.21 171.8958,1096.001 172.9998,1096.001 L174.4998,1096.001 C174.7758,1096.001 174.9998,1096.224 174.9998,1096.501 C174.9998,1096.777 174.7758,1097.001 174.4998,1097.001 L171.9998,1097.001 C171.4528,1097.001 171.0098,1097.493 171.0028,1098.04 C171.0098,1098.585 171.4528,1099.001 171.9998,1099.001 L174.9998,1099.001 L175.0208,1099.001 C176.1138,1099.001 176.9998,1098.219 176.9998,1097.126 L176.9998,1096.084 C176.9998,1094.991 176.1138,1094.001 175.0208,1094.001 L174.9998,1094.001 L173.4998,1094.001 C173.2238,1094.001 172.9998,1093.777 172.9998,1093.501 C172.9998,1093.224 173.2238,1093.001 173.4998,1093.001 L175.9998,1093.001 C176.5528,1093.001 176.9998,1092.605 176.9998,1092.053 L176.9998,1092.027 C176.9998,1091.474 176.5528,1091.001 175.9998,1091.001 L175.9998,1091.001 Z M170.9998,1098.053 C170.9998,1098.048 171.0028,1098.044 171.0028,1098.04 C171.0028,1098.035 170.9998,1098.031 170.9998,1098.027 L170.9998,1098.053 Z M169.9998,1092.027 L169.9998,1092.053 C169.9998,1092.605 169.5528,1093.001 168.9998,1093.001 L167.9998,1093.001 C166.7858,1093.001 165.8238,1094.083 166.0278,1095.336 C166.1868,1096.32 167.1108,1097.001 168.1068,1097.001 L168.9998,1097.001 C169.5528,1097.001 169.9998,1097.474 169.9998,1098.027 L169.9998,1098.053 C169.9998,1098.605 169.5528,1099.001 168.9998,1099.001 L168.1718,1099.001 C166.0828,1099.001 164.2168,1097.473 164.0188,1095.393 C163.7918,1093.008 165.6608,1091.001 167.9998,1091.001 L168.9998,1091.001 C169.5528,1091.001 169.9998,1091.474 169.9998,1092.027 L169.9998,1092.027 Z" id="file_css-[#1767]"> </path> </g> </g> </g> </g></svg>
  `;

  const menuLabels = {
        CommCopyBtn: "Copy comment link button",
        UserIdCopyBtn: "Copy user ID button",
        UserCssCopyBtn: "Copy user CSS button",
        ClubCssCopyBtn: "Copy club CSS button",
        ImageIdCopyBtn: "Copy image code button",
        ShikiRating: "Shikimori rating filter",
        StudioFilter: "Studios filter",
        addChineseFilter:"Chinese filter",
        FriendsAVGscore: "Friends' average score",
        autoSpoiler: "Auto spoiler",
        HistoryHelper: "History helper",
        NotificationHelper:"Notification helper",
        hideNews: "Hides news",
        NoAgeLimits: "Custom age",
        checkScroll: "Auto Loader",
        BanCount:"Ban count",
        watchTime:"Watch time",
        removeBlur:"Remove Blur",
  };


  for (const key in config) {
    GM_registerMenuCommand(
      `${menuLabels[key] || key}: ${config[key] ? "✅ ON" : "❌ OFF"}`,
      () => {
        saveConfig(key, !config[key]);
        location.reload();
      }
    );
  }
  function saveConfig(key, value) {
    GM_setValue(key, value);
  }

  function loadConfig() {
    return {
      CommCopyBtn: GM_getValue("CommCopyBtn", true),
      UserIdCopyBtn: GM_getValue("UserIdCopyBtn", true),
      UserCssCopyBtn: GM_getValue("UserCssCopyBtn", true),
      ClubCssCopyBtn: GM_getValue("ClubCssCopyBtn", true),
      ImageIdCopyBtn: GM_getValue("ImageIdCopyBtn", true),
      StudioFilter: GM_getValue("StudioFilter", true),
      ShikiRating: GM_getValue("ShikiRating", true),
      addChineseFilter: GM_getValue("addChineseFilter", true),
      FriendsAVGscore: GM_getValue("FriendsAVGscore", true),
      autoSpoiler: GM_getValue("autoSpoiler", false),
      HistoryHelper: GM_getValue("HistoryHelper", true),
      NotificationHelper: GM_getValue("NotificationHelper", true),
      hideNews: GM_getValue("hideNews", true),
      NoAgeLimits: GM_getValue("NoAgeLimits", true),
      checkScroll: GM_getValue("checkScroll", true),
      BanCount: GM_getValue("BanCount", true),
      watchTime: GM_getValue("watchTime", true),
      removeBlur: GM_getValue("removeBlur", true),
    };
  }


  function editBlockedUsers() {
    let currentUsers = GM_getValue("blockedUsers", '["ID1", "ID2"]');
    try {
      currentUsers = JSON.parse(currentUsers);
      if (!Array.isArray(currentUsers)) throw new Error();
    } catch (e) {
      currentUsers = ["ID1", "ID2"];
    }

    const newUsers = prompt("ID через запятую:",
      currentUsers.join(", ")
    );
    if (newUsers !== null) {
      const userArray = newUsers
        .split(",")
        .map((id) => id.trim())
        .filter((id) => id !== "");
      GM_setValue("blockedUsers", JSON.stringify(userArray));
      location.reload();
    }
  }

  GM_registerMenuCommand("blocked users list", editBlockedUsers);

  function hideNews(blockedUserIds) {
    document
      .querySelectorAll("article.b-news_wall-topic")
      .forEach((article) => {
        const userId = article.getAttribute("data-user_id");
        if (blockedUserIds.includes(userId)) {
          article.style.display = "none";
        }
      });
  }
  function NoAgeLimits() {
    const birthSelect = document.querySelector(".c-column.block_m .block select#user_birth_on_1i");
    if (!birthSelect) return;
    const selectedYear = birthSelect.value;
    let maxYear = 0;
    let minYear = Infinity;
    birthSelect.querySelectorAll("option").forEach((option) => {
      const year = parseInt(option.value, 10);
      if (!isNaN(year)) {
        if (year > maxYear) maxYear = year;
        if (year < minYear) minYear = year;
      }
    });

    birthSelect.innerHTML = "";

    for (let year = maxYear; year >= 1; year--) {
      const option = document.createElement("option");
      option.value = year;
      option.textContent = year;
      if (year == selectedYear) {
        option.selected = true;
      }
      birthSelect.appendChild(option);
    }
  }
  async function FriendsAVGscore() {
      document.querySelectorAll(".b-animes-menu .block").forEach((block) => {
        let subheadline = block.querySelector(".subheadline.m5");
        if (!subheadline || !subheadline.textContent.includes("У друзей")) return;

        if (subheadline.textContent.includes("|")) return;

        let scores = [];
        block.querySelectorAll(".friend-rate .status").forEach((status) => {
          let match = status.textContent.match(/–\s*(\d+)/);
          if (match) {
            let score = parseInt(match[1], 10);
            scores.push(score);
          }
        });
        if (scores.length > 0) {
          // console.log(scores);
          let averageScore = (
            scores.reduce((a, b) => a + b, 0) / scores.length
          ).toFixed(1);
          subheadline.textContent += ` | ${averageScore}`;
        }
      });
  }
  function BanCount() {
      if (!window.location.pathname.endsWith('/moderation')) {
        return;
    }

    let banCount = document.querySelectorAll('.b-ban').length;
    let headline = document.querySelector('.subheadline.m5');
    if (headline) {
        headline.textContent = `История банов - ${banCount}`;
    }
  }
  
  function btnBuilder({ tag = "a", classes = [], title = "", dataset = {}, styles = {}, svgIcon = "", onClick = null }) {
  const btn = document.createElement(tag);
  classes.forEach(cls => btn.classList.add(cls));
  if (title) btn.title = title;
  for (const key in dataset) {
    btn.dataset[key] = dataset[key];
  }
  for (const key in styles) {
    btn.style[key] = styles[key];
  }
  btn.innerHTML = svgIcon;

  const transitionStyle = "stroke 0.3s ease, fill 0.3s ease";

  btn.addEventListener("mouseenter", () => {
    const svg = btn.querySelector("svg");
    if (svg) {
      svg.querySelectorAll("path").forEach(path => {
        path.style.transition = transitionStyle;
        let computedStroke = window.getComputedStyle(path).stroke;
        if (computedStroke && computedStroke !== "none" && computedStroke !== "rgba(0, 0, 0, 0)") {
          if (!path.dataset.originalStroke) {
            path.dataset.originalStroke = computedStroke;
          }
          path.style.stroke = "var(--link-hover-color)";
        } else {
          let computedFill = window.getComputedStyle(path).fill;
          if (!path.dataset.originalFill) {
            path.dataset.originalFill = computedFill;
          }
          path.style.fill = "var(--link-hover-color)";
        }
      });
    }
  });

  btn.addEventListener("mouseleave", () => {
    const svg = btn.querySelector("svg");
    if (svg) {
      svg.querySelectorAll("path").forEach(path => {
        path.style.transition = transitionStyle;
        let computedStroke = window.getComputedStyle(path).stroke;
        if (computedStroke && computedStroke !== "none" && path.dataset.originalStroke) {
          path.style.stroke = path.dataset.originalStroke;
        } else if (path.dataset.originalFill) {
          path.style.fill = path.dataset.originalFill;
        }
      });
    }
  });
  if (onClick) {
    btn.addEventListener("click", async (e) => {
      await onClick(e);
      btn.style.transform = "scale(1.5)";
      setTimeout(() => (btn.style.transform = "scale(1)"), 200);
    });
  }
  return btn;
  }

  async function UserCssCopyBtn() {
  document.querySelectorAll(".avatar").forEach((avatar) => {
    if (avatar.querySelector(".copy-profile-css")) return;

    const profileActions = avatar.querySelector(".profile-actions");
    if (!profileActions) return;

    const img = avatar.querySelector("img");
    if (!img || !img.src) return;

    const match = img.src.match(/\/(\d+)\.png/);
    if (!match) return;
    const userId = match[1];

    const button = btnBuilder({
      tag: "a",
      classes: ["copy-profile-css", "b-tooltipped"],
      title: "Скопировать CSS",
      dataset: { direction: "top" },
      styles: {
        width: "16px",
        height: "16px",
        cursor: "pointer",
        display: "flex",
        alignItems: "center",
        justifyContent: "center",
        margin: "10px",
        textAlign: "center",
        zIndex: "9999"
      },
      svgIcon: cssCopyIcon,
      onClick: async () => {
        try {
          const userResponse = await fetch(`https://shikimori.one/api/users/${userId}`);
          const userData = await userResponse.json();
          const styleId = userData.style_id;
          if (!styleId) throw new Error("no styleId");

          const styleResponse = await fetch(`https://shikimori.one/api/styles/${styleId}`);
          const styleData = await styleResponse.json();
          await navigator.clipboard.writeText(styleData.compiled_css);
        } catch (err) {
          console.error(err);
        }
      }
    });

    const idCopyButton = avatar.querySelector(".copy-profile-id");
    if (idCopyButton) {
      idCopyButton.parentNode.style.display = "flex";
      idCopyButton.parentNode.style.alignItems = "center";
      idCopyButton.parentNode.appendChild(button);
    } else {
      const newDiv = document.createElement("div");
      newDiv.classList.add("profile-actions");
      newDiv.style.textAlign = "center";
      newDiv.style.display = "flex";
      newDiv.style.alignItems = "center";
      newDiv.appendChild(button);
      profileActions.parentNode.insertBefore(newDiv, profileActions.nextSibling);
    }
  });
  }

  async function ClubCssCopyBtn() {
  document.querySelectorAll(".b-clubs-menu").forEach((menu) => {
    const button = btnBuilder({
      tag: "a",
      classes: ["copy-club-css", "b-tooltipped"],
      title: "Скопировать CSS клуба",
      dataset: { direction: "top" },
      styles: {
        width: "16px",
        height: "16px",
        cursor: "pointer",
        display: "inline-block",
        textAlign: "center",
        position: "absolute",
        top: "-30px",
        left: "50%",
        transform: "translateX(-50%)",
        zIndex: "9999",
        transition: "transform 0.2s ease"
      },
      svgIcon: cssCopyIcon,
      onClick: async () => {
        const match = window.location.href.match(/\/clubs\/(\d+)-/);
        if (match) {
          const clubId = match[1];
          try {
            const clubResponse = await fetch(`https://shikimori.one/api/clubs/${clubId}`);
            if (!clubResponse.ok) throw new Error(clubResponse.status);
            const clubData = await clubResponse.json();

            const styleId = clubData.style_id;
            if (!styleId) throw new Error("no styleId");

            const styleResponse = await fetch(`https://shikimori.one/api/styles/${styleId}`);
            if (!styleResponse.ok) throw new Error(styleResponse.status);
            const styleData = await styleResponse.json();

            if (!styleData.compiled_css) throw new Error("no styleData.compiled_css");

            await navigator.clipboard.writeText(styleData.compiled_css);
          } catch (err) {
            console.error(err);
          }
        } else {
          console.error("no club id");
        }
      }
    });

    menu.prepend(button);
  });
  }

  function CommCopyBtn() {
  document.querySelectorAll(".b-comment").forEach((comment) => {
    if (comment.querySelector(".copy-comment-link")) return;

    const commentId = comment.id;
    if (!commentId) return;
    const commentLink = `https://shikimori.one/comments/${commentId}`;

    const button = btnBuilder({
      tag: "span",
      classes: ["copy-comment-link"],
      title: "Скопировать ссылку",
      styles: {
        width: "12px",
        height: "12px",
        cursor: "pointer",
        display: "inline-block",
        margin: "0 5px",
        verticalAlign: "middle"
      },
      svgIcon: CopyIcon,
      onClick: () => {
        return navigator.clipboard.writeText(commentLink)
          .catch(err => console.error(err));
      }
    });

    const mainControls = comment.querySelector(".main-controls");
    if (mainControls) {
      mainControls.appendChild(button);
    }
  });
  }

  function UserIdCopyBtn() {
  document.querySelectorAll(".avatar").forEach((avatar) => {
    if (avatar.querySelector(".copy-profile-id")) return;

    const profileHead = avatar.closest(".profile-head");
    if (!profileHead) return;

    const userId = profileHead.dataset.userId;
    if (!userId) return;

    const profileActions = avatar.querySelector(".profile-actions");
    if (!profileActions) return;

    const button = btnBuilder({
      tag: "a",
      classes: ["copy-profile-id", "b-tooltipped"],
      title: "Скопировать ID",
      dataset: { direction: "top" },
      styles: {
        width: "16px",
        height: "16px",
        cursor: "pointer",
        display: "flex",
        alignItems: "center",
        justifyContent: "center",
        margin: "10px",
        textAlign: "center",
        zIndex: "9999"
      },
      svgIcon: CopyIcon,
      onClick: () => {
        return navigator.clipboard.writeText(userId)
          .catch(err => console.error(err));
      }
    });

    const newDiv = document.createElement("div");
    newDiv.classList.add("profile-actions");
    newDiv.style.textAlign = "center";
    newDiv.appendChild(button);
    profileActions.parentNode.insertBefore(newDiv, profileActions.nextSibling);
  });
  }

  function ImageIdCopyBtn() {
  document.querySelectorAll(".b-image").forEach((imageWrapper) => {
    if (imageWrapper.querySelector(".copy-image-id-button")) return;

    const imageData = imageWrapper.getAttribute("data-attrs");
    if (!imageData) return;

    try {
      const parsed = JSON.parse(imageData);
      const imageId = parsed.id;
      if (!imageId) return;

      const button = btnBuilder({
        tag: "span",
        classes: ["copy-image-id-button"],
        title: "Скопировать код изображения",
        styles: {
          width: "16px",
          height: "16px",
          cursor: "pointer",
          position: "absolute",
          top: "5px",
          right: "5px",
          zIndex: "10"
        },
        svgIcon: CopyIcon,
        onClick: (event) => {
          event.stopPropagation();
          event.preventDefault();
          const formattedText = `[image=${imageId}]`;
          return navigator.clipboard.writeText(formattedText)
            .catch(err => console.error(err));
        }
      });

      imageWrapper.style.position = "relative";
      imageWrapper.appendChild(button);
    } catch (e) {
      console.error(e);
    }
  });
  }


//helpers////helpers////helpers////helpers////helpers////helpers////helpers////helpers////helpers////helpers////helpers////helpers////helpers////helpers////helpers////helpers////helpers////helpers//
  function helperBuilder({ itemSelector, checkboxClass, deleteButtonSelector, deleteMethod, deleteUrlAttr, buttonId, buttonText, buttonStyle, showOnHover, checkboxContainerSelector }) {
if (!document.querySelector(deleteButtonSelector)) return;

let button = null;
let lastChecked = null;
let isThrottled = false;

document.querySelectorAll(itemSelector).forEach((item) => {
    if (item.querySelector(`.${checkboxClass}`)) return;

    const checkboxContainer = checkboxContainerSelector ? item.querySelector(checkboxContainerSelector) : item;
    if (!checkboxContainer) return;

    const checkbox = document.createElement("input");
    checkbox.type = "checkbox";
    checkbox.className = checkboxClass;
    checkbox.style.marginLeft = "8px";

    if (showOnHover) {
        checkbox.style.display = "none";
        item.addEventListener("mouseenter", () => {
            checkbox.style.display = "inline-block";
        });
        item.addEventListener("mouseleave", () => {
            if (!checkbox.checked) {
                checkbox.style.display = "none";
            }
        });
    }

    checkbox.addEventListener("click", (event) => {
        shiftSelect(event, checkbox, checkboxClass, itemSelector);
        updateHighlight(checkbox, itemSelector);
    });

    checkboxContainer.prepend(checkbox);
});

function shiftSelect(event, checkbox, checkboxClass, itemSelector) {
    if (event.shiftKey && lastChecked) {
        const checkboxes = [...document.querySelectorAll(`.${checkboxClass}`)];
        const start = checkboxes.indexOf(lastChecked);
        const end = checkboxes.indexOf(checkbox);
        checkboxes.slice(Math.min(start, end), Math.max(start, end) + 1).forEach(cb => {
            cb.checked = lastChecked.checked;
            updateHighlight(cb, itemSelector);
        });
    }
    lastChecked = checkbox;
    updateDeleteButton(checkboxClass, itemSelector);
}

function updateHighlight(checkbox, itemSelector) {
    const item = checkbox.closest(itemSelector);
    item.style.backgroundColor = checkbox.checked ? "#D0E8FF" : "";
}

function updateDeleteButton(checkboxClass, itemSelector) {
    const selectedItems = document.querySelectorAll(`.${checkboxClass}:checked`);
    if (selectedItems.length > 0) {
        if (!button) {
            button = document.createElement("button");
            button.id = buttonId;
            button.textContent = buttonText;
            Object.assign(button.style, buttonStyle);
            button.addEventListener("click", () => deleteSelected(checkboxClass, itemSelector, deleteButtonSelector, deleteMethod, deleteUrlAttr));
            document.body.appendChild(button);
        }
    } else {
        if (button) {
            button.remove();
            button = null;
        }
    }
}

async function deleteSelected(checkboxClass, itemSelector, deleteButtonSelector, deleteMethod, deleteUrlAttr) {
    if (isThrottled) return;

    const tokenElement = document.querySelector('meta[name="csrf-token"]');
    const csrfToken = tokenElement ? tokenElement.content : null;
    if (!csrfToken) return;

    let selectedItems = document.querySelectorAll(`.${checkboxClass}:checked`);

    for (const checkbox of selectedItems) {
        const item = checkbox.closest(itemSelector);
        const deleteButton = item.querySelector(deleteButtonSelector);
        if (deleteButton) {
            item.style.backgroundColor = "#FFB3B3";
            item.style.transition = "background-color 0.3s ease";

            const deleteUrl = deleteButton.getAttribute(deleteUrlAttr);
            if (deleteUrl) {
                try {
                    const response = await fetch(deleteUrl, {
                        method: deleteMethod,
                        credentials: "include",
                        headers: {
                            "User-Agent": navigator.userAgent,
                            "X-CSRF-Token": csrfToken,
                            "Content-Type": "application/x-www-form-urlencoded"
                        },
                        body: new URLSearchParams({
                            _method: "delete",
                            authenticity_token: csrfToken
                        })
                    });

                    if (response.ok) {
                        await new Promise(resolve => setTimeout(resolve, 300));
                        item.remove();
                    } else if (response.status === 429) {
                        console.warn("status 429: таймаут 10с");
                        item.style.backgroundColor = "#FFFF99";
                        isThrottled = true;
                        setTimeout(() => {
                            isThrottled = false;
                            deleteSelected(checkboxClass, itemSelector, deleteButtonSelector, deleteMethod, deleteUrlAttr);
                        }, 10000);
                        return;
                    }
                } catch (error) {
                    // console.error("err del", item.id, error);
                }
            }
        }
        selectedItems = document.querySelectorAll(`.${checkboxClass}:checked`);
    }

    if (button) {
        button.remove();
        button = null;
    }
}
  }

  function NotificationHelper() {
      helperBuilder({
        itemSelector: ".b-message, .b-dialog",
        checkboxClass: "notification-checkbox",
        deleteButtonSelector: ".item-delete-confirm",
        deleteMethod: "DELETE",
        deleteUrlAttr: "action",
        buttonId: "delete-selected-notifications",
        buttonText: "Удалить выбранные",
        buttonStyle: {
          position: "fixed",
          bottom: "20px",
          right: "20px",
          padding: "10px",
          background: "red",
          color: "white",
          border: "none",
          cursor: "pointer",
          zIndex: "1000"
        },
        showOnHover: true,
        checkboxContainerSelector: "aside.buttons div.main-controls"
      });
  }
  function HistoryHelper() {
      helperBuilder({
        itemSelector: ".b-user_history-line",
        checkboxClass: "history-checkbox",
        deleteButtonSelector: ".destroy",
        deleteMethod: "POST",
        deleteUrlAttr: "href",
        buttonId: "del-selected",
        buttonText: "Удалить выбранные",
        buttonStyle: {
          position: "fixed",
          bottom: "20px",
          right: "20px",
          padding: "10px",
          background: "red",
          color: "white",
          border: "none",
          cursor: "pointer",
          zIndex: "1000"
        },
        showOnHover: false,
        checkboxContainerSelector: null
      });
  }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


//Filters////Filters////Filters////Filters////Filters////Filters////Filters////Filters////Filters////Filters////Filters////Filters////Filters////Filters////Filters////Filters////Filters////Filters//
  async function StudioFilter() {
    if (!аnimPage()) {
      return;
    }
    const hiddenBlocks = document.querySelectorAll(".block.hidden");
    let filterBlock = null;

    hiddenBlocks.forEach((block) => {
      if (block.querySelector(".subheadline.m5")?.textContent.includes("Студия")) {
        filterBlock = block;
      }
    });

    if (!filterBlock) {
      return;
    }

    let studioList = filterBlock.querySelector(".b-block_list.studios.anime-params");
    if (!studioList) {
      studioList = document.createElement("ul");
      studioList.className = "b-block_list studios anime-params";
      filterBlock.appendChild(studioList);
    }

    try {
      const response = await fetch("https://shikimori.one/api/studios", {
        headers: {
          "User-Agent": "Mozilla/5.0",
        },
      });

      if (!response.ok) {
        throw new Error(response.status);
      }

      const studios = await response.json();
      const realStudios = studios.filter((studio) => studio.real);
      // spoiler
      const spoilerContainer = document.createElement("div");
      spoilerContainer.className = "b-spoiler";

      const spoilerLabel = document.createElement("label");
      spoilerLabel.textContent = "Показать список";
      spoilerLabel.style.cursor = "pointer";

      const spoilerContent = document.createElement("div");
      spoilerContent.className = "content only-show";
      spoilerContent.style.display = "none";

      const spoilerInner = document.createElement("div");
      spoilerInner.className = "inner";

      spoilerInner.appendChild(studioList);
      spoilerContent.appendChild(spoilerInner);
      spoilerContainer.appendChild(spoilerLabel);
      spoilerContainer.appendChild(spoilerContent);

      filterBlock.appendChild(spoilerContainer);

      // ev
      spoilerLabel.addEventListener("click", () => {
        spoilerLabel.style.display = "none";
        spoilerContent.style.display = "block";
        spoilerContainer.dispatchEvent(new Event("spoiler:open"));
      });

      realStudios.forEach((studio) => {
        const studioItem = document.createElement("li");
        studioItem.dataset.field = "studio";
        studioItem.dataset.value = `${studio.id}-${studio.filtered_name}`;

        const checkbox = document.createElement("input");
        checkbox.type = "checkbox";

        studioItem.appendChild(checkbox);
        studioItem.appendChild(document.createTextNode(` ${studio.name}`));
        studioList.appendChild(studioItem);
      });

      filterBlock.classList.remove("hidden");
    } catch (error) {
      console.error(error);
    }
  }
//Chinese FILTER////Chinese FILTER////Chinese FILTER////Chinese FILTER////Chinese FILTER////Chinese FILTER////Chinese FILTER////Chinese FILTER////Chinese FILTER////Chinese FILTER////Chinese FILTER////Chinese FILTER////Chinese FILTER////Chinese FILTER////Chinese FILTER////Chinese FILTER////Chinese FILTER////Chinese FILTER////Chinese FILTER////Chinese FILTER////Chinese FILTER//
const ChineseAnimeId = [44074,40434,50399,49413,49701,44070,56752,37208,38450,51039,40730,45556,56523,50407,37822,56524,40211,49571,55809,44412,57067,52684,40784,37078,55655,54029,40435,49574,51335,59150,59306,40080,58689,51836,44218,42640,49587,41611,59077,41923,37150,37932,58509,58143,38409,50207,58930,33926,38436,57183,54846,37936,49570,47405,59939,50403,44196,53859,55993,49200,38990,55745,60541,44068,41221,54035,55151,51769,41219,37924,59001,56960,54285,50667,57663,51390,39959,39178,42266,33443,51038,56215,48791,50537,36561,50401,37176,54123,40111,59245,38917,55733,51898,57442,33446,42956,42238,53367,40735,58448,55684,58555,54444,55692,57097,58744,57264,49759,59389,45558,33350,44388,41918,57995,51289,44067,44406,38491,49742,38410,38435,41409,59953,55303,33209,50274,50444,48965,49386,45599,36522,42290,50114,56471,35015,50240,10259,51203,55740,38740,53450,38250,36184,49409,56717,60420,55821,58079,54974,36160,49573,39676,39024,49847,58797,36823,54014,59385,40734,36910,54875,54437,53905,49275,44212,44069,40991,38741,35333,42106,56764,48890,59916,36545,50629,41528,42284,51287,50404,45196,44221,39675,42985,52949,38528,49599,38533,36824,44061,44090,59398,37618,40005,41094,40732,35626,58523,52890,42206,31678,37175,48537,41224,48941,53449,37164,959,33758,37937,48962,44064,52178,47614,49569,56963,42187,51280,36491,52765,57469,50429,38467,50462,44065,960,51333,48684,44408,41884,57422,39912,51334,52522,49448,27825,5854,10629,50581,40909,56766,49559,48000,33605,59012,34300,52769,55790,59178,50544,51195,38220,51861,31499,41785,42898,33969,50925,53477,37292,56216,50433,60089,48845,37396,57594,44389,40966,58551,44411,58711,40100,48956,58476,49572,38918,41051,42455,56774,36775,55130,50647,40733,15905,42950,41916,51288,44071,36848,42454,42267,49305,32094,52771,56716,57371,56765,42176,37886,35044,51191,50105,41215,48867,49750,48369,48964,56787,47044,56439,37184,39419,38489,41511,57699,32230,40885,40062,34009,41220,37185,49398,49915,38742,42359,40969,50400,51791,39080,36732,40806,41210,39191,50432,45042,41223,57613,53448,51727,49274,42209,57351,50501,40979,11835,44513,52105,48374,48481,54881,55072,52680,57512,49098,56981,33019,50271,49873,38490,44097,59179,42949,38536,44410,59433,54772,36148,55186,58681,51941,39936,29936,50538,6902,33421,54945,31838,37207,50898,29089,32323,50230,51196,51645,40994,55864,55762,55693,59327,39188,45654,54124,58779,58057,36318,51385,51549,55694,49718,57865,2578,48759,43626,47612,37293,51291,49380,50421,57520,31427,40151,50446,51517,36661,57656,44047,37209,48480,40208,37294,50280,39116,52623,39141,55731,44570,42966,56695,32534,51207,32543,55829,53919,59182,33305,50378,48875,51726,36790,48914,57575,48694,56930,50521,37928,50633,57096,41913,50217,58055,55009,51457,39767,37894,50443,41917,11841,56958,42302,50575,48097,54737,38325,41503,51197,58056,57513,55014,6855,36791,36588,50411,51860,19781,37895,55578,51915,47795,13755,35204,60247,40233,50441,42794,39823,44390,41915,37887,49841,36993,40823,53852,58012,42151,57877,29087,44062,16756,48942,37737,42947,40638,54997,54018,38556,52101,50445,36290,30412,50588,54631,55015,44078,29935,49620,35757,42268,51198,9950,37563,41093,51383,55192,39720,37938,50439,33396,49432,53476,50657,39231,40835,39760,53473,33704,41286,39572,19687,36291,51735,37564,36455,42291,42149,31233,49757,9952,34525,50571,8783,48543,44213,50398,36185,8999,36571,37598,37179,42319,57996,315,33739,36423,53618,40876,50431,28673,9818,56579,44072,49952,45557,33925,37740,55732,41802,51490,38412,51131,9558,5496,37152,54973,54021,7477,35215,39421,52221,32751,37641,44233,37090,42285,41080,29910,34903,56342,33195,31150,36345,33759,55739,35650,39223,33531,39736,51746,33271,56207,36397,37044,51864,54261,39298,50202,50406,36544,51000,51520,9817,9806,33193,37661,45600,51863,37643,57759,5129,33278,33038,42784,50644,55355,38535,50539,40568,29603,9416,49208,33760,49170,30156,44073,38690,50810,40194,47403,7752,32936,45195,51397,36644,42132,36425,54646,42148,39678,27811,50430,42158,51681,33562,55093,33339,50565,36429,46821,9417,10149,39022,33764,37620,34675,51183,38379,50849,38688,51492,37300,37619,38413,35643,33702,41920,36762,42082,38677,36226,33357,9947,25149,29937,32890,42444,34410,51190,54648,30096,33194,9822,36427,37642,34129,33757,33309,37291,51623,44627,32809,33266,37896,24603,34669,41632,34602,50636,30166,37181,37888,42740,23915,38341,38285,37180,44075,37177,41078,6861,38689,9951,38378,50604,30058,38534,30097,35642,30098,46924,49652,39264,34940,31965,52650,31299,42443,36666,37058,33755,40117,30519,29876,51825,36996,16506,33279,30886,6156,30095,37392,50021,46639,34511,42641,36722,38347,37391,36245,32818,33775,33761,37736,54534,37186,21129,32820,27503,30099,45607,48979,32807,31348,9869,30247,55362,21081,31698,37390,54340,32819,33258,32808,18489,18491,9973,36440,42178,35921,5889,38346,34510,31972,33985,30463,35623,25173,32889,29623,36164,33771,33883,20713,9521,32933,33508,29857,36932,33801,35432,35379,29961,43660,43260,43663,38919,50603,43391,45838,43494,46902,43797,43272,6150,44530,44529,45835,46567,45837,36015,45845,45839,45843,45844,49796,43450,52182,44417,45718,44413,44427,44424,44421,44422,44426,47759,44416,44423,44415,56820,44419,44414,44425,44418,44420,43913,43216,51558,41415,44370,43844,43893,47507,43954,48910,45459,47231,49143,57930,46145,46252,59876,51392,46217,32796,32797,43838,38484,52625,46934,60289,54895,53676,50920,43676,60248,46426,46949,47512,47980,33196,47547,43573,59246,52698,36619,44100,60561,44560,60207,47465,47466,46078,43796,44597,47559,47952,55656,40621,48117,56927,51821,59434,58490,59915,48009,57878,51405,56560,59354,45441,46307,52772,52841,45612,48899,43892,56040,43496,43231,45442,56339,59225,45443,43238,43866,43595,43273,49065,46659,45440,43284,45548,43662,45539,45538,45532,45535,45080,45540,45549,45551,45534,45884,45537,45552,45536,45541,56335,45547,45696,45983,45698,54268,48078,45697,43360,48084,43345,43249,46356,47899,49970,60821,44014,53856,46711,53226,59998,52714,57455,52838,52840,52597,52634,57454,45416,15111,33772,33773,44178,42948,44642,45040,48121,43497,44615,44634,48043,35138,48873,43283,43948,54684,48260,46963,47468,45712,43511,44700,45276,45285,55541,39189,43673,46706,46504,51261,31892,51262,9956,31893,33753,38246,37228,43405,53030,43889,46283,45371,45378,45379,45376,42070,44350,45861,45381,45374,45380,45784,45787,45788,45786,44301,47960,47480,52705,51936,50300,45707,46213,57449,52869,59762,46663,60855,60766,46665,44371,59063,43872,45830,46662,46676,46673,46677,46674,48022,46667,46666,47554,46661,55530,45364,47951,51877,60137,47949,50957,43374,47947,43594,46040,39190,46277,42461,45271,47948,45998,46391,46940,19839,50842,43805,50194,51834,43455,51880,44518,44520,44521,44522,44523,44525,43370,9948,45866,42952,47292,43222,34248,51879,47485,56771,31701,48844,45921,46380,60418,56773,59927,42456,45297,56373,44288,43217,60249,56585,56586,43901,60233,51881,46225,43582,47471,47472,43898,51356,51357,43401,44368,43999,43984,43997,43985,43988,43986,43987,47475,44000,43989,47470,43992,43998,47474,44001,47473,49079,43996,44004,44003,43994,44005,43983,52257,43990,43995,43982,43991,39192,44002,43993,53066,46409,59351,59353,59352,59557,46041,51938,51939,44096,43403,58068,60517,60143,47982,60374,45729,56795,49078,48101,43533,43400,60171,54224,43380,43970,42463,43857,60794,43606,43800,43670,57928,43239,43646,43373,37225,43378,43827,48045,60416,43508,57015,40091,43248,40092,60235,42372,42373,43822,43548,44479,59151,44486,59152,45418,43569,44181,43680,45954,54736,59993,45706,59593,43235,44504,43368,46448,45717,43461,45112,54033,44174,58001,56157,43233,44503,59624,59242,43951,43393,60711,46328,31700,45938,44018,43534,45941,47514,47060,60712,43341,45776,60710,43607,47590,54388,44767,44768,45044,43657,48120,43498,59018,46787,47184,59386,45713,57657,51862,43343,53573,43286,47186,60066,45279,45272,45284,43220,43490,43520,60772,47599,43280,47185,47188,47187,46705,43896,51992,45869,47348,45920,45522,51937,45899,49069,47281,43342,43214,45812,43928,45293,43926,54065,47676,45461,43208,58325,52019,48016,46259,43922,52653,43929,43923,43924,56799,43925,47987,43927,43937,43939,43936,43934,43931,43933,43938,43930,43935,47674,43611,47675,51216,45462,45463,45309,42815,43596,30140,45291,47282,45302,45264,45299,45290,45306,45305,47802,47804,45255,45259,45258,45274,45254,45281,45282,46284,45267,45286,45287,33630,45265,45257,45270,37149,42460,47803,47805,33670,48033,45472,45860,58754,37102,37097,43679,37099,46298,37101,32821,44135,37098,40439,34677,47106,37100,34676,44138,48039,48040,44136,48100,44140,60451,44137,40440,48126,43804,37219,43409,32269,44596,60457,48026,48090,44763,32270,44764,43832,44762,44758,44760,60878,57461,60879,43624,60881,60887,43851,60888,43619,60889,60882,60883,60880,60884,60885,60886,58557,48024,49965,48092,46536,57060,52187,46535,48116,44671,43845,46350,38069,60890,60891,50794,60787,52130,43669,43816,43218,43265,43232,57389,55589,46116,46255,46247,46249,45905,57416,43263,43605,43346,58375,58376,43634,60453,48087,45182,47236,46721,43674,57933,43806,59450,59451,60705,33763,33762,46903,60452,32920,46310,46758,48118,43617,44101,45903,56486,56372,36843,58487,56968,58924,47927,60545,43637,43407,45858,52519,46293,43276,43577,43491,52585,43625,56969,45894,47991,51601,47642,45468,47560,46393,56246,52652,49204,46468,46375,58494,52696,42513,52629,45677,50321,38557,42468,42979,48035,52849,43359,36428,43463,43542,59765,43386,45716,43242,48852,43464,47640,47643,48851,9903,60529,44673,43502,56589,38911,44450,43649,45289,43817,43308,43592,45452,43333,47330,43515,45456,53031,47007,47728,45769,50233,44009,49139,44007,44011,44012,45688,44013,44008,48113,44010,45854,52870,43666,43856,49118,49985,58556,58559,45156,43891,50458,38125,47214,40182,45011,47008,43244,46316,57836,47058,57837,38126,38124,38131,38135,38140,38136,38117,38128,38122,38138,38132,47986,38129,39798,41635,48058,38118,47757,38119,38127,43639,38123,44353,38134,38133,38120,38137,57459,57317,47131,46154,43819,43858,43852,43912,43818,43526,46638,43677,43888,57866,47650,60297,46440,44840,45868,46458,53382,43656,57468,45689,45187,45069,59634,46260,43267,42765,45681,60435,42766,45682,47775,43665,43570,59969,43519,43861,46256,44079,44228,45690,47963,46657,47965,56970,52584,43830,57440,44006,43583,45965,45679,52704,56321,46243,46658,42033,57464,50296,50297,43226,43389,43357,45761,43650,43808,47838,44399,47954,52855,42146,46371,42147,42144,46295,43897,47964,45133,47889,33267,47651,45169,47070,46318,45780,59938,44452,47890,60415,48041,41942,45482,43224,49277,39679,47063,47367,48073,45388,45702,55563,34724,48421,53206,57906,53055,43382,52770,57418,58897,57233,59087,51596,53709,60442,56144,44104,44109,43977,43916,53498,44103,44110,44105,44108,59084,44111,44112,43979,44114,44123,44118,44122,44117,44116,44119,44115,44121,43826,43943,58554,58198,59696,52692,46309,45911,46630,46241,57226,58876,43261,43541,59380,45493,46390,55542,60434,51278,47766,47797,50295,58898,46142,57743,57384,47936,47787,35364,35365,52628,53067,57463,42263,45102,41416,42264,45417,45103,43354,45058,43799,48130,52062,52063,48027,45351,46005,43678,45519,45684,43809,45263,45517,45520,44674,45521,45262,45304,45283,37187,43019,43552,43213,43848,46376,46695,56371,44543,44544,44545,43643,43516,43512,43236,43501,43537,43539,43623,43488,43613,43614,44385,48754,46704,47283,43371,44531,43593,43404,43798,43821,44571,45204,48059,47234,42320,56796,52401,56797,32823,43493,35956,45908,43262,31205,43258,47579,43364,43392,48107,43671,45973,43828,44565,49355,44618,45821,45826,45828,45825,43196,45017,43546,43894,43895,45455,46308,45451,45453,45827,45454,50249,43622,45043,51563,50797,46324,43514,47274,59410,43911,56041,45728,56559,30051,9821,9819,43841,51210,35910,59181,30052,50841,43616,43316,43314,43313,59156,47022,44176,45878,43237,59241,59237,43586,43810,43347,43348,42447,49144,44302,52292,33600,33601,42446,42448,42969,44303,44434,42332,59951,43259,46172,56338,44182,44187,54949,44185,44184,42485,42834,43411,44847,44846,51873,47769,60690,43850,43381,44667,44679,57458,44506,44507,44508,44509,59244,59243,33602,33603,60450,33604,45904,56320,44165,43672,30349,30343,43871,48050,44162,44163,48023,44164,44160,44161,48017,56333,48093,48112,48129,45444,45445,45447,43291,51361,43406,45790,43279,56806,43277,45036,33599,45348,47756,46348,46299,47944,33583,56769,47128,43372,43499,49961,57460,51035,45406,47374,48094,35071,45915,60822,47143,43587,60823,43543,60824,37927,60826,40088,60827,46727,56987,54931,60544,56756,43853,51532,60856,43274,54773,43227,44533,44536,44538,51968,44540,44532,44539,44535,44537,45222,38729,51964,51897,43642,45221,45223,44632,46228,43636,43849,44676,43402,42922,45820,43667,45770,44664,45824,45829,47239,52850,48032,54779,43540,43245,43578,43638,39023,43907,43615,49992,43412,37566,50299,45815,45115,39230,45078,35913,44132,41509,44133,48089,42333,60454,40223,46694,35912,47978,46827,44366,44369,45994,43661,43518,44628,52251,42331,43843,42835,43282,51993,46860,45661,56317,56318,47626,60311,52493,46859,51153,46857,54402,54403,45660,59041,54404,45662,56728,56730,47620,47627,44159,57306,47624,57307,52699,60576,52689,59379,56772,44154,44155,44156,47621,44158,44153,44157,44144,44145,44146,44148,44149,44147,44151,44152,43975,60526,60513,47800,49920,31691,53840,52180,51496,42183,43807,43228,43252,43253,60436,43544,43269,43489,43918,47646,47648,47649,42330,49133,47275,47647,56576,46447,53589,59653,47989,59236,58493,52735,39410,43651,59183,52691,52368,45394,44889,47816,45384,45400,45386,45385,45393,45396,45389,45390,45395,45391,45399,45387,45392,47814,47815,45398,47819,45397,59694,44287,52654,46728,38121,42445,43875,46640,43834,47996,43868,47577,40249,54662,49549,43366,53726,53727,53728,43801,44016,48031,52610,48114,48014,45526,45527,45531,44699,44015,42761,45528,45529,45530,42760,45246,58323,57931,48015,52495,48062,47525,43652,56336,43794,43659,52627,48123,58295,43365,47566,57801,45523,57286,59180,52836,52494,45206,59098,47567,59262,58869,55657,45525,45703,47025,60554,59620,59621,43836,43863,43264,52695,56798,60515,60516,43644,43212,43864,60257,43509,46305,43579,43362,55531,30267,47267,52651,43361,46865,46867,46870,45458,46872,46871,46868,44924,33703,44925,43597,35691,45862,46864,41417,38312,46866,47606,46869,47608,44033,44741,9868,44032,48751,48749,59383,59384,44947,47604,47607,30060,48750,48102,46698,60848,51760,51758,51759,52265,44620,56334,59381,55226,43824,43384,43564,40484,57462,59024,39677,45705,43410,45781,56319,43915,47438,47971,48110,43278,59693,46150,43831,43221,43383,43803,43881,43882,43883,43884,43885,43887,45035,43225,43581,43281,9955,43250,43390,43275,47218,47219,43584,45047,45847,45846,44517,43681,43379,43309,44177,47576,45013,45018,45015,45020,45023,45022,45021,45019,45014,45016,47955,48077,43920,50050,48005,59032,43287,39754,47611,46588,43319,43320,52626,48109,43795,38398,47451,56807,43839,46322,47509,57629,59877,47450,47240,43820,43376,43219,43668,47730,52835,47464,52633,45460,52713,59875,53624,44441,45448,44447,44449,57417,47731,45978,46907,41079,41081,44440,44444,52631,44446,44445,44448,59366,50343,43640,47462,45975,47548,45997,43648,52479,44744,46276,43449,43454,47279,52706,45704,51274,43375,46279,42967,33671,43865,46157,47225,33792,41494,45365,43620,43859,47023,60797,46767,52624,59967,46392,55856,40273,9949,52523,52583,52753,53575,44294,44298,54061,60557,58048,56315,47866,60032,44293,44300,44297,44296,44295,55746,57219,43653,43396,59391,56337,53251,53249,60818,59368,59367,43271,52917,47122,60234,44534,42457,42458,49116,42464,43243,43495,43854,43914,33706,42465,43246,43664,43647,45816,48072,43266,48096,45079,44282,44283,44285,44286,44280,59042,57078,44278,44279,52060,45524,43580,43958,45687,52716,47723,48128,43545,45347,52632,43215,44743,45344,45345,49814,47270,55738,42466,47061,52655,43842,60691,43462,42329,43469,49908,58086,47235,47940,60851,49907,33756,52712,45350,50572,45916,50293,50294,45404,39130,56323,39138,39129,39140,33465,43675,43860,39133,43363,43369,39121,39132,39136,39139,39122,39123,39137,43837,45774,39124,39125,45773,39126,39127,39135,39131,39128,49205,46910,44639,43658,43270,43846,59695,60246,45834,35641,43536,43503,43525,43632,30268,43367,43399,44742,42550,44606,43772,44053,43394,43840,48866,45699,43203,43358,45893,47573,48076,44374,38537,43513,43867,41475,43906,43908,43510,43612,48003,43395,48004,45683,43571,9902,45764,38538,45756,45765,45762,45763,45755,45766,45757,43241,45759,43847,47776,48013,45758,48002,45760,44625,56590,56578,50025,51382,57480,59977,58322,56322,47572,52715,52697,59043,57439,57929,60558,57372,59291,58537,54312,58696,57314,56273,58751,55585,55586,58859,59301,49490,51665,50422,58145,43020,58144,56994,10132,14359,54944,49616,51824,35442,53027,34500,33272,30534,52844,60582,60583,60586,60589,60590,60591,60611,51974,48502,50235,51903,43600,41912,46925,43434,50405,60828,60849,50440,60877,53447,51389,40632,58134,51387,51152,41919,42293,60191,49818,49774,49717,53205,49567,49566,60279,53029,53028,54287,49558,60426,59662,59631,44076,44060,48874,49984,43321,48868,56729,60560,48536,60562,60563,60565,60566,60567,60568,60569,60570,60571,60572,60574,50234,60577,60578,60579,60988,60624,60057,60725,60735,49794,29605,46261,46339,46049,46369,46844,44175,47495,47496,44707,45889,44882,46909,46528,47946,43899,44834,43909,46462,44689,44692,44691,47105,46918,44490,44875,44489,45751,44393,44394,44395,44396,44397,45214,46520,47011,46216,46214,46503,45104,45105,44464,45879,45208,44477,47993,44478,46362,46072,45850,45430,46203,44866,45094,47152,44650,47304,46882,45093,46331,46332,46329,46361,46330,45028,48037,47085,47580,48082,45120,46340,46201,45469,47191,46028,44495,44496,46271,47933,44475,46453,45038,44958,44637,45533,44959,45545,48105,44788,46457,44949,57079,44687,44580,46817,44831,44832,58561,47286,46967,44914,47352,47568,44816,46073,47746,45948,60931,44746,60902,44870,44797,45876,44842,44844,47083,47753,47696,44843,44695,46709,47697,45233,45234,45235,45953,46741,47977,45232,47774,47182,47183,47545,47671,47584,45037,47970,44948,46756,47845,55104,47846,46156,46755,44460,44461,44463,44462,51642,46594,45088,46343,46591,46159,45971,47288,47446,47445,45785,54536,46590,46592,46189,47719,47720,47447,47088,47767,47453,47454,47455,45976,44365,46336,47578,47867,46347,46750,50168,46643,53218,46749,46751,46752,44765,46644,46548,46738,45494,46675,45930,47926,45205,48066,61420,44821,44581,46678,46564,46990,44897,46563,59753,47227,47092,46757,46403,46583,47226,55219,44473,44474,46176,44656,45969,46273,45686,43955,47358,45033,43505,47869,45432,47394,47958,47707,45957,47392,43340,47393,45956,45024,47190,44833,47086,47735,47865,47669,45097,47264,44526,45857,44865,47755,46250,44820,47265,48055,47765,47237,46183,47810,44826,44467,47515,53593,47056,45081,47030,45215,45467,45981,47443,47504,45329,47503,47736,47442,48012,46747,47836,46385,47501,44979,44713,47112,54576,54575,46958,43961,55266,47353,45750,45985,46927,45479,46929,46932,45064,45065,46164,46398,46396,46530,46399,43953,47155,46933,46926,47557,46931,46928,46388,46969,46389,55196,45175,55066,46744,47563,44969,44542,45726,45180,45119,48048,45413,45408,45410,45412,47857,45411,47761,44696,44697,47524,45407,47832,47831,47171,49967,47751,43572,47513,47115,48069,46797,44717,44721,44720,44718,44719,47181,48091,48025,44927,47668,44928,47142,44929,44926,45700,47909,47922,47905,46178,44686,46059,46753,45912,49966,45914,47516,48053,47371,46151,47906,47907,46599,47910,47911,45225,45224,45891,45181,47732,45034,61212,47342,53669,60934,44869,47835,46717,47760,48065,47428,57932,44635,46020,44636,44868,44468,55981,43960,46761,45492,46469,46748,45311,45851,45853,44576,44577,45096,45852,45203,47228,45113,46794,44965,44967,44966,46043,46619,44382,44915,47094,44922,46304,44918,44917,47924,47456,44916,46539,44919,46771,44923,44920,46737,43633,47132,60713,45331,45332,45330,46770,45691,46772,45692,45693,45694,44786,43944,61030,47891,46246,45966,60272,47808,45481,47853,44747,47360,46596,46237,43956,44685,47147,47486,47594,48056,48074,45831,45832,45833,47801,45855,46479,47172,47492,47193,46372,45871,47908,46714,43654,45236,45027,45026,46236,44978,46167,47555,43962,47672,46823,53674,44166,45059,51963,46937,44573,44574,47082,44655,46793,45189,44951,44492,46519,45063,45685,44970,44170,44466,47535,46789,43322,43964,45727,60455,60456,47711,46759,45367,44505,45984,45368,44825,46494,46495,46496,51965,44896,55257,47116,47791,52908,53032,46769,47457,44921,46344,44836,45039,45932,47140,44787,45811,44476,44722,45695,45924,43950,44373,46876,43952,47280,47517,60706,58377,47157,44880,47300,47340,45101,45098,45099,55980,45100,47458,46052,46736,55600,47009,47327,47018,46269,47864,47613,48111,57081,45116,48038,45919,45490,55982,47477,60927,45083,46429,43459,46935,47145,46288,46117,47013,47211,46319,47209,44898,45980,51640,48021,47296,46211,44649,47740,46687,47320,47662,45922,60809,47208,46475,47855,46179,45883,47945,47297,45046,46207,46502,44351,43825,47701,47067,46060,45968,46712,46414,49960,46531,52065,47532,47997,47863,44974,44977,44973,47888,46046,46478,46713,45439,46341,45436,47174,47850,44976,45438,47534,47851,47533,45882,46553,47104,44031,44790,54529,47985,44857,48071,48067,46742,44911,51967,61042,47199,47201,47200,46524,46646,51655,51656,46832,60901,46525,47764,46834,45974,45730,45409,46405,46522,58899,57385,46862,47530,47484,46913,44734,47497,47452,47459,45041,47498,47569,55105,61090,44798,44799,47003,47887,46053,45173,45174,44984,54557,47992,46253,44733,44732,44729,44727,46456,44728,44943,44912,45060,45114,44171,47084,46790,47490,47741,46210,47217,55059,46446,57952,46345,48006,45898,44402,44403,45881,43966,47024,44975,45437,47702,46445,45501,61303,46540,46541,47893,46050,45339,47690,45355,45357,45363,45358,45216,45906,46360,45362,45359,48070,45356,46045,45678,47859,47693,47770,47773,47772,46512,44678,48011,46947,47749,46945,46950,46559,45709,45710,47771,45708,44766,45260,44854,46707,44964,44963,46353,46944,52371,52369,52370,43311,43312,43655,45328,43448,45188,44830,44675,48115,45796,44855,46297,46313,45793,45797,46312,46039,45795,46048,46051,46311,44035,45870,47849,46514,47321,47322,44653,46270,45176,44899,47021,45960,45958,45124,46994,45931,46623,47302,47055,47066,44705,46374,47974,44779,45066,44960,47858,46527,45988,50320,46788,46904,47101,47488,46796,47694,53048,44693,45907,43504,53046,45361,45092,45401,45402,59887,44753,44755,43968,47520,47941,47956,47880,47476,44670,45149,47879,46837,45475,48057,46013,45049,45050,45052,45415,44740,44167,45141,45801,45800,45802,45341,45327,47343,45799,47380,47378,47885,45315,45314,56593,47841,47138,47721,47809,47708,47379,47258,47259,46732,47079,46054,48054,47884,48047,47356,47655,45075,45067,44668,55462,46292,56594,44794,46521,45856,45959,44488,43910,47763,46220,45197,46221,44622,44623,44885,44887,46223,46224,45886,45431,44878,44876,47213,45476,45897,47975,46939,47842,47325,44759,45473,46854,47837,55895,54533,45403,46855,46856,47251,44469,44472,44470,44471,44851,45369,45370,55898,47734,46745,44610,44609,44612,49399,44613,44614,44611,47575,45818,45220,47369,56332,45051,45201,46731,44935,45720,48046,47935,47248,47156,43903,47718,46378,44681,57387,44877,44886,48420,44645,45474,44863,45142,52926,44895,46070,55132,46204,48061,49968,47807,46413,47170,60986,60985,47169,48034,46740,60825,47212,44465,47293,47896,47894,47806,48042,46144,45901,45900,44861,44860,43535,43976,44723,46268,43610,44739,46148,47526,48080,46580,46582,46578,46581,45238,45239,47828,45237,47328,45986,49971,48104,46579,47249,45107,46577,46016,46912,44179,47272,47829,47127,47125,47552,48049,46212,46175,47146,44950,47126,46068,47124,51303,44712,45964,51250,51631,51686,51302,45313,48028,46410,46302,46811,46532,46879,46881,47012,44952,47121,46880,46861,46936,47875,47892,47349,44770,44771,44772,44777,44778,44773,44774,44782,44781,44769,44349,45664,45668,45676,47929,45667,45509,45504,45512,45505,45508,45511,45513,45507,45506,45510,45434,51687,45433,45502,51688,45435,45892,43256,43257,58960,43255,58962,58959,43967,44862,47762,44907,44906,44909,46023,46035,46032,46026,46029,46036,47518,46025,46027,47519,46024,46031,46033,46034,46030,53776,45480,47830,46290,55897,43941,46173,45085,56595,46229,47876,46296,61043,47329,46257,46365,47994,46370,43456,45464,45925,47544,45465,47362,46966,45503,47359,47821,47961,47582,46449,44654,48163,46162,46451,46452,47820,48008,44867,44936,47822,47823,47824,47588,47825,47826,47827,46450,45466,48007,47130,60898,48079,47990,45500,45497,45498,45495,46141,47245,45496,47246,45499,47339,44550,44546,44547,44548,47593,44551,44552,44553,44554,44555,44556,44557,44558,47068,46600,44559,46873,56033,47010,47489,47448,44823,45072,44731,47754,47449,47654,46992,46716,45484,47860,46401,46402,47029,46718,46719,47714,47716,46700,46699,46400,45335,45337,46061,55979,47706,48030,47717,45721,45723,45724,45722,47902,46386,61214,46835,46437,46886,46888,43377,45979,45928,45926,46565,47324,45927,56129,56132,46474,45190,46764,46351,47386,44582,47900,46047,47998,46275,47178,45095,48214,44677,47522,46461,46760,46233,57780,46230,46231,57788,57799,57752,46232,57765,57771,57701,57710,46954,45198,56674,46773,56941,45326,47247,44910,57960,47843,44900,60997,45073,52210,47469,45977,47505,46254,46507,45934,47541,47684,48044,47110,45945,55543,60928,60929,60930,45148,47291,46430,59824,47658,60758,47659,50319,48020,47750,48085,45056,46896,46914,46916,58483,45872,45226,45192,44849,46915,46368,47241,60903,46286,60905,46968,60906,60907,60904,44946,44803,44806,44800,44801,44802,56058,43460,46227,47117,47284,47118,46056,44953,47758,46547,55067,55068,46951,43945,46239,45929,46511,45952,60900,44502,47323,47862,46441,47861,56919,43329,43823,46127,46626,44666,44665,43877,43297,45032,44980,57305,44499,47368,46063,47934,47629,46729,46460,60998,45805,55896,46205,53102,46754,47290,47739,47768,48081,46258,46263,44292,47001,47553,43965,46919,60208,46952,47856,46838,46301,44019,44020,44021,44289,46897,45147,46537,44725,45848,43458,46320,47065,44457,44454,44456,44455,44458,46557,44459,47149,46058,44704,46384,46831,46830,44972,44168,44169,46285,45111,44652,47682,51966,45449,47883,46315,45738,45736,45734,45740,46354,45747,52378,45735,45748,45743,45741,45733,47703,45737,47729,45746,45739,45744,47017,47298,45012,46057,46278,47345,46746,45909,46098,47664,47667,47665,46726,47868,46724,44810,44813,44814,44811,44812,47663,55261,44815,46723,46165,46725,46425,47153,47745,54546,47072,47073,47959,45241,45194,43317,44748,43904,44737,43946,46346,44736,43337,44680,45967,44795,47798,47799,45874,45091,44827,46959,47078,45089,47136,45090,47581,46920,46921,44957,44971,47430,44890,46180,46597,46938,47077,47939,47215,46688,46627,53606,48086,43447,47076,45177,45178,45179,46065,45068,46689,46690,46691,46692,46693,46810,57221,58655,46595,45244,45483,47344,45360,51777,44494,46218,45749,46621,47583,45742,46722,46505,47928,46281,58907,46244,47436,46942,46943,45333,45334,61302,44657,47698,45963,46996,47276,47203,47333,47334,44872,47332,45155,46506,45151,45153,43949,45154,44903,44904,45152,46240,61044,47966,44188,47331,44651,44901,45944,47981,60820,48083,45240,46132,46137,46136,46138,43947,48029,46134,45242,46135,47370,45229,45230,45231,46133,47551,43959,46806,57386,47813,46566,47523,47812,46442,46152,46153,46274,43538,47854,46615,46526,45243,46427,46542,47558,44709,44708,47206,44711,45470,45471,46743,55118,55120,55119,48088,46064,54364,47243,47244,47315,46965,47314,47317,47318,44363,46500,44358,46055,46066,46499,47506,46467,43829,44724,44487,46843,47565,45121,45485,45962,45209,44962,47294,47571,46359,46074,44750,47277,44749,46139,47510,47089,46075,44688,47511,46513,46169,58916,58917,46549,58918,47337,44630,46889,47957,47564,46485,47336,45145,45146,45144,44850,47289,44710,50232,60899,47319,43344,55317,56287,55559,47278,57885,55624,47487,45143,61354,61352,53047,60587,51658,60592,52907,60581,60580,60588];
// айди с клуба https://shikimori.one/clubs/3810
  let ChinesefilterActive = false;
  function addChineseFilter() {
const categoryContainer = document.querySelector(".b-block_list.kinds.anime-params");
if (!categoryContainer) return;

const filterItem = document.createElement("li");
filterItem.setAttribute("data-field", "custom-filter");
filterItem.innerHTML = `
  <input id="filterAnimeCheckbox" autocomplete="off" type="checkbox" ${ChinesefilterActive ? "checked" : ""}>
  <label for="filterAnimeCheckbox">Без китайщины</label>
`;

categoryContainer.appendChild(filterItem);

document.getElementById("filterAnimeCheckbox").addEventListener("change", function () {
  ChinesefilterActive = this.checked;
  applyChineseFilter();
});

if (ChinesefilterActive) applyChineseFilter();
  }

  function applyChineseFilter() {
document.querySelectorAll("article.c-anime").forEach((article) => {
  const animeId = parseInt(article.id, 10);
  if (ChinesefilterActive && ChineseAnimeId.includes(animeId)) {
    // console.log(`Китайщина - ${animeId}`);
    article.remove();
  }
});
  }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  function ShikiRating() {
  const filtersContainer = document.querySelector(".b-block_list.orders.anime-params.subcontent");
  if (!filtersContainer) return;

  const ShikiSort = document.createElement("li");
  ShikiSort.setAttribute("data-field", "order");
  ShikiSort.setAttribute("data-value", "score_2");

  ShikiSort.innerHTML = `По рейтингу (Шикимори)`;

  const referenceElement = filtersContainer.querySelector('li[data-field="order"][data-value="ranked"]');

  if (referenceElement) {
    filtersContainer.insertBefore(ShikiSort, referenceElement.nextSibling);
  } else {
    filtersContainer.appendChild(ShikiSort);
  }
  }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


//AUTO SPOILER//AUTO SPOILER//AUTO SPOILER//AUTO SPOILER//AUTO SPOILER//AUTO SPOILER//AUTO SPOILER//AUTO SPOILER//AUTO SPOILER//AUTO SPOILER//AUTO SPOILER//AUTO SPOILER//AUTO SPOILER//AUTO SPOILER//AUTO SPOILER
  function autoSpoiler() {
    function spoiler(images) {
      const spoilerDiv = document.createElement("div");
      spoilerDiv.className = "b-spoiler_block";
      spoilerDiv.dataset.dynamic = "spoiler_block";

      const spoilerText = document.createElement("span");
      spoilerText.tabIndex = 0;
      spoilerText.textContent = "Image";
      spoilerText.addEventListener("click", () =>
        spoilerDiv.classList.toggle("is-opened")
      );

      const imagesContainer = document.createElement("div");
      images.forEach((img) => imagesContainer.appendChild(img));

      spoilerDiv.append(spoilerText, imagesContainer);
      return spoilerDiv;
    }

    function group(comment) {
      const body = comment.querySelector(".body");
      let images = [];
      Array.from(body.childNodes).forEach((node) => {
        if (
          node.nodeType === Node.ELEMENT_NODE &&
          node.classList.contains("b-image")
        ) {
          images.push(node);
        } else if (images.length > 0) {
          body.insertBefore(spoiler(images), node);
          images = [];
        }
      });
      if (images.length > 0) body.appendChild(spoiler(images));
    }

    function processComments() {
      document.querySelectorAll(".b-comment").forEach(group);
    }

    processComments();
  }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


//AUTO LOADER////AUTO LOADER////AUTO LOADER////AUTO LOADER////AUTO LOADER////AUTO LOADER////AUTO LOADER////AUTO LOADER////AUTO LOADER////AUTO LOADER////AUTO LOADER//
  let isLoading = false;
  let currentPage = 15;
  let currentUrl = "";
  function updatePagination() {
    const currentSpans = document.querySelectorAll(".pagination .link-current");
    if (currentSpans.length > 0) {
      currentSpans.forEach((span) => {
        span.textContent = `1-${currentPage + 1}`;
      });
    }
  }
  function loadNextPage() {
    if (isLoading) return;

    const nextButton = document.querySelector(".b-postloader.collapsed a.next");
    if (!nextButton) return;

    if (currentUrl && currentUrl !== nextButton.href) {
      currentPage = 15;
    }
    currentUrl = nextButton.href;
    const urlObj = new URL(nextButton.href);
    urlObj.pathname = urlObj.pathname.replace(/\/page\/\d+/,`/page/${currentPage + 1}.json`);
    let nextPageUrl = urlObj.toString();

    console.debug("Loading next page: ", nextPageUrl);
    isLoading = true;

    GM_xmlhttpRequest({
      method: "GET",
      url: nextPageUrl,
      headers: {
        Accept: "application/json, text/plain, */*",
        "X-Requested-With": "XMLHttpRequest",
      },
      onload: function (response) {
        if (response.status === 200) {
          try {
            const data = JSON.parse(response.responseText);
            if (data.content) {
              const tempContainer = document.createElement("div");
              tempContainer.innerHTML = data.content;
              const entries = tempContainer.querySelectorAll(
                ".cc-entries article"
              );
              appendNewContent(entries);
              updatePagination();
              currentPage++;
            }
          } catch (e) {
            console.error(e);
          }
        } else {
          console.error(response.status);
        }
        isLoading = false;
      },
      onerror: function (error) {
        console.error(error);
        isLoading = false;
      },
    });
  }
  function appendNewContent(entries) {
    const containers = document.querySelectorAll(".cc-entries");
    if (containers.length === 0) return;
    const container = containers[containers.length - 1];
    const existingIds = new Set(
      [...container.querySelectorAll("article")].map((el) => el.id)
    );
    entries.forEach((entry) => {
      if (!existingIds.has(entry.id)) {
        container.appendChild(entry);
      }
    });
  }
  function checkScroll() {
    const nextButton = document.querySelector(
      ".b-postloader.collapsed a.next"
    );
    if (!nextButton || !nextButton.href.match(/\/page\/16(\?|$)/)) return;

    if (
      window.innerHeight + window.scrollY >=
      document.documentElement.scrollHeight - 300
    ) {
      loadNextPage();
    }
  }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


//Watch TIME//Watch TIME//Watch TIME//Watch TIME//Watch TIME//Watch TIME//Watch TIME//Watch TIME//Watch TIME//Watch TIME//Watch TIME//Watch TIME//Watch TIME//Watch TIME//Watch TIME//Watch TIME//Watch TIME//Watch TIME//Watch TIME//Watch TIME//Watch TIME
  async function watchTime() {
  if (!аnimPage()) {
    return;
  }
  try {
    const episodesElement = elementFinder(document, "Эпизоды");
    const durationElement = elementFinder(document, "Длительность эпизода");

    if (!episodesElement || episodesElement.textContent.trim() === "") {
      return;
    }

    let episodes = episodesElement.textContent.trim();
    const duration = durationElement? durationElement.textContent.trim(): "Неизвестно";

    const duratonM = parseDur(duration);
    if (duratonM && episodes !== "Неизвестно") {
      const totalTime = parseInt(episodes) * duratonM;

      if (!document.querySelector(".time-block")) {
        const timeBlock = document.createElement("div");
        timeBlock.classList.add("line", "time-block");
        timeBlock.innerHTML = `
                  <div class="key">Время просмотра:</div>
                  <div class="value"><span>${formatTime(
                    totalTime
                  )}</span></div>
              `;

        if (durationElement && durationElement.parentNode) {
          durationElement.parentNode.parentNode.appendChild(timeBlock);
        }
      }
    }
  } catch (error) {
  //   console.error(error);
  }
  }
  function elementFinder(doc, keyText) {
  const lines = doc.querySelectorAll(".b-entry-info .line-container .line");
  for (let line of lines) {
    const key = line.querySelector(".key");
    if (key && key.textContent.includes(keyText)) {
      return line.querySelector(".value");
    }
  }
  return null;
  }
  function parseDur(durationText) {
  const hoursMatch = /(\d+)\s*час/.exec(durationText);
  const minsMatch = /(\d+)\s*мин/.exec(durationText);

  return (hoursMatch ? parseInt(hoursMatch[1]) * 60 : 0) +
         (minsMatch ? parseInt(minsMatch[1]) : 0);
  }
  function rotEbal(number, one, two, five) {
const n1 = Math.abs(number) % 10;
if (number > 10 && number < 20) return five;
if (n1 > 1 && n1 < 5) return two;
if (n1 === 1) return one;
return five;
  }
  function formatTime(totalMins, zero = false) {
  const days = Math.floor(totalMins / (24 * 60));
  const hours = Math.floor((totalMins % (24 * 60)) / 60);
  const mins = totalMins % 60;

  const dayText = rotEbal(days, "день", "дня", "дней");
  const hourText = rotEbal(hours, "час", "часа", "часов");
  const minsText = rotEbal(mins, "минута", "минуты", "минут");

  if (zero) {
    return `${days} ${dayText}, ${hours} ${hourText}, ${mins} ${minsText}`;
  } else {
    let result = "";
    if (days > 0) result += `${days} ${dayText}, `;
    if (hours > 0 || days > 0) result += `${hours} ${hourText}, `;
    result += `${mins} ${minsText}`;
    return result.trim();
  }
  }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function removeBlur() {
  const censoredImages = document.querySelectorAll('img.is-moderation_censored');

  censoredImages.forEach(img => {
    img.classList.remove('is-moderation_censored');
  });
}

  function domObserver () {
    const observer = new MutationObserver(() => {
      if (config.CommCopyBtn) CommCopyBtn();
      if (config.HistoryHelper) HistoryHelper();
      if (config.NotificationHelper) NotificationHelper();
      if (config.autoSpoiler) autoSpoiler();
      if (config.hideNews) hideNews(blockedUsers);
      if (config.ImageIdCopyBtn) ImageIdCopyBtn();
      if (ChinesefilterActive) applyChineseFilter();
      if (config.removeBlur) removeBlur();
    });
    observer.observe(document.body, { childList: true, subtree: true });
  }

  function ready(fn) {
    document.addEventListener("page:load", fn);
    document.addEventListener("turbolinks:load", fn);
    if (document.readyState !== "loading") {
      fn();
    } else {
      document.addEventListener("DOMContentLoaded", fn);
    }
  }

  ready(() => {
    if (config.StudioFilter) StudioFilter();
    if (config.CommCopyBtn) CommCopyBtn();
    if (config.UserIdCopyBtn) UserIdCopyBtn();
    if (config.HistoryHelper) HistoryHelper();
    if (config.NotificationHelper) NotificationHelper();
    if (config.UserCssCopyBtn) UserCssCopyBtn();
    if (config.ClubCssCopyBtn) ClubCssCopyBtn();
    if (config.FriendsAVGscore) FriendsAVGscore();
    if (config.autoSpoiler) autoSpoiler();
    if (config.ShikiRating) ShikiRating();
    if (config.hideNews) hideNews(blockedUsers);
    if (config.NoAgeLimits) NoAgeLimits();
    if (config.ImageIdCopyBtn) ImageIdCopyBtn();
    if (config.checkScroll && allowedPaths.some(path => location.pathname.startsWith(path))) {window.addEventListener('scroll', checkScroll);checkScroll();}
    if (config.addChineseFilter) addChineseFilter();
    if (config.BanCount) BanCount();
    if (config.watchTime) watchTime();
    if (config.removeBlur) removeBlur();

    domObserver ();
  });


})();