Skip to content

Commit

Permalink
Add highlight for Fn key in case F1-F12 is pressed. Fixes Techtonica#29
Browse files Browse the repository at this point in the history
  • Loading branch information
Karska-dev committed Oct 8, 2020
1 parent d2d3855 commit 0ea84ed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
15 changes: 14 additions & 1 deletion public/scripts/main.js
Expand Up @@ -119,6 +119,11 @@ function handle(e) {
$('.letter').toggleClass('uppercase');
caps=false;
}
// Highlight Fn key if any of F1-F12 is pressed
else if (e.which>=112 && e.which<=123) {
$("#"+e.key.toLowerCase()).addClass("pressed");
$("#fnc").addClass("pressed");
}
else {
if (commandDown) {
e.preventDefault();
Expand Down Expand Up @@ -176,9 +181,17 @@ function highlightNextKey(params){
function promptKey2(key){
//if($('li[data-keycode="'+key+'"]'[0]).hasClass('prompt')){
if (isShowHint) {
$($('li[data-keycode="'+key+'"]')[0]).addClass("prompt")
$($('li[data-keycode="'+key+'"]')[0]).addClass("prompt");
// Highlight Fn to be a combination with F1-F12
if (key>=112 && key <=123) {
$($('li[data-keycode="fn"]')[0]).addClass("prompt");
}
} else {
$($('li[data-keycode="'+key+'"]')[0]).removeClass("prompt")
// Remove Fn highlight
if (key>=112 && key <=123) {
$($('li[data-keycode="fn"]')[0]).removeClass("prompt");
}
}
//}
}
Expand Down
6 changes: 6 additions & 0 deletions public/scripts/shortcuts.json
@@ -1,4 +1,10 @@
[
{
"answer": "F2",
"question": "How do you rename a symbol in VSCode?",
"keys": [113],
"shortcutType": "mac vscode"
},
{
"answer": "command+x",
"question": "How do you cut the selected item and copy it to the clipboard?",
Expand Down

0 comments on commit 0ea84ed

Please sign in to comment.