Copying Lifted 解除复制限制

让你在几乎所有网页里自由地复制粘贴,而不用担心被限制,或者被篡改复制内容

  1. // ==UserScript==
  2. // @name Copying Lifted 解除复制限制
  3. // @name:en Copying Lifted
  4. // @name:zh-CN Copying Lifted 解除复制限制
  5. // @namespace https://palerock.cn
  6. // @version 0.3
  7. // @description:en Allow your copying in anywhere.
  8. // @description:zh-CN 让你在几乎所有网页里自由地复制粘贴,而不用担心被限制,或者被篡改复制内容
  9. // @require https://gf.qytechs.cn/scripts/372672-everything-hook/code/Everything-Hook.js?version=659315
  10. // @include *
  11. // @author Cangshi
  12. // @match http://*/*
  13. // @run-at document-start
  14. // @grant none
  15. // ==/UserScript==
  16.  
  17. function removeCopyEvent() {
  18. Array.prototype.concat.call(document.querySelectorAll('*'), document)
  19. .forEach(function (ele) {
  20. ele.oncopy = undefined;
  21. ele.oncontextmenu = undefined;
  22. });
  23. }
  24.  
  25. 'use strict';
  26. ~function (global) {
  27. function generate() {
  28. return function () {
  29.  
  30. global.addEventListener('contextmenu', function (e) {
  31. removeCopyEvent();
  32. });
  33.  
  34. global.addEventListener('keydown', function (e) {
  35. if (e.ctrlKey || e.keyCode === 224 || e.keyCode === 17 || e.keyCode === 91 || e.keyCode === 93) {
  36. removeCopyEvent();
  37. }
  38. });
  39.  
  40. this.hookBefore(EventTarget.prototype, 'addEventListener',
  41. function (m, args) {
  42. if (args[0] === 'copy' || args[0] === 'contextmenu') {
  43. args[0] = 'prevent ' + args[0] + ' handler';
  44. console.log('[AllowCopy Plugins]', args[0]);
  45. }
  46. }, false);
  47.  
  48. var style = 'body, body *:not(input):not(textarea){-webkit-user-select:auto!important;-moz-user-select:auto!important;-ms-user-select:auto!important;user-select:auto!important}';
  49.  
  50. var stylenode = document.createElement('style');
  51.  
  52. stylenode.setAttribute("type", "text/css");
  53. if (stylenode.styleSheet) {// IE
  54. stylenode.styleSheet.cssText = style;
  55. } else {// w3c
  56. var cssText = document.createTextNode(style);
  57. stylenode.appendChild(cssText);
  58. }
  59.  
  60. document.addEventListener('readystatechange', function () {
  61. if (document.readyState === "interactive" || document.readyState === "complete") {
  62. setTimeout(function () {
  63. document.head.appendChild(stylenode);
  64. console.log('[AllowCopy Plugins] css applied')
  65. }, 2000);
  66. }
  67. });
  68.  
  69. console.log('[AllowCopy Plugins]', 'works.');
  70. }
  71. }
  72.  
  73.  
  74. if (global.eHook) {
  75. global.eHook.plugins({
  76. name: 'allowCopy',
  77. /**
  78. * 插件装载
  79. * @param util
  80. */
  81. mount: generate()
  82. });
  83. }
  84. }(window);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址