Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
New handleKeyPress code in JS, as proposed by the AI.
  • Loading branch information
Luke Davis, Open Source Systems Luke Davis, Open Source Systems
Luke Davis, Open Source Systems authored and Luke Davis, Open Source Systems committed Aug 19, 2024
commit eacc8c1ccdc7c4a8cb4d0cd3149040568c03ccde
11 changes: 8 additions & 3 deletions source/message.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@
var copyStatusTimeout = 5000; // milliseconds before copy status message goes away

function handleKeyPress(e) {
/*
This code should be effective for modern browsers (EdgeWebView2),
while also serving in old IE (MSHTML) contexts.
*/
e = e || window.event;
if(e.keyCode == 27){ // code for escape
window.close();
} else if (e.shiftKey && e.ctrlKey && e.keyCode == 67) { // code for Ctrl+Shift+C
var key = e.key || e.keyCode;
if (key === 'Escape' || key === 27) { // code for escape
onCloseButtonPress();
} else if (e.shiftKey && e.ctrlKey && (key === 'C' || key === 67)) { // code for Ctrl+Shift+C
onCopyButtonPress();
}
}
Comment thread
XLTechie marked this conversation as resolved.
Expand Down