Last active
April 28, 2023 10:01
-
-
Save JohnRDOrazio/4800a91867b45b6799730cb8c496d478 to your computer and use it in GitHub Desktop.
when using the web based SSH terminal provided by the Plesk interface, there is no way to copy the text from the terminal since it is a canvas element. This script will allow to use Ctrl-Shift-C to copy instead of opening developer tools
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Intercept and check keydown events for Ctrl+Shift+C */ | |
document.body.addEventListener('keydown', function(evt){ | |
if (evt.ctrlKey && evt.shiftKey && evt.key == "C"){ | |
// Copy the selection to the clipboard | |
document.execCommand('copy'); | |
// Throw away this event and don't do the default stuff | |
evt.stopPropagation(); | |
evt.preventDefault(); | |
} | |
}, false); | |
/* Intercept and check keyup events for Ctrl+Shift+C */ | |
document.body.addEventListener('keyup', function(evt){ | |
if (evt.ctrlKey && evt.shiftKey && evt.key == "C"){ | |
// Throw away this event and don't do the default stuff | |
evt.stopPropagation(); | |
evt.preventDefault(); | |
} | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment