Motherless strikethrough

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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

})();