Onlyfans Coomer.su

Adds a link to the user's profile in the specified menu

Από την 28/04/2024. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Onlyfans Coomer.su
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Adds a link to the user's profile in the specified menu
// @author       You
// @match        https://onlyfans.com/*
// @grant        none
// @license      Unlicense
// ==/UserScript==

(function() {
    'use strict';

    function getUsernameFromUrl() {
        const urlParts = window.location.pathname.split('/');
        const username = urlParts[1];
        return username;
    }

    function fetchUserProfile(username, retryCount = 0) {
        const apiUrl = `https://coomer.su/api/v1/onlyfans/user/${username}/profile`;

        fetch(apiUrl)
            .then(response => {
                if (!response.ok) {
                    if (response.status === 404) {
                        console.log(`User ${username} not found`);
                    } else {
                        throw new Error('Network response was not ok');
                    }
                }
                return response.json();
            })
            .then(data => {
                if (data) {
                    const profileUrl = `https://coomer.su/onlyfans/user/${username}`;
                    const menuElement = document.querySelector('.l-header__menu.m-native-custom-scrollbar.m-scrollbar-y.m-invisible-scrollbar');
                        const aElement = document.createElement('a');
                        aElement.setAttribute('href', profileUrl);
                        aElement.textContent = 'Coomer.su';
                        menuElement.appendChild(aElement);
                }
            })
            .catch(error => {
                if (retryCount < 5) {
                    console.log(`Retrying... Attempt ${retryCount + 1}`);
                    setTimeout(() => fetchUserProfile(username, retryCount + 1), 1000);
                } else {
                    console.error('Error fetching data:', error);
                }
            });
    }

    const username = getUsernameFromUrl();
    fetchUserProfile(username, 0);

})();