您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
解除网页复制限制,并可在复制时自动添加来源信息
// ==UserScript== // @name 网页内容复制增强 // @namespace http://tampermonkey.net/ // @version 1.0 // @description 解除网页复制限制,并可在复制时自动添加来源信息 // @author AI助手 // @match *://*/* // @grant none // @license MIT // @run-at document-start // ==/UserScript== (function() { 'use strict'; // 解除复制限制 function enableCopy() { document.body.oncopy = null; document.body.onselectstart = null; document.body.oncontextmenu = null; document.body.onpaste = null; // 移除可能阻止复制的CSS样式 const style = document.createElement('style'); style.id = '__tampermonkey_copy_style__'; style.innerHTML = ` body, * { -webkit-user-select: auto !important; -moz-user-select: auto !important; -ms-user-select: auto !important; user-select: auto !important; } `; document.head.appendChild(style); } // 复制时添加来源信息 document.addEventListener('copy', function(e) { const selection = window.getSelection(); let clipboardData = e.clipboardData || window.clipboardData; if (!clipboardData) return; const originalText = selection.toString(); const pageTitle = document.title; const pageUrl = window.location.href; const newText = originalText + '\n\n--------------------\n来源:' + pageTitle + '\n链接:' + pageUrl; clipboardData.setData('text/plain', newText); e.preventDefault(); }); // 页面加载时立即解除复制限制 enableCopy(); })();