aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeremy Plsek <[email protected]>2020-01-15 20:50:51 -0500
committerJeremy Plsek <[email protected]>2020-01-15 20:50:51 -0500
commitad37e9abe7bb2553485043c7dc6be594d09e9d6c (patch)
treec522b9c025d4360d831ebc20da90f6719a0c2282
parent6f2a09695b3bf8b052c0d5f0992062d05645516d (diff)
downloadSponsorBlock-ad37e9abe7bb2553485043c7dc6be594d09e9d6c.tar.gz
SponsorBlock-ad37e9abe7bb2553485043c7dc6be594d09e9d6c.zip
Allow keybind cancel with ESC
-rw-r--r--options/options.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/options/options.js b/options/options.js
index d2f3b440..bc173d25 100644
--- a/options/options.js
+++ b/options/options.js
@@ -234,6 +234,15 @@ function keybindKeyPressed(element, e) {
e = e || window.event;
var key = e.key;
+ let button = element.querySelector(".trigger-button");
+
+ // cancel setting a keybind
+ if (key === "Escape") {
+ element.querySelector(".option-hidden-section").classList.add("hidden");
+ button.classList.remove("disabled");
+ return;
+ }
+
let option = element.getAttribute("sync-option");
SB.config[option] = key;
@@ -244,8 +253,6 @@ function keybindKeyPressed(element, e) {
let statusKey = element.querySelector(".option-hidden-section > .keybind-status-key");
statusKey.innerText = key;
- let button = element.querySelector(".trigger-button");
-
button.classList.remove("disabled");
}