Motherless strikethrough

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

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name        Motherless strikethrough
// @namespace   Violentmonkey Scripts
// @match        https://motherless.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=motherless.com
// @grant       none
// @version     1.1
// @license     MIT
// @author      -
// @description 3/31/2026, 9:54:57 PM
// ==/UserScript==

(function () {
  const STORAGE_KEY = "markedLinkIDs";

  function getIDs() {
    return JSON.parse(localStorage.getItem(STORAGE_KEY) || "[]");
  }

  function saveIDs(ids) {
    localStorage.setItem(STORAGE_KEY, JSON.stringify(ids));
  }

  function addID(id) {
    const ids = getIDs();
    if (!ids.includes(id)) {
      ids.push(id);
      saveIDs(ids);
      console.log("Added:", id);
    }
  }

  function applyStyles() {
    const ids = getIDs();
    const links = document.querySelectorAll("a.caption.title.pop.plain");
    const links2 = document.querySelectorAll("a.img-container");

    links.forEach(a => {
      const href = a.getAttribute("href");
      if (!href) return;

      const last7 = href.slice(-7);

      if (ids.includes(last7)) {
        a.style.textDecoration = "line-through";
        //a.style.textDecorationColor = "red";
        a.style.opacity = "0.6";
        a.style.setProperty("text-decoration", "line-through", "important");
      }
    });
    links2.forEach(a => {
      const href = a.getAttribute("href");
      if (!href) return;

      const last7 = href.slice(-7);

      if (ids.includes(last7)) {
        a.style.textDecoration = "line-through";
        //a.style.textDecorationColor = "red";
        a.style.opacity = "0.6";
        a.style.setProperty("text-decoration", "line-through", "important");
      }
    });
  }

  // Apply on load
  applyStyles();

  // 👇 Click-to-mark mode (Alt+Click)
  document.addEventListener("click", function (e) {
    if (!e.altKey) return;

    link = e.target.closest("a.caption.title.pop.plain");
    if (!link) {
      link = e.target.closest("a.img-strip-overlay");
      if (!link) {
        link = e.target.closest("a.img-container");
        if (!link) return;
      }
    }

    e.preventDefault();

    const href = link.getAttribute("href");
    const last7 = href.slice(-7);

    addID(last7);

    link.style.textDecoration = "line-through";
    link.style.opacity = "0.6";
    //link.style.textDecorationColor = "red";
    link.style.setProperty("text-decoration", "line-through", "important");
    applyStyles();
  });

})();