1
1
mirror of https://github.com/neosubhamoy/neosubhamoy-portfolio.git synced 2025-12-19 22:53:03 +05:30

(feat): added keybinding-config.js to handle keyboard shotcuts

This commit is contained in:
2023-11-20 22:14:25 +05:30
parent 34ae2e6ac1
commit 38088a39e3
5 changed files with 35 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
let pressedKeys = {};
document.addEventListener('keydown', function(event) {
pressedKeys[event.key] = true;
if (pressedKeys['n'] && pressedKeys['h']) {
window.location.href = basePath;
}
else if (pressedKeys['n'] && pressedKeys['p']) {
window.location.href = basePath + "/projects";
}
else if (pressedKeys['n'] && pressedKeys['b']) {
window.location.href = basePath + "/blog";
}
else if (pressedKeys['n'] && pressedKeys['c']) {
window.location.href = basePath + "/contact";
}
else if (pressedKeys['q'] && pressedKeys['e']) {
window.location.href = "mailto:hey@neosubhamoy.dev";
}
else if (pressedKeys['q'] && pressedKeys['m']) {
window.location.href = "#";
}
else if (pressedKeys['q'] && pressedKeys['s']) {
window.location.href = "#";
}
});
document.addEventListener('keyup', function(event) {
pressedKeys[event.key] = false;
});