From 36fc5abae543840484b3d8f7abff85f57de66ada Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Tue, 8 Sep 2020 10:53:41 -0400 Subject: Modifier key refactor (#784) * Add functions for getting keyboard key information * Use os + DocumentUtil to get modifier key names * Remove keyboard modifier info from environment info --- ext/bg/js/settings/main.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'ext/bg/js/settings/main.js') diff --git a/ext/bg/js/settings/main.js b/ext/bg/js/settings/main.js index b29744ac..f775cd57 100644 --- a/ext/bg/js/settings/main.js +++ b/ext/bg/js/settings/main.js @@ -22,6 +22,7 @@ * ClipboardPopupsController * DictionaryController * DictionaryImportController + * DocumentUtil * GenericSettingController * PopupPreviewController * ProfileController @@ -43,12 +44,12 @@ async function settingsPopulateModifierKeys() { const scanModifierKeySelect = document.querySelector('#scan-modifier-key'); scanModifierKeySelect.textContent = ''; - const environment = await api.getEnvironmentInfo(); + const {platform: {os}} = await api.getEnvironmentInfo(); const modifierKeys = [ - {value: 'none', name: 'None'}, - ...environment.modifiers.keys + ['none', 'None'], + DocumentUtil.getModifierKeys(os) ]; - for (const {value, name} of modifierKeys) { + for (const [value, name] of modifierKeys) { const option = document.createElement('option'); option.value = value; option.textContent = name; -- cgit v1.2.3