mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 11:37:02 +03:00
Merge pull request #246 from jplsek/keybind-esc
Allow keybind cancel with ESC
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user