NRTool: CGF Link

Adds a CamGirlFinder link

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

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