複製無編碼網址

將無編碼網址複製到剪貼板

  1. // ==UserScript==
  2. // @name Copy no encode url
  3. // @name:ja エンコードなしの URL をコピー
  4. // @name:zh-TW 複製無編碼網址
  5. // @name:zh-CN 复制无编码网址
  6. // @namespace http://tampermonkey.net/
  7. // @version 0.1
  8. // @description Copy no encode url to clipboard
  9. // @description:ja エンコードなしの URL をクリップボードにコピー
  10. // @description:zh-CN 将无编码网址复制到剪贴板
  11. // @description:zh-TW 將無編碼網址複製到剪貼板
  12. // @author 貓咪不作戰
  13. // @match *://*/*
  14. // @grant none
  15. // @license MIT
  16. // ==/UserScript==
  17.  
  18. (function() {
  19. 'use strict';
  20. window.addEventListener('mousedown', function () {
  21. var target = event.target || event.srcElement;
  22. if(event.button==1 && event.ctrlKey){
  23. var url= decodeURIComponent(window.location.href)
  24. console.log(url);
  25. navigator.clipboard.writeText(url)
  26. speak("Copy link")
  27. }
  28. })
  29. function speak(msgText) {
  30. var msg = new SpeechSynthesisUtterance(msgText);
  31. window.speechSynthesis.cancel();
  32. window.speechSynthesis.speak(msg);
  33. }
  34. // Your code here...
  35. })();