丝法兰 cookie 复制

2024/3/1 15:48:57

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        丝法兰 cookie 复制
// @namespace   Violentmonkey Scripts
// @match       https://www.sephora.com/**/*
// @grant       GM_setClipboard
// @version     1.0
// @author      -
// @description 2024/3/1 15:48:57
// @license MIT
// ==/UserScript==
(function() {
    'use strict';

    // 创建按钮
    var button = document.createElement('button');
    button.textContent = '复制Cookies';
    button.style.position = 'fixed';
    button.style.bottom = '20px';
    button.style.right = '20px';
    button.style.padding = '10px 20px';
    button.style.border = 'none';
    button.style.borderRadius = '5px';
    button.style.backgroundColor = '#4CAF50';
    button.style.color = 'white';
    button.style.cursor = 'pointer';
    button.style.zIndex = '10000';

    // 点击按钮复制Cookies
    button.onclick = function() {
      GM_setClipboard(document.cookie)
      showToast('复制成功')
    };

    // 将按钮添加到页面上
    document.body.appendChild(button);


  function showToast(message) {
        var toast = document.createElement('div');
        toast.textContent = message;
        toast.style.position = 'fixed';
        toast.style.top = '60px'; // 稍微高于按钮
        toast.style.left = 'calc(50% - 48px)';
        toast.style.padding = '10px 20px';
        toast.style.border = 'none';
        toast.style.borderRadius = '5px';
        toast.style.backgroundColor = '#323232';
        toast.style.color = 'white';
        toast.style.zIndex = '10001';
        toast.style.opacity = '0';
        toast.style.transition = 'opacity 0.5s';

        document.body.appendChild(toast);

        // 渐显
        setTimeout(() => {
            toast.style.opacity = '1';
        }, 100);

        // 持续3秒后消失
        setTimeout(() => {
            toast.style.opacity = '0';
            setTimeout(() => document.body.removeChild(toast), 500); // 完全消失后移除元素
        }, 3000);
    }
})();