You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
TamperMonkeyScript/scripts/copy_cookie.js

36 lines
1.1 KiB

// ==UserScript==
// @name 获取并复制Cookie
// @namespace http://tampermonkey.net/
// @version 1.0
// @description 点击复制当前页面Cookie
// @author Jack
// @match *://*/*
// @grant GM_setClipboard
// ==/UserScript==
(function() {
'use strict';
const button = document.createElement("button");
button.textContent = "Copy Cookie";
button.style.position = "fixed";
button.style.top = "10%";
button.style.right = "1%";
button.style.transform = "translateY(-50%)";
button.style.padding = "3px 8px";
button.style.fontSize = "10px";
button.style.backgroundColor = "#007baf";
button.style.color = "#fff";
button.style.border = "none";
button.style.borderRadius = "5px";
button.style.cursor = "pointer";
button.style.zIndex = "10000";
document.body.appendChild(button);
button.addEventListener('click', () => {
const cookies = document.cookie;
GM_setClipboard(cookies, { type: 'text' });
alert(`Cookie已复制到剪贴板!\n\n${cookies}`);
});
})();