Motherless strikethrough2

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

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

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