Motherless strikethrough

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

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

// ==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();
  });

})();