summaryrefslogtreecommitdiff
path: root/ext/bg/js/settings.js
diff options
context:
space:
mode:
authorAlex Yatskov <FooSoft@users.noreply.github.com>2019-09-30 19:51:48 -0700
committerGitHub <noreply@github.com>2019-09-30 19:51:48 -0700
commiteadd03624c6630ce83ba89dc26d52a94c5c23a75 (patch)
treef768e2efa33a8aaef828a2c4646be843522f70db /ext/bg/js/settings.js
parent64eed33e8890df33e3c4acb47c96f0e3c674bd3b (diff)
parente18b8438ae369e84367fbb635a2e11506519a88a (diff)
Merge pull request #226 from toasted-nutbread/settings-style
Style updates and fixes
Diffstat (limited to 'ext/bg/js/settings.js')
-rw-r--r--ext/bg/js/settings.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/ext/bg/js/settings.js b/ext/bg/js/settings.js
index a0fe7c70..c85cc8a4 100644
--- a/ext/bg/js/settings.js
+++ b/ext/bg/js/settings.js
@@ -151,6 +151,7 @@ async function formWrite(options) {
function formSetupEventListeners() {
$('#dict-purge-link').click(utilAsync(onDictionaryPurge));
$('#dict-file').change(utilAsync(onDictionaryImport));
+ $('#dict-file-button').click(onDictionaryImportButtonClick);
$('#field-templates-reset').click(utilAsync(onAnkiFieldTemplatesReset));
$('input, select, textarea').not('.anki-model').not('.profile-form *').change(utilAsync(onFormOptionsChanged));
@@ -240,6 +241,8 @@ async function onFormOptionsChanged(e) {
}
async function onReady() {
+ showExtensionInformation();
+
formSetupEventListeners();
await profileOptionsSetup();
@@ -446,6 +449,11 @@ async function onDictionaryPurge(e) {
}
}
+function onDictionaryImportButtonClick() {
+ const dictFile = document.querySelector('#dict-file');
+ dictFile.click();
+}
+
async function onDictionaryImport(e) {
const dictFile = $('#dict-file');
const dictControls = $('#dict-importer').hide();
@@ -741,3 +749,16 @@ function storageSpinnerShow(show) {
spinner.hide();
}
}
+
+
+/*
+ * Information
+ */
+
+function showExtensionInformation() {
+ const node = document.getElementById('extension-info');
+ if (node === null) { return; }
+
+ const manifest = chrome.runtime.getManifest();
+ node.textContent = `${manifest.name} v${manifest.version}`;
+}