FuckNoCopy

移除页面的复制限制,取消所有复制后添加的版权申明,包含知乎、CSDN等页面。本脚本仅解除了技术上的复制限制,请在合理的范围内使用,尊重内容版权,不要未经授权使用或传播他人作品。

当前为 2025-05-21 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name FuckNoCopy
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.2
  5. // @description 移除页面的复制限制,取消所有复制后添加的版权申明,包含知乎、CSDN等页面。本脚本仅解除了技术上的复制限制,请在合理的范围内使用,尊重内容版权,不要未经授权使用或传播他人作品。
  6. // @author zheng-kun@foxmail.com
  7. // @match *://*/*
  8. // @grant GM_addStyle
  9. // @grant GM_setClipboard
  10. // @license MIT
  11. // @require https://libs.baidu.com/jquery/1.9.1/jquery.min.js
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16. // 不展示登录框
  17. GM_addStyle(".passport-login-container{display:none!important;}");
  18. // 解除代码块的选中限制
  19. GM_addStyle("#content_views pre code {user-select: text!important;}");
  20.  
  21.  
  22. // 创建一个 MutationObserver 实例
  23. const observer = new MutationObserver(() => {
  24. // 检测并移除所有 copy 事件监听器
  25. document.querySelectorAll('*').forEach(element => {
  26. const eventListeners = element['eventListeners'];
  27. if (eventListeners && eventListeners.copy) {
  28. eventListeners.copy.forEach(listener => {
  29. element.removeEventListener('copy', listener.listener);
  30. });
  31. }
  32. });
  33. });
  34.  
  35. // 开始监听 document 的 DOM 变化
  36. observer.observe(document, { childList: true, subtree: true });
  37.  
  38. // 重新绑定自定义的 copy 事件监听器
  39. document.addEventListener('copy', function(event) {
  40. event.preventDefault(); // 阻止默认行为
  41. const selection = window.getSelection().toString();
  42. if (selection) {
  43. event.clipboardData.setData('text/plain', selection);
  44. }
  45. }, { capture: true }); // 使用捕获阶段,确保优先执行
  46.  
  47.  
  48.  
  49. function replaceAllCopy() {
  50. document.querySelectorAll('*').forEach(item => {
  51. item.oncopy = function(e) {
  52. e.stopPropagation();
  53. e.preventDefault(); // 阻止默认行为
  54. };
  55. });
  56. }
  57.  
  58. // 在文档加载完成后移除一次
  59. document.addEventListener('DOMContentLoaded', function() {
  60. replaceAllCopy()
  61. });
  62.  
  63. // 每隔 5 秒移除一次
  64. setInterval(replaceAllCopy, 5000);
  65. })();