enable-copy-telegram

Enable copying text on Telegram Web

  1. // ==UserScript==
  2. // @name enable-copy-telegram
  3. // @namespace Violentmonkey Scripts
  4. // @match https://web.telegram.org/*
  5. // @grant none
  6. // @version 1.0
  7. // @run-at document-end
  8. // @author maanimis
  9. // @description Enable copying text on Telegram Web
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. function preventCopyOverride(e) {
  15. if (e.ctrlKey && e.keyCode === 67) {
  16. e.preventDefault();
  17. e.stopImmediatePropagation();
  18.  
  19. const selection = window.getSelection().toString();
  20. if (selection) {
  21. navigator.clipboard.writeText(selection).catch((err) => {
  22. console.error("Failed to copy text: ", err);
  23. });
  24. }
  25. }
  26. }
  27.  
  28. document.addEventListener("keydown", preventCopyOverride, true);
  29. })();

QingJ © 2025

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