Motherless strikethrough2

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

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, Greasemonkey alebo Violentmonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, % alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey alebo Userscripts.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie správcu používateľských skriptov.

(Už mám správcu používateľských skriptov, nechajte ma ho nainštalovať!)

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

(Už mám správcu používateľských štýlov, nechajte ma ho nainštalovať!)

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