Motherless strikethrough2

3/31/2026, 9:54:57 PM

スクリプトをインストールするには、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        Motherless strikethrough2
// @namespace   Violentmonkey Scripts
// @match        https://motherless.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=motherless.com
// @grant       none
// @version     1.2
// @license     MIT
// @author      tittaayy
// @description 3/31/2026, 9:54:57 PM
// ==/UserScript==

(function () {
  const STORAGE_KEY = "markedLinkIDs";
  const SELECTORS = "a.caption.title.pop.plain, a.img-container, a.img-strip-overlay, div.media-meta-title";

  // --- Data Management ---
  const getIDs = () => JSON.parse(localStorage.getItem(STORAGE_KEY) || "[]");
  const saveIDs = (ids) => localStorage.setItem(STORAGE_KEY, JSON.stringify(ids));

  function toggleID(id) {
    let ids = getIDs();
    const index = ids.indexOf(id);

    if (index > -1) {
      ids.splice(index, 1); // Removes specific ID
      console.log("Removed:", id);
    } else {
      ids.push(id); // Adds ID
      console.log("Added:", id);
    }
    saveIDs(ids);
    applyStyles();
  }

  // --- UI Logic ---
  function applyStyles() {
    const ids = getIDs();
    /* Get all from AI script, using CSS selectors. */
    document.querySelectorAll(SELECTORS).forEach(el => {
      const href = el.getAttribute("href") || "";
      const last7 = href.slice(-7);
      const isMarked = ids.includes(last7);

      // Set styles based on marked status (Reset to defaults if not marked)
      el.style.opacity = isMarked ? "0.5" : "1";
      if (isMarked) {
        el.style.setProperty("text-decoration", "line-through", "important");
      } else {
        el.style.removeProperty("text-decoration");
      }
    });
    /* Do similar for H1 title, so it shows up when on the page for the image or video. */
    const last7URL = (location.pathname).slice(-7);
    const isMarkedURL = ids.includes(last7URL);
    document.querySelectorAll("h1").forEach(el => {
      el.style.opacity = isMarkedURL ? "0.5" : "1";
      if (isMarkedURL) {
        el.style.setProperty("text-decoration", "line-through", "important");
      } else {
        el.style.removeProperty("text-decoration");
      }
    });
  }

  // --- Event Handling ---
  document.addEventListener("click", (e) => {
    if (!e.altKey) return;

    const link = e.target.closest(SELECTORS);
    if (!link) return;

    e.preventDefault();
    const last7 = link.getAttribute("href")?.slice(-7);
    if (last7) toggleID(last7);
  });

  // Initial Run
  applyStyles();
})();