|
|
@@ -0,0 +1,44 @@
|
|
|
+// ==UserScript==
|
|
|
+// @name 获取并复制Cookie
|
|
|
+// @namespace http://tampermonkey.net/
|
|
|
+// @version 1.0
|
|
|
+// @description 点击复制当前页面Cookie
|
|
|
+// @author Jack
|
|
|
+// @match *://*/*
|
|
|
+// @grant GM_setClipboard
|
|
|
+// ==/UserScript==
|
|
|
+
|
|
|
+(function() {
|
|
|
+ 'use strict';
|
|
|
+
|
|
|
+ // 创建按钮并设置样式
|
|
|
+ const executeButton = document.createElement("button");
|
|
|
+ executeButton.textContent = "Copy Cookie";
|
|
|
+ executeButton.style.position = "fixed";
|
|
|
+ executeButton.style.top = "50%";
|
|
|
+ executeButton.style.left = "2%";
|
|
|
+ executeButton.style.transform = "translateX(-50%)";
|
|
|
+ executeButton.style.padding = "3px 8px";
|
|
|
+ executeButton.style.fontSize = "10px";
|
|
|
+ executeButton.style.backgroundColor = "#007baf";
|
|
|
+ executeButton.style.color = "#fff";
|
|
|
+ executeButton.style.border = "none";
|
|
|
+ executeButton.style.borderRadius = "5px";
|
|
|
+ executeButton.style.cursor = "pointer";
|
|
|
+ executeButton.style.zIndex = "10000";
|
|
|
+
|
|
|
+ // 将按钮添加到页面中
|
|
|
+ document.body.appendChild(executeButton);
|
|
|
+
|
|
|
+ // 添加点击事件
|
|
|
+ executeButton.addEventListener('click', () => {
|
|
|
+ // 获取当前页面的Cookie
|
|
|
+ const cookies = document.cookie;
|
|
|
+
|
|
|
+ // 将Cookie复制到剪贴板
|
|
|
+ GM_setClipboard(cookies, { type: 'text' });
|
|
|
+
|
|
|
+ // 提示用户
|
|
|
+ alert('Cookie已复制到剪贴板!');
|
|
|
+ });
|
|
|
+})();
|