mirror of
https://github.com/neosubhamoy/neosubhamoy-portfolio.git
synced 2025-12-19 23:59:35 +05:30
34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
//---controls basic keyboard shotcuts
|
|
//basePath const is defined in floatingbar-config
|
|
|
|
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.com";
|
|
}
|
|
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;
|
|
}); |