// ==UserScript==
// @name         点击td复制
// @namespace    http://tampermonkey.net/
// @version      2025-03-01
// @description  try to take over the world!
// @author       You
// @match        http://*/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
	 document.querySelectorAll("td").forEach(cell => {
                        cell.removeEventListener("click", cell.clickHandler); // 移除旧监听器
                        cell.clickHandler = function() {
                            const text = this.value;
                            navigator.clipboard.writeText(text)
                                .then(() => {
                                    this.style.backgroundColor = "#ccffcc";
                                    setTimeout(() => {
                                        this.style.backgroundColor = "";
                                    }, 500);
                                })
                                .catch(err => {
                                    console.error("复制失败:", err);
                                });
                        };
})();