NRTool: CGF Link

Adds a CamGirlFinder link

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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();
})();