掘金复制内容版权去除

去除掘金复制内容时,自带的版权信息

  1. // ==UserScript==
  2. // @name 掘金复制内容版权去除
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description 去除掘金复制内容时,自带的版权信息
  6. // @author GodD
  7. // @match https://juejin.im/post/*
  8. // @match https://juejin.cn/post/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. let timer = setInterval(()=>{
  15. let con = document.querySelector('#juejin > div.view-container > main > div.view.column-view');
  16. if(!con){
  17. return;
  18. }
  19.  
  20. clearInterval(timer);
  21. setTimeout(()=>{
  22. console.info('剪切板初始化')
  23. con.addEventListener('copy',()=>{
  24. event.preventDefault();
  25. event.stopPropagation();
  26. console.info('触发复制事件')
  27. let textData = window.getSelection().getRangeAt(0);
  28. let node = document.createElement('div');
  29. node.appendChild(window.getSelection().getRangeAt(0).cloneContents());
  30. if(event.clipboardData){
  31. event.clipboardData.setData("text/html", node.innerHTML);
  32. event.clipboardData.setData("text/plain",textData);
  33. }
  34. else if(window.clipboardData){
  35. return window.clipboardData.setData("text", textData);
  36. }
  37. })
  38. },500)
  39. },200)
  40. })();

QingJ © 2025

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