NRTool: CGF Link

Adds a CamGirlFinder link

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         NRTool: CGF Link
// @namespace    zcb_dev
// @version      1.2
// @license      MIT
// @description  Adds a CamGirlFinder link
// @author       zcb22
// @match        https://*.nrtool.to/nrtool/history/*/*/*
// @grant        none
// @run-at       document-idle
// @icon         https://www.google.com/s2/favicons?sz=64&domain=nrtool.to
// ==/UserScript==

(function () {
    'use strict';

    // Domain lock for safety
    if (!location.hostname.includes('nrtool.to')) return;

    // Platform mapping for URL compatibility
    const PLATFORMS = {
        'cb': 'cb',
        'bc': 'bc',
        'sc': 'sc',
        'cam4': 'c4',
        'f4f': 'f4f',
        'cs': 'cs'
    };

    /**
     * Main injection logic
     */
    const inject = () => {
        //Avoid duplicate injection
        if (document.querySelector('.nr_cgf_link')) return;

        // Extract platform and model from URL safely
        const pathParts = window.location.pathname.split('/').filter(Boolean);
        // Expected path: /nrtool/history/{platform}/{model}
        if (pathParts.length < 4) return;

        const platKey = pathParts[2];
        const modelName = pathParts[3];

        // Find the .forum_link to use as an anchor
        const anchor = document.querySelector('.forum_link');

        // Validate and inject
        if (PLATFORMS[platKey] && modelName && anchor) {
            const targetUrl = `https://camgirlfinder.net/models/${PLATFORMS[platKey]}/${encodeURIComponent(modelName)}#1`;

            // Inserting the link with native styling and a small margin
            anchor.insertAdjacentHTML('beforeend', `
                <span class="forum_link__sep">·</span>
				<a href="${targetUrl}" class="nr_cgf_link target="_blank" rel="noopener noreferrer">[CGF]</a>
            `);
        }
    };
    // Execute immediately on document-idle
    inject();
})();