Ctrl/Cmd+Shift+P as alternate way to open command line (#1736)

* Renamed command line setting timer-progress bar

* Added ctrl/cmd + shift + p as alternate keyboard shortcut to open command line

* Update commandline.js

* Fixed typo

* fixed error if key is nulish

Co-authored-by: Jack <bartnikjack@gmail.com>
This commit is contained in:
Aaron 2021-08-22 03:16:17 -07:00 committed by GitHub
parent 72ef29b74c
commit 250590b777
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -330,8 +330,15 @@ $("#commandLine input").keyup((e) => {
$(document).ready((e) => {
$(document).keydown((event) => {
//escape
if (event.keyCode == 27 || (event.keyCode == 9 && Config.swapEscAndTab)) {
// opens command line if escape, ctrl/cmd + shift + p, or tab is pressed if the setting swapEscAndTab is enabled
if (
event.keyCode == 27 ||
(event.key &&
event.key.toLowerCase() == "p" &&
(event.metaKey || event.ctrlKey) &&
event.shiftKey) ||
(event.keyCode == 9 && Config.swapEscAndTab)
) {
event.preventDefault();
if (!$("#leaderboardsWrapper").hasClass("hidden")) {
//maybe add more condition for closing other dialogs in the future as well