Copy okgg VLESS Node Info

Copy node information to VLESS link

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Copy okgg VLESS Node Info
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Copy node information to VLESS link
// @author       Your Name
// @match        *://*.okgg.top/*
// @grant        GM_setClipboard
// ==/UserScript==

(function() {
    'use strict';

    function createCopyButton() {
        const button = document.createElement('button');
        button.textContent = '复制节点信息';
        button.style.position = 'fixed';
        button.style.top = '10px';
        button.style.right = '10px';
        button.style.zIndex = '9999';
        button.style.backgroundColor = '#4CAF50';
        button.style.color = 'white';
        button.style.border = 'none';
        button.style.padding = '10px';
        button.style.cursor = 'pointer';
        button.onclick = copyNodeInfo;
        document.body.appendChild(button);
    }

    function copyNodeInfo() {
        const tip = document.querySelector('.node-tip.cust-model.cust-modelin.fade-delay');
        if (!tip || tip.style.display === 'none') {
            alert('没有找到节点信息弹窗');
            return;
        }

        const protocol = tip.querySelector('.nodename').textContent.trim();
        const type = getValueFromTip(tip, '类型 Protocol');
        const name = getValueFromTip(tip, '名字 Name');
        const address = getValueFromTip(tip, '地址 Address');
        const userId = getValueFromTip(tip, '用户Id ID');
        const flow = getValueFromTip(tip, '流控 Flow');
        const port = getValueFromTip(tip, '端口 Port');
        const encryption = getValueFromTip(tip, '加密 Encryption');
        const network = getValueFromTip(tip, '传输协议 Network');
        const typeMasquerade = getValueFromTip(tip, '伪装类型 Type');
        const host = getValueFromTip(tip, '伪装 Host Quic加密方式');
        const tls = getValueFromTip(tip, 'Tls传输');
        const fingerprint = getValueFromTip(tip, 'FigerPrint 指纹');
        const sni = getValueFromTip(tip, 'SNI');

        const vlessLink = `vless://${userId}@${address}:${port}?type=${network}&security=${tls}&flow=${flow}&sni=${sni}&fp=${fingerprint}&host=${host}&type=${typeMasquerade}#${name}`;

        GM_setClipboard(vlessLink);
        alert('节点信息已复制');
    }

    function getValueFromTip(tip, label) {
        const element = Array.from(tip.querySelectorAll('p')).find(p => p.textContent.includes(label));
        return element ? element.querySelector('span').textContent.trim() : '';
    }

    createCopyButton();
})();