Socialmediagirls pixeldrain use url bypass limit

it

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name                Socialmediagirls pixeldrain use url bypass limit
// @namespace           https://greasyfork.org/users/821661
// @match               https://forums.socialmediagirls.com/*
// @grant               GM.xmlHttpRequest
// @version             1.0
// @run-at              document-start
// @author              hdyzen
// @description         it
// @license             GPL-3.0-only
// ==/UserScript==

function bypassUrl(id) {
    return `https://pd.cybar.xyz/${id}`;
}

async function getIndividualIds(url) {
    const res = await GM.xmlHttpRequest({
        url: url,
    });

    return [...res.response.matchAll(/"id":"([^"]+)","name"/g)].map(e => e[1]);
}

async function processNode(node) {
    const url = node.dataset.url;
    const parts = url.split("/");
    const type = parts.at(-2);
    const id = parts.at(-1);

    if (type === "l") {
        const ids = await getIndividualIds(url);

        node.innerHTML = ids.map(e => `<a href="${bypassUrl(e)}">${bypassUrl(e)}</a>`).join("\n");
    } else {
        node.innerHTML = `<a href="${bypassUrl(id)}">${bypassUrl(id)}</a>`;
    }
}

function initObserver() {
    const handleMutations = async mutations => {
        for (const mutation of mutations) {
            for (const node of mutation.addedNodes) {
                if (node.nodeType === Node.ELEMENT_NODE && node.dataset.host === "pixeldrain.com") {
                    processNode(node);
                }
            }
        }
    };

    const observer = new MutationObserver(handleMutations);

    observer.observe(document.body || document.documentElement, {
        childList: true,
        subtree: true,
    });

    disObserver(observer);
}
initObserver();

function disObserver(observer) {
    document.addEventListener("DOMContentLoaded", e => {
        observer.disconnect();
    });
}