Sleazy Fork is available in English.

CoomerBtn

Adds a small button next to username handles on Onlyfans and Fansly that points to that users profile at Coomer.su

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         CoomerBtn
// @namespace    http://tampermonkey.net/
// @version      2024-06-18
// @description  Adds a small button next to username handles on Onlyfans and Fansly that points to that users profile at Coomer.su
// @author       You
// @match        https://onlyfans.com/*
// @match        https://fansly.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=coomer.su
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    if(location.host !== 'onlyfans.com' && location.host !== 'fansly.com') return;

    const ofUsernameSelector = '.g-user-username';
    const fanslyUsernameSelector = 'span.user-name';
    const selector = location.host === 'onlyfans.com' ? ofUsernameSelector : fanslyUsernameSelector
    const baseURL = location.host === 'onlyfans.com' ? 'https://coomer.su/onlyfans/user/' : 'https://coomer.su/fansly/user/';
    const fanslyUIDCache = [];

    const addButton = async el => {
        if(el.querySelector('.coomer-btn')) return;

        const img = document.createElement('img');
        img.setAttribute('src', 'https://coomer.su/favicon.ico');
        img.height = 20;
        img.width = 20;

        const link = document.createElement('a');
        link.setAttribute('class', 'coomer-btn');
        link.appendChild(img);
        el.appendChild(link);

        let username = el.textContent.trim().slice(1).toLowerCase();

        if(location.host === 'fansly.com'){
            try{
                username = await getFanslyUID(username);
            }catch(err) {
                console.error('CoomerBtn', err); // will still fall back to the username, although coomer.su will likely 404.
            }
        }

        link.setAttribute('href', baseURL + username);
    }

    const getFanslyUID = async username => {
        const cached = fanslyUIDCache.find(user => user.username === username);

        if(cached){
            return cached.uid;
        }

        const res = await fetch('https://apiv3.fansly.com/api/v1/account?usernames=' + username + '&ngsw-bypass=true');
        const json = await res.json();

        console.log(json);

        const uid = json.response[0].id
        fanslyUIDCache.push({username, uid})

        return uid;
    }

    const observer = new MutationObserver(muts => {
        muts.forEach(mut => {
            if(mut.target.matches(selector)){
                addButton(mut.target);
            }

            mut.addedNodes && mut.addedNodes.forEach(node => {
                if(node.matches && node.matches(selector))
                    addButton(node)
                else{
                    if(node.nodeType === Node.TEXT_NODE || node.nodeType === Node.COMMENT_NODE) return;
                    const final = node.querySelectorAll(selector);
                    final.forEach(child => addButton(child));
                }
            });
        })
    });



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