一键拷贝Cookie

Ck工具

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 or Violentmonkey 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         一键拷贝Cookie
// @description  Ck工具
// @version      1.2
// @license      MIT
// @author       Lx
// @require      https://update.greatest.deepsurf.us/scripts/446666/1389793/jQuery%20Core%20minified.js
// @resource     https://cdn.staticfile.org/limonte-sweetalert2/11.7.1/sweetalert2.min.css
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.all.min.js
// @grant        GM_addStyle
// @grant        GM_cookie
// @grant        GM_setClipboard
// @match        **://**/**
// @namespace https://greatest.deepsurf.us/users/956311
// ==/UserScript==
(async () => {
    AddBtnElements();

    const Toast = Swal.mixin({
        toast: true,
        position: "top-end",
        showConfirmButton: false,
        timer: 3000,
        timerProgressBar: true,
        didOpen: (toast) => {
            toast.onmouseenter = Swal.stopTimer;
            toast.onmouseleave = Swal.resumeTimer;
        }
    });

    /**
     * 添加按钮组
     * @constructor
     */
    function AddBtnElements() {
        const btns = `<div id="btns-cpck" style="position: fixed; bottom: 50px; right: 50px; z-index: 9999;">
                <button id="CP_CK" class="u-button nd-file-list-toolbar-action-item u-button--primary" style="border-radius: 5px;
    background-color: #008DDB;
    color: white;
    padding: 10px;
    font-size: 20px;
    border: none;
    font-weight: 700;">复制Cookie</button>
        </div>`;

        $('body').append(btns);

        $('#CP_CK').click(async function () {
            GM_cookie('list',{}, async (response) => {
                const cookieStr = response.map(item => `${item.name}=${item.value}`).join(';');
                if (cookieStr) {
                    GM_setClipboard(cookieStr, "text", () => Toast.fire({
                        title: '系统提示',
                        html: 'Cookie成功复制到剪贴板!',
                    }))
                    return
                } else {
                    Swal.fire({
                        title: '系统提示',
                        html: '未获取到Cookie信息!',
                    })
                }
            })
        });
    }
})();