NRTool: CGF Link

Adds a CamGirlFinder link

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==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();
})();