Skip to content

Instantly share code, notes, and snippets.

@JohnRDOrazio
Last active April 28, 2023 10:01
Show Gist options
  • Save JohnRDOrazio/4800a91867b45b6799730cb8c496d478 to your computer and use it in GitHub Desktop.
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
/* 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