Copy on Ctrl + Shift + C

Copy text when pressing Ctrl+Shift+C. This can be especially used on Firefox (opens devtools normally). Devtools can still be toggled using Ctrl+Shift+I.

  1. // ==UserScript==
  2. // @name Copy on Ctrl + Shift + C
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Copy text when pressing Ctrl+Shift+C. This can be especially used on Firefox (opens devtools normally). Devtools can still be toggled using Ctrl+Shift+I.
  6. // @author kenshin.rorona
  7. // @include *://*
  8. // @grant none
  9. // @run-at document-idle
  10. // @license MIT
  11. // credit: https://github.com/jscher2000/Ctrl-Shift-C-Should-Copy/blob/main/content.js
  12. // ==/UserScript==
  13.  
  14. (function () {
  15. 'use strict';
  16.  
  17. /* Intercept and check keydown events for Ctrl+Shift+C */
  18.  
  19. document.body.addEventListener('keydown', function(evt) {
  20. if (evt.ctrlKey && evt.shiftKey && evt.key == "C") {
  21. // Copy the selection to the clipboard
  22. document.execCommand('copy');
  23. // Throw away this event and don't do the default stuff
  24. evt.stopPropagation();
  25. evt.preventDefault();
  26. }
  27. }, false);
  28.  
  29. /* Intercept and check keyup events for Ctrl+Shift+C */
  30.  
  31. document.body.addEventListener('keyup', function(evt) {
  32. if (evt.ctrlKey && evt.shiftKey && evt.key == "C") {
  33. // Throw away this event and don't do the default stuff
  34. evt.stopPropagation();
  35. evt.preventDefault();
  36. }
  37. }, false);
  38. })();