Ctlr+鼠标右键复制选中内容

2020/4/27 下午4:53:47

  1. // ==UserScript==
  2. // @name Ctlr+鼠标右键复制选中内容
  3. // @namespace Ctrl Right copy
  4. // @match *://*/*
  5. // @grant GM_setClipboard
  6. // @grant GM_notification
  7. // @version 1.2
  8. // @author -
  9. // @description 2020/4/27 下午4:53:47
  10. // ==/UserScript==
  11.  
  12. document.oncontextmenu = (event) => {
  13. if(event.ctrlKey){
  14. event.preventDefault();
  15. const selectText = window.getSelection().toString().replace(/\n+/g, '\n\n');
  16. if (selectText.length) {
  17. GM_setClipboard(selectText);
  18. GM_notification({
  19. text: selectText,
  20. title: '复制到如下内容:',
  21. timeout: 2000,
  22. })
  23. }
  24. }
  25. };

QingJ © 2025

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