Motherless strikethrough2

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

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

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