diff options
author | siikamiika <siikamiika@users.noreply.github.com> | 2020-05-09 18:36:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-09 18:36:00 +0300 |
commit | d6a3825a383e13b34c03c0b36e393da52bf8cf89 (patch) | |
tree | 5bf47b68b45226a02b7d0556cee6ebbf39de9262 /ext/bg/js/settings/main.js | |
parent | 48cf6469739b26d4157d79523ccea762ef90d6bd (diff) |
Modifier key platform names (#519)
* wip
* add environment class
* use Environment class
* use Environment for scanning modifier options
* remove Environment in favor of API
* await promise
* use modifier symbols on macOS
* fix key separator issues
* if else to switch
* simplify variable names
Diffstat (limited to 'ext/bg/js/settings/main.js')
-rw-r--r-- | ext/bg/js/settings/main.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/ext/bg/js/settings/main.js b/ext/bg/js/settings/main.js index cf75d629..61395b1c 100644 --- a/ext/bg/js/settings/main.js +++ b/ext/bg/js/settings/main.js @@ -22,6 +22,7 @@ * ankiTemplatesInitialize * ankiTemplatesUpdateValue * apiForwardLogsToBackend + * apiGetEnvironmentInfo * apiOptionsSave * appearanceInitialize * audioSettingsInitialize @@ -285,6 +286,23 @@ function showExtensionInformation() { node.textContent = `${manifest.name} v${manifest.version}`; } +async function settingsPopulateModifierKeys() { + const scanModifierKeySelect = document.querySelector('#scan-modifier-key'); + scanModifierKeySelect.textContent = ''; + + const environment = await apiGetEnvironmentInfo(); + const modifierKeys = [ + {value: 'none', name: 'None'}, + ...environment.modifiers.keys + ]; + for (const {value, name} of modifierKeys) { + const option = document.createElement('option'); + option.value = value; + option.textContent = name; + scanModifierKeySelect.appendChild(option); + } +} + async function onReady() { apiForwardLogsToBackend(); @@ -292,6 +310,7 @@ async function onReady() { showExtensionInformation(); + await settingsPopulateModifierKeys(); formSetupEventListeners(); appearanceInitialize(); await audioSettingsInitialize(); |