FapForFun | Images resize

Resize small images to big (up to 600x600)

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name            FapForFun | Images resize
// @namespace       http://tampermonkey.net/
// @version         1.0.0
// @description     Resize small images to big (up to 600x600)
// @author          ExtraLewd
// @match           https://fapforfun.net/archives/*
// @match           https://fapforfun.net/*
// @match           https://*.fapforfun.net/*
// @icon            https://fapforfun.net/favicon.ico
// @run-at          document-start
// @license         CC BY-NC-ND 4.0
// @license-url     https://creativecommons.org/licenses/by-nc-nd/4.0/
// @compatible      firefox
// @compatible      chrome
// @compatible      opera
// @compatible      safari
// @compatible      edge
// ==/UserScript==

(() => {
  // src/utils/dom.ts
  var imageHostingSelectors = [
    "img[src^='https://imgdrive.net/images/small/']",
    "img[src^='https://imgadult.com/upload/small/']",
    "img[src^='https://imgtaxi.com/images/small/']"
  ];
  var findImages = () => {
    return document.querySelectorAll(
      imageHostingSelectors.join(",")
    );
  };
  var waitForElement = (selector, timeout = 6e4 * 5) => {
    return new Promise((ok, fail) => {
      const interval = setInterval(() => {
        const el = document.querySelector(selector);
        if (el) {
          ok(el);
          clearInterval(interval);
          return;
        }
      }, 1e3);
      setTimeout(() => {
        clearInterval(interval);
        fail("Timeout");
      }, timeout);
    });
  };
  var attachObserver = async (select, callback) => {
    try {
      const search = await waitForElement(select);
      const observer2 = new MutationObserver(callback);
      observer2.observe(search, { childList: true, subtree: true });
      callback();
      return observer2;
    } catch (error) {
      console.error(error);
    }
  };

  // src/index.ts
  var bootstrap = async () => {
    await waitForElement(imageHostingSelectors.join(","));
    (await observer).disconnect();
    const images = findImages();
    for (const image of images) {
      image.referrerPolicy = "no-referrer";
      image.src = image.src.replace("/small/", "/big/");
      image.height = "600";
      image.width = "600";
    }
    (await observer).observe(document.body, { childList: true, subtree: true });
  };
  var observer = attachObserver("body", bootstrap);
})();