diff --git a/src/common/interfaces/SettingsInterface.ts b/src/common/interfaces/SettingsInterface.ts index fdb081c..87a4aa3 100644 --- a/src/common/interfaces/SettingsInterface.ts +++ b/src/common/interfaces/SettingsInterface.ts @@ -180,7 +180,7 @@ interface SettingsInterface { conditionalDifferencePercent: number // black bars less than this wide will trigger stretch // if mode is set to '1'. 1.0=100% }, - kbmHandler: { + kbm: { enabled: boolean, // if keyboard/mouse handler service will run keyboardEnabled: boolean, // if keyboard shortcuts are processed mouseEnabled: boolean, // if mouse movement is processed diff --git a/src/ext/conf/ExtensionConf.ts b/src/ext/conf/ExtensionConf.ts index ca658c0..c7af1c5 100644 --- a/src/ext/conf/ExtensionConf.ts +++ b/src/ext/conf/ExtensionConf.ts @@ -150,7 +150,7 @@ const ExtensionConf: SettingsInterface = { maxLogZoom: 3, announceDebounce: 200 // we wait this long before announcing new zoom }, - keyboardHandler: { + kbm: { enabled: true, keyboardEnabled: true, mouseEnabled: true diff --git a/src/ext/lib/kbm/KeyboardHandler.ts b/src/ext/lib/kbm/KeyboardHandler.ts index 213200b..39e538c 100644 --- a/src/ext/lib/kbm/KeyboardHandler.ts +++ b/src/ext/lib/kbm/KeyboardHandler.ts @@ -79,7 +79,7 @@ class KeyboardHandler { } load() { - if (!this.settings.isEnabledForSite() || this.settings.active.kbmHandler.enabled) { + if (!this.settings.isEnabledForSite() || this.settings.active.kbm.enabled) { return; } this.addListener(); @@ -95,7 +95,7 @@ class KeyboardHandler { // way, otherwise we can't remove event listener // https://stackoverflow.com/a/19507086 - if (this.settings.active.kbmHandler.keyboardEnabled) { + if (this.settings.active.kbm.keyboardEnabled) { document.addEventListener('keyup', this ); } } @@ -111,11 +111,11 @@ class KeyboardHandler { if (element) { this.playerElements.push(element); - if (this.settings.active.kbmHandler.mouseEnabled) { + if (this.settings.active.kbm.mouseEnabled) { element.addEventListener('mousemove', this); } } else { - if (this.settings.active.kbmHandler.mouseEnabled) { + if (this.settings.active.kbm.mouseEnabled) { for (const playerElement of this.playerElements) { playerElement.addEventListener('mousemove', this); } @@ -176,7 +176,7 @@ class KeyboardHandler { } for (const confKey in config) { - this.settings.active.kbmHandler[confKey] = config[confKey]; + this.settings.active.kbm[confKey] = config[confKey]; } this.settings.save();