// ==UserScript== // @name Cookie VIE // @namespace https://github.com/RashidaKAKU // @version 1.0.0 // @description 查看当前页面的 cookie 值并复制到剪贴板 // @author Rashida // @match *://*/* // @grant GM_setClipboard // @license MIT // @downloadURL none // ==/UserScript== // 警告:此脚本可以访问您在当前页面的所有 Cookie 信息。 // 警告:请不要在不可信的网站上使用此脚本,并在使用后记得删除。 // 警告:在获取 cookie 值时需要注意隐私和安全问题,同时也需要遵守网站的用户协议和隐私政策。请不要尝试绕过浏览器的限制或者使用未经授权的技术或工具来获取 Cookie 值。如果您有任何疑问,请联系网站管理员或者开发人员。 (function() { 'use strict'; var button = document.createElement('button'); button.textContent = '查看 Cookie'; button.style.position = 'fixed'; button.style.bottom = '10px'; button.style.right = '10px'; button.style.zIndex = '9999'; document.body.appendChild(button); button.addEventListener('click', function() { var cookies = document.cookie.split(';'); var cookieObj = {}; for (var i = 0; i < cookies.length; i++) { var cookie = cookies[i].split('='); cookieObj[cookie[0].trim()] = cookie[1].trim(); } var cookieStr = ''; for (var key in cookieObj) { cookieStr += key + '=' + cookieObj[key] + '; '; } GM_setClipboard(cookieStr); alert('已复制 cookie 到剪贴板。请不要在不可信的网站上使用此脚本,并在使用后记得删除。\n\n' + cookieStr); }); })();