From 8e29da0c6bd0b80dc6c9e37a525a37258518c293 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Thu, 27 Feb 2020 20:33:13 -0500 Subject: Load default Anki field templates from a file --- ext/bg/js/settings/backup.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'ext/bg/js/settings/backup.js') diff --git a/ext/bg/js/settings/backup.js b/ext/bg/js/settings/backup.js index f4d622a4..e945d186 100644 --- a/ext/bg/js/settings/backup.js +++ b/ext/bg/js/settings/backup.js @@ -16,10 +16,9 @@ * along with this program. If not, see . */ -/*global apiOptionsGetFull, apiGetEnvironmentInfo +/*global apiOptionsGetFull, apiGetEnvironmentInfo, apiGetDefaultAnkiFieldTemplates utilBackend, utilIsolate, utilBackgroundIsolate, utilReadFileArrayBuffer -optionsGetDefault, optionsUpdateVersion -profileOptionsGetDefaultFieldTemplates*/ +optionsGetDefault, optionsUpdateVersion*/ // Exporting @@ -47,8 +46,7 @@ function _getSettingsExportDateString(date, dateSeparator, dateTimeSeparator, ti async function _getSettingsExportData(date) { const optionsFull = await apiOptionsGetFull(); const environment = await apiGetEnvironmentInfo(); - - const fieldTemplatesDefault = profileOptionsGetDefaultFieldTemplates(); + const fieldTemplatesDefault = await apiGetDefaultAnkiFieldTemplates(); // Format options for (const {options} of optionsFull.profiles) { -- cgit v1.2.3 From 2abf46b6fa9d6c03be0d98045e111f2d8e1e41d5 Mon Sep 17 00:00:00 2001 From: siikamiika Date: Sun, 1 Mar 2020 23:06:37 +0200 Subject: simplify backend prepare --- ext/bg/js/backend.js | 69 +++++++++++++++----------------------------- ext/bg/js/settings/backup.js | 2 +- 2 files changed, 24 insertions(+), 47 deletions(-) (limited to 'ext/bg/js/settings/backup.js') diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index b99d1ca4..07dca370 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -39,9 +39,6 @@ class Backend { url: window.location.href }; - this.isPreparedResolve = null; - this.isPreparedPromise = new Promise((resolve) => (this.isPreparedResolve = resolve)); - this.clipboardPasteTarget = document.querySelector('#clipboard-paste-target'); this.popupWindow = null; @@ -110,15 +107,11 @@ class Backend { } chrome.runtime.onMessage.addListener(this.onMessage.bind(this)); - const options = this.getOptionsSync(this.optionsContext); + const options = this.getOptions(this.optionsContext); if (options.general.showGuide) { chrome.tabs.create({url: chrome.runtime.getURL('/bg/guide.html')}); } - this.isPreparedResolve(); - this.isPreparedResolve = null; - this.isPreparedPromise = null; - this.clipboardMonitor.onClipboardText = this._onClipboardText.bind(this); } @@ -160,7 +153,7 @@ class Backend { } applyOptions() { - const options = this.getOptionsSync(this.optionsContext); + const options = this.getOptions(this.optionsContext); if (!options.general.enable) { this.setExtensionBadgeBackgroundColor('#555555'); this.setExtensionBadgeText('off'); @@ -186,24 +179,15 @@ class Backend { } } - async getOptionsSchema() { - if (this.isPreparedPromise !== null) { - await this.isPreparedPromise; - } + getOptionsSchema() { return this.optionsSchema; } - async getFullOptions() { - if (this.isPreparedPromise !== null) { - await this.isPreparedPromise; - } + getFullOptions() { return this.options; } - async setFullOptions(options) { - if (this.isPreparedPromise !== null) { - await this.isPreparedPromise; - } + setFullOptions(options) { try { this.options = JsonSchema.getValidValueOrDefault(this.optionsSchema, utilIsolate(options)); } catch (e) { @@ -212,18 +196,11 @@ class Backend { } } - async getOptions(optionsContext) { - if (this.isPreparedPromise !== null) { - await this.isPreparedPromise; - } - return this.getOptionsSync(optionsContext); - } - - getOptionsSync(optionsContext) { - return this.getProfileSync(optionsContext).options; + getOptions(optionsContext) { + return this.getProfile(optionsContext).options; } - getProfileSync(optionsContext) { + getProfile(optionsContext) { const profiles = this.options.profiles; if (typeof optionsContext.index === 'number') { return profiles[optionsContext.index]; @@ -290,20 +267,20 @@ class Backend { // Message handlers - _onApiOptionsSchemaGet() { + async _onApiOptionsSchemaGet() { return this.getOptionsSchema(); } - _onApiOptionsGet({optionsContext}) { + async _onApiOptionsGet({optionsContext}) { return this.getOptions(optionsContext); } - _onApiOptionsGetFull() { + async _onApiOptionsGetFull() { return this.getFullOptions(); } async _onApiOptionsSet({changedOptions, optionsContext, source}) { - const options = await this.getOptions(optionsContext); + const options = this.getOptions(optionsContext); function getValuePaths(obj) { const valuePaths = []; @@ -343,20 +320,20 @@ class Backend { } async _onApiOptionsSave({source}) { - const options = await this.getFullOptions(); + const options = this.getFullOptions(); await optionsSave(options); this.onOptionsUpdated(source); } async _onApiKanjiFind({text, optionsContext}) { - const options = await this.getOptions(optionsContext); + const options = this.getOptions(optionsContext); const definitions = await this.translator.findKanji(text, options); definitions.splice(options.general.maxResults); return definitions; } async _onApiTermsFind({text, details, optionsContext}) { - const options = await this.getOptions(optionsContext); + const options = this.getOptions(optionsContext); const mode = options.general.resultOutputMode; const [definitions, length] = await this.translator.findTerms(mode, text, details, options); definitions.splice(options.general.maxResults); @@ -364,7 +341,7 @@ class Backend { } async _onApiTextParse({text, optionsContext}) { - const options = await this.getOptions(optionsContext); + const options = this.getOptions(optionsContext); const results = []; while (text.length > 0) { const term = []; @@ -394,7 +371,7 @@ class Backend { } async _onApiTextParseMecab({text, optionsContext}) { - const options = await this.getOptions(optionsContext); + const options = this.getOptions(optionsContext); const results = []; const rawResults = await this.mecab.parseText(text); for (const [mecabName, parsedLines] of Object.entries(rawResults)) { @@ -425,7 +402,7 @@ class Backend { } async _onApiDefinitionAdd({definition, mode, context, optionsContext}) { - const options = await this.getOptions(optionsContext); + const options = this.getOptions(optionsContext); const templates = this.defaultAnkiFieldTemplates; if (mode !== 'kanji') { @@ -450,7 +427,7 @@ class Backend { } async _onApiDefinitionsAddable({definitions, modes, optionsContext}) { - const options = await this.getOptions(optionsContext); + const options = this.getOptions(optionsContext); const templates = this.defaultAnkiFieldTemplates; const states = []; @@ -497,7 +474,7 @@ class Backend { } async _onApiNoteView({noteId}) { - return this.anki.guiBrowse(`nid:${noteId}`); + return await this.anki.guiBrowse(`nid:${noteId}`); } async _onApiTemplateRender({template, data}) { @@ -509,7 +486,7 @@ class Backend { } async _onApiAudioGetUrl({definition, source, optionsContext}) { - const options = await this.getOptions(optionsContext); + const options = this.getOptions(optionsContext); return await audioGetUrl(definition, source, options); } @@ -668,7 +645,7 @@ class Backend { async _onCommandSearch(params) { const {mode='existingOrNewTab', query} = params || {}; - const options = await this.getOptions(this.optionsContext); + const options = this.getOptions(this.optionsContext); const {popupWidth, popupHeight} = options.general; const baseUrl = chrome.runtime.getURL('/bg/search.html'); @@ -752,7 +729,7 @@ class Backend { }; const source = 'popup'; - const options = await this.getOptions(optionsContext); + const options = this.getOptions(optionsContext); options.general.enable = !options.general.enable; await this._onApiOptionsSave({source}); } diff --git a/ext/bg/js/settings/backup.js b/ext/bg/js/settings/backup.js index e945d186..acd21920 100644 --- a/ext/bg/js/settings/backup.js +++ b/ext/bg/js/settings/backup.js @@ -120,7 +120,7 @@ async function _onSettingsExportClick() { // Importing async function _settingsImportSetOptionsFull(optionsFull) { - return utilIsolate(await utilBackend().setFullOptions( + return utilIsolate(utilBackend().setFullOptions( utilBackgroundIsolate(optionsFull) )); } -- cgit v1.2.3 From e0edb30efd51ac18167880d77c2dea11c73a1bfc Mon Sep 17 00:00:00 2001 From: siikamiika Date: Mon, 2 Mar 2020 11:18:09 +0200 Subject: fix Backend prepare issues in settings --- ext/bg/js/backend.js | 4 ++++ ext/bg/js/settings/backup.js | 4 ++-- ext/bg/js/settings/main.js | 5 ++++- ext/bg/js/util.js | 6 +++++- 4 files changed, 15 insertions(+), 4 deletions(-) (limited to 'ext/bg/js/settings/backup.js') diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index cdcfb7ad..be43ecf6 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -39,6 +39,8 @@ class Backend { url: window.location.href }; + this.isPrepared = false; + this.clipboardPasteTarget = document.querySelector('#clipboard-paste-target'); this.popupWindow = null; @@ -108,6 +110,8 @@ class Backend { } chrome.runtime.onMessage.addListener(this.onMessage.bind(this)); + this.isPrepared = true; + const options = this.getOptions(this.optionsContext); if (options.general.showGuide) { chrome.tabs.create({url: chrome.runtime.getURL('/bg/guide.html')}); diff --git a/ext/bg/js/settings/backup.js b/ext/bg/js/settings/backup.js index acd21920..daa08c61 100644 --- a/ext/bg/js/settings/backup.js +++ b/ext/bg/js/settings/backup.js @@ -362,10 +362,10 @@ async function _onSettingsResetConfirmClick() { // Setup -window.addEventListener('DOMContentLoaded', () => { +function backupInitialize() { document.querySelector('#settings-export').addEventListener('click', _onSettingsExportClick, false); document.querySelector('#settings-import').addEventListener('click', _onSettingsImportClick, false); document.querySelector('#settings-import-file').addEventListener('change', _onSettingsImportFileChange, false); document.querySelector('#settings-reset').addEventListener('click', _onSettingsResetClick, false); document.querySelector('#settings-reset-modal-confirm').addEventListener('click', _onSettingsResetConfirmClick, false); -}, false); +} diff --git a/ext/bg/js/settings/main.js b/ext/bg/js/settings/main.js index 127a6d2b..1bf1444c 100644 --- a/ext/bg/js/settings/main.js +++ b/ext/bg/js/settings/main.js @@ -21,7 +21,7 @@ utilBackend, utilIsolate, utilBackgroundIsolate ankiErrorShown, ankiFieldsToDict ankiTemplatesUpdateValue, onAnkiOptionsChanged, onDictionaryOptionsChanged appearanceInitialize, audioSettingsInitialize, profileOptionsSetup, dictSettingsInitialize -ankiInitialize, ankiTemplatesInitialize, storageInfoInitialize +ankiInitialize, ankiTemplatesInitialize, storageInfoInitialize, backupInitialize */ function getOptionsMutable(optionsContext) { @@ -262,6 +262,8 @@ function showExtensionInformation() { async function onReady() { + await yomichan.prepare(); + showExtensionInformation(); formSetupEventListeners(); @@ -271,6 +273,7 @@ async function onReady() { await dictSettingsInitialize(); ankiInitialize(); ankiTemplatesInitialize(); + backupInitialize(); storageInfoInitialize(); diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js index 5ce4b08c..79c6af06 100644 --- a/ext/bg/js/util.js +++ b/ext/bg/js/util.js @@ -73,7 +73,11 @@ function utilStringHashCode(string) { } function utilBackend() { - return chrome.extension.getBackgroundPage().yomichanBackend; + const backend = chrome.extension.getBackgroundPage().yomichanBackend; + if (!backend.isPrepared) { + throw new Error('Backend not ready yet'); + } + return backend; } async function utilAnkiGetModelNames() { -- cgit v1.2.3 From 64fc0349a17c16355491fac4fc6830b7e68a0e58 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Tue, 10 Mar 2020 22:30:36 -0400 Subject: Update global declarations --- .eslintrc.json | 2 +- ext/bg/js/anki.js | 4 +++- ext/bg/js/audio-uri-builder.js | 4 +++- ext/bg/js/backend.js | 33 +++++++++++++++++++++++------- ext/bg/js/clipboard-monitor.js | 4 +++- ext/bg/js/context.js | 6 +++++- ext/bg/js/database.js | 7 ++++++- ext/bg/js/handlebars.js | 6 +++++- ext/bg/js/japanese.js | 4 +++- ext/bg/js/options.js | 4 +++- ext/bg/js/search-frontend.js | 4 +++- ext/bg/js/search-query-parser-generator.js | 5 ++++- ext/bg/js/search-query-parser.js | 10 ++++++++- ext/bg/js/search.js | 9 +++++++- ext/bg/js/settings/anki-templates.js | 16 +++++++++++---- ext/bg/js/settings/anki.js | 13 +++++++++--- ext/bg/js/settings/audio.js | 10 +++++++-- ext/bg/js/settings/backup.js | 14 ++++++++++--- ext/bg/js/settings/conditions-ui.js | 4 +++- ext/bg/js/settings/dictionaries.js | 22 +++++++++++++++----- ext/bg/js/settings/main.js | 27 +++++++++++++++++------- ext/bg/js/settings/popup-preview-frame.js | 8 +++++++- ext/bg/js/settings/profiles.js | 14 ++++++++++--- ext/bg/js/settings/storage.js | 4 +++- ext/bg/js/translator.js | 28 +++++++++++++++++++------ ext/fg/js/document.js | 6 +++++- ext/fg/js/float.js | 7 ++++++- ext/fg/js/frontend-initialize.js | 6 +++++- ext/fg/js/frontend.js | 9 +++++++- ext/fg/js/popup-nested.js | 4 +++- ext/fg/js/popup-proxy-host.js | 6 +++++- ext/fg/js/popup-proxy.js | 4 +++- ext/fg/js/popup.js | 5 ++++- ext/mixed/js/display-generator.js | 5 ++++- ext/mixed/js/display.js | 22 ++++++++++++++++---- ext/mixed/js/text-scanner.js | 6 +++++- 36 files changed, 272 insertions(+), 70 deletions(-) (limited to 'ext/bg/js/settings/backup.js') diff --git a/.eslintrc.json b/.eslintrc.json index 2730acb5..db8ff1fa 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -63,7 +63,7 @@ "semi-spacing": ["error", {"before": false, "after": true}], "space-in-parens": ["error", "never"], "space-unary-ops": "error", - "spaced-comment": ["error", "always", {"markers": ["global"]}], + "spaced-comment": ["error", "always"], "switch-colon-spacing": ["error", {"after": true, "before": false}], "template-curly-spacing": ["error", "never"], "template-tag-spacing": ["error", "never"], diff --git a/ext/bg/js/anki.js b/ext/bg/js/anki.js index 39c6ad51..a70388bd 100644 --- a/ext/bg/js/anki.js +++ b/ext/bg/js/anki.js @@ -16,7 +16,9 @@ * along with this program. If not, see . */ -/*global requestJson*/ +/* global + * requestJson + */ /* * AnkiConnect diff --git a/ext/bg/js/audio-uri-builder.js b/ext/bg/js/audio-uri-builder.js index 15cea995..499c3441 100644 --- a/ext/bg/js/audio-uri-builder.js +++ b/ext/bg/js/audio-uri-builder.js @@ -16,7 +16,9 @@ * along with this program. If not, see . */ -/*global jpIsStringEntirelyKana*/ +/* global + * jpIsStringEntirelyKana + */ class AudioUriBuilder { constructor() { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 349fb4eb..978c5a4a 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -16,13 +16,32 @@ * along with this program. If not, see . */ -/*global optionsSave, utilIsolate -conditionsTestValue, profileConditionsDescriptor -handlebarsRenderDynamic -requestText, requestJson, optionsLoad -dictConfigured, dictTermsSort, dictEnabledSet -jpConvertReading, jpDistributeFuriganaInflected, jpKatakanaToHiragana -AnkiNoteBuilder, AudioSystem, AudioUriBuilder, Translator, AnkiConnect, AnkiNull, Mecab, BackendApiForwarder, JsonSchema, ClipboardMonitor*/ +/* global + * AnkiConnect + * AnkiNoteBuilder + * AnkiNull + * AudioSystem + * AudioUriBuilder + * BackendApiForwarder + * ClipboardMonitor + * JsonSchema + * Mecab + * Translator + * conditionsTestValue + * dictConfigured + * dictEnabledSet + * dictTermsSort + * handlebarsRenderDynamic + * jpConvertReading + * jpDistributeFuriganaInflected + * jpKatakanaToHiragana + * optionsLoad + * optionsSave + * profileConditionsDescriptor + * requestJson + * requestText + * utilIsolate + */ class Backend { constructor() { diff --git a/ext/bg/js/clipboard-monitor.js b/ext/bg/js/clipboard-monitor.js index a6d73c79..9a881f57 100644 --- a/ext/bg/js/clipboard-monitor.js +++ b/ext/bg/js/clipboard-monitor.js @@ -16,7 +16,9 @@ * along with this program. If not, see . */ -/*global jpIsStringPartiallyJapanese*/ +/* global + * jpIsStringPartiallyJapanese + */ class ClipboardMonitor extends EventDispatcher { constructor({getClipboard}) { diff --git a/ext/bg/js/context.js b/ext/bg/js/context.js index 1095c7e0..c3e74656 100644 --- a/ext/bg/js/context.js +++ b/ext/bg/js/context.js @@ -16,7 +16,11 @@ * along with this program. If not, see . */ -/*global apiCommandExec, apiGetEnvironmentInfo, apiOptionsGet*/ +/* global + * apiCommandExec + * apiGetEnvironmentInfo + * apiOptionsGet + */ function showExtensionInfo() { const node = document.getElementById('extension-info'); diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js index 558f3ceb..08a2a39f 100644 --- a/ext/bg/js/database.js +++ b/ext/bg/js/database.js @@ -16,7 +16,12 @@ * along with this program. If not, see . */ -/*global dictFieldSplit, requestJson, JsonSchema, JSZip*/ +/* global + * JSZip + * JsonSchema + * dictFieldSplit + * requestJson + */ class Database { constructor() { diff --git a/ext/bg/js/handlebars.js b/ext/bg/js/handlebars.js index 3ee4e7fa..e3ce6bd0 100644 --- a/ext/bg/js/handlebars.js +++ b/ext/bg/js/handlebars.js @@ -16,7 +16,11 @@ * along with this program. If not, see . */ -/*global jpIsCodePointKanji, jpDistributeFurigana, Handlebars*/ +/* global + * Handlebars + * jpDistributeFurigana + * jpIsCodePointKanji + */ function handlebarsEscape(text) { return Handlebars.Utils.escapeExpression(text); diff --git a/ext/bg/js/japanese.js b/ext/bg/js/japanese.js index fc69dbba..3b37754d 100644 --- a/ext/bg/js/japanese.js +++ b/ext/bg/js/japanese.js @@ -16,7 +16,9 @@ * along with this program. If not, see . */ -/*global wanakana*/ +/* global + * wanakana + */ const JP_HALFWIDTH_KATAKANA_MAPPING = new Map([ ['ヲ', 'ヲヺ-'], diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index 879b4a59..bd0bbe0e 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -16,7 +16,9 @@ * along with this program. If not, see . */ -/*global utilStringHashCode*/ +/* global + * utilStringHashCode + */ /* * Generic options functions diff --git a/ext/bg/js/search-frontend.js b/ext/bg/js/search-frontend.js index 453a0b79..a470e873 100644 --- a/ext/bg/js/search-frontend.js +++ b/ext/bg/js/search-frontend.js @@ -16,7 +16,9 @@ * along with this program. If not, see . */ -/*global apiOptionsGet*/ +/* global + * apiOptionsGet + */ async function searchFrontendSetup() { await yomichan.prepare(); diff --git a/ext/bg/js/search-query-parser-generator.js b/ext/bg/js/search-query-parser-generator.js index 1ab23a82..664858a4 100644 --- a/ext/bg/js/search-query-parser-generator.js +++ b/ext/bg/js/search-query-parser-generator.js @@ -16,7 +16,10 @@ * along with this program. If not, see . */ -/*global apiGetQueryParserTemplatesHtml, TemplateHandler*/ +/* global + * TemplateHandler + * apiGetQueryParserTemplatesHtml + */ class QueryParserGenerator { constructor() { diff --git a/ext/bg/js/search-query-parser.js b/ext/bg/js/search-query-parser.js index c64d0fea..06316ce2 100644 --- a/ext/bg/js/search-query-parser.js +++ b/ext/bg/js/search-query-parser.js @@ -16,7 +16,15 @@ * along with this program. If not, see . */ -/*global apiTermsFind, apiOptionsSet, apiTextParse, apiTextParseMecab, TextScanner, QueryParserGenerator, docSentenceExtract*/ +/* global + * QueryParserGenerator + * TextScanner + * apiOptionsSet + * apiTermsFind + * apiTextParse + * apiTextParseMecab + * docSentenceExtract + */ class QueryParser extends TextScanner { constructor(search) { diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js index 5881f6f8..e2bdff73 100644 --- a/ext/bg/js/search.js +++ b/ext/bg/js/search.js @@ -16,7 +16,14 @@ * along with this program. If not, see . */ -/*global apiOptionsSet, apiTermsFind, apiClipboardGet, Display, QueryParser, ClipboardMonitor*/ +/* global + * ClipboardMonitor + * Display + * QueryParser + * apiClipboardGet + * apiOptionsSet + * apiTermsFind + */ class DisplaySearch extends Display { constructor() { diff --git a/ext/bg/js/settings/anki-templates.js b/ext/bg/js/settings/anki-templates.js index b1665048..c5222d30 100644 --- a/ext/bg/js/settings/anki-templates.js +++ b/ext/bg/js/settings/anki-templates.js @@ -16,10 +16,18 @@ * along with this program. If not, see . */ -/*global getOptionsContext, getOptionsMutable, settingsSaveOptions -ankiGetFieldMarkers, ankiGetFieldMarkersHtml -apiOptionsGet, apiTermsFind, apiGetDefaultAnkiFieldTemplates, apiTemplateRender -AnkiNoteBuilder*/ +/* global + * AnkiNoteBuilder + * ankiGetFieldMarkers + * ankiGetFieldMarkersHtml + * apiGetDefaultAnkiFieldTemplates + * apiOptionsGet + * apiTemplateRender + * apiTermsFind + * getOptionsContext + * getOptionsMutable + * settingsSaveOptions + */ function onAnkiFieldTemplatesReset(e) { e.preventDefault(); diff --git a/ext/bg/js/settings/anki.js b/ext/bg/js/settings/anki.js index 782691ab..b706cd1b 100644 --- a/ext/bg/js/settings/anki.js +++ b/ext/bg/js/settings/anki.js @@ -16,9 +16,16 @@ * along with this program. If not, see . */ -/*global getOptionsContext, getOptionsMutable, settingsSaveOptions -utilBackgroundIsolate, utilAnkiGetDeckNames, utilAnkiGetModelNames, utilAnkiGetModelFieldNames -onFormOptionsChanged*/ +/* global + * getOptionsContext + * getOptionsMutable + * onFormOptionsChanged + * settingsSaveOptions + * utilAnkiGetDeckNames + * utilAnkiGetModelFieldNames + * utilAnkiGetModelNames + * utilBackgroundIsolate + */ // Private diff --git a/ext/bg/js/settings/audio.js b/ext/bg/js/settings/audio.js index c825be6b..38dd6349 100644 --- a/ext/bg/js/settings/audio.js +++ b/ext/bg/js/settings/audio.js @@ -16,8 +16,14 @@ * along with this program. If not, see . */ -/*global getOptionsContext, getOptionsMutable, settingsSaveOptions, apiAudioGetUri -AudioSystem, AudioSourceUI*/ +/* global + * AudioSourceUI + * AudioSystem + * apiAudioGetUri + * getOptionsContext + * getOptionsMutable + * settingsSaveOptions + */ let audioSourceUI = null; let audioSystem = null; diff --git a/ext/bg/js/settings/backup.js b/ext/bg/js/settings/backup.js index daa08c61..21417dfb 100644 --- a/ext/bg/js/settings/backup.js +++ b/ext/bg/js/settings/backup.js @@ -16,9 +16,17 @@ * along with this program. If not, see . */ -/*global apiOptionsGetFull, apiGetEnvironmentInfo, apiGetDefaultAnkiFieldTemplates -utilBackend, utilIsolate, utilBackgroundIsolate, utilReadFileArrayBuffer -optionsGetDefault, optionsUpdateVersion*/ +/* global + * apiGetDefaultAnkiFieldTemplates + * apiGetEnvironmentInfo + * apiOptionsGetFull + * optionsGetDefault + * optionsUpdateVersion + * utilBackend + * utilBackgroundIsolate + * utilIsolate + * utilReadFileArrayBuffer + */ // Exporting diff --git a/ext/bg/js/settings/conditions-ui.js b/ext/bg/js/settings/conditions-ui.js index 4ca86b07..9d61d25e 100644 --- a/ext/bg/js/settings/conditions-ui.js +++ b/ext/bg/js/settings/conditions-ui.js @@ -16,7 +16,9 @@ * along with this program. If not, see . */ -/*global conditionsNormalizeOptionValue*/ +/* global + * conditionsNormalizeOptionValue + */ class ConditionsUI { static instantiateTemplate(templateSelector) { diff --git a/ext/bg/js/settings/dictionaries.js b/ext/bg/js/settings/dictionaries.js index b9551073..5e59cc3d 100644 --- a/ext/bg/js/settings/dictionaries.js +++ b/ext/bg/js/settings/dictionaries.js @@ -16,11 +16,23 @@ * along with this program. If not, see . */ -/*global getOptionsContext, getOptionsMutable, getOptionsFullMutable, settingsSaveOptions, apiOptionsGetFull, apiOptionsGet -utilBackgroundIsolate, utilDatabaseDeleteDictionary, utilDatabaseGetDictionaryInfo, utilDatabaseGetDictionaryCounts -utilDatabasePurge, utilDatabaseImport -storageUpdateStats, storageEstimate -PageExitPrevention*/ +/* global + * PageExitPrevention + * apiOptionsGet + * apiOptionsGetFull + * getOptionsContext + * getOptionsFullMutable + * getOptionsMutable + * settingsSaveOptions + * storageEstimate + * storageUpdateStats + * utilBackgroundIsolate + * utilDatabaseDeleteDictionary + * utilDatabaseGetDictionaryCounts + * utilDatabaseGetDictionaryInfo + * utilDatabaseImport + * utilDatabasePurge + */ let dictionaryUI = null; diff --git a/ext/bg/js/settings/main.js b/ext/bg/js/settings/main.js index 1bf1444c..ebc443df 100644 --- a/ext/bg/js/settings/main.js +++ b/ext/bg/js/settings/main.js @@ -16,13 +16,26 @@ * along with this program. If not, see . */ -/*global getOptionsContext, apiOptionsSave -utilBackend, utilIsolate, utilBackgroundIsolate -ankiErrorShown, ankiFieldsToDict -ankiTemplatesUpdateValue, onAnkiOptionsChanged, onDictionaryOptionsChanged -appearanceInitialize, audioSettingsInitialize, profileOptionsSetup, dictSettingsInitialize -ankiInitialize, ankiTemplatesInitialize, storageInfoInitialize, backupInitialize -*/ +/* global + * ankiErrorShown + * ankiFieldsToDict + * ankiInitialize + * ankiTemplatesInitialize + * ankiTemplatesUpdateValue + * apiOptionsSave + * appearanceInitialize + * audioSettingsInitialize + * backupInitialize + * dictSettingsInitialize + * getOptionsContext + * onAnkiOptionsChanged + * onDictionaryOptionsChanged + * profileOptionsSetup + * storageInfoInitialize + * utilBackend + * utilBackgroundIsolate + * utilIsolate + */ function getOptionsMutable(optionsContext) { return utilBackend().getOptions( diff --git a/ext/bg/js/settings/popup-preview-frame.js b/ext/bg/js/settings/popup-preview-frame.js index 1ceac177..6a149841 100644 --- a/ext/bg/js/settings/popup-preview-frame.js +++ b/ext/bg/js/settings/popup-preview-frame.js @@ -16,7 +16,13 @@ * along with this program. If not, see . */ -/*global apiOptionsGet, Popup, PopupProxyHost, Frontend, TextSourceRange*/ +/* global + * Frontend + * Popup + * PopupProxyHost + * TextSourceRange + * apiOptionsGet + */ class SettingsPopupPreview { constructor() { diff --git a/ext/bg/js/settings/profiles.js b/ext/bg/js/settings/profiles.js index f946a33a..b35b6309 100644 --- a/ext/bg/js/settings/profiles.js +++ b/ext/bg/js/settings/profiles.js @@ -16,9 +16,17 @@ * along with this program. If not, see . */ -/*global getOptionsMutable, getOptionsFullMutable, settingsSaveOptions, apiOptionsGetFull -utilBackgroundIsolate, formWrite -conditionsClearCaches, ConditionsUI, profileConditionsDescriptor*/ +/* global + * ConditionsUI + * apiOptionsGetFull + * conditionsClearCaches + * formWrite + * getOptionsFullMutable + * getOptionsMutable + * profileConditionsDescriptor + * settingsSaveOptions + * utilBackgroundIsolate + */ let currentProfileIndex = 0; let profileConditionsContainer = null; diff --git a/ext/bg/js/settings/storage.js b/ext/bg/js/settings/storage.js index 8978414e..ae305e22 100644 --- a/ext/bg/js/settings/storage.js +++ b/ext/bg/js/settings/storage.js @@ -16,7 +16,9 @@ * along with this program. If not, see . */ -/*global apiGetEnvironmentInfo*/ +/* global + * apiGetEnvironmentInfo + */ function storageBytesToLabeledString(size) { const base = 1000; diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index c01a7124..25da9bf0 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -16,12 +16,28 @@ * along with this program. If not, see . */ -/*global requestJson -dictTermsMergeBySequence, dictTagBuildSource, dictTermsMergeByGloss, dictTermsSort, dictTagsSort -dictEnabledSet, dictTermsGroup, dictTermsCompressTags, dictTermsUndupe, dictTagSanitize -jpDistributeFurigana, jpConvertHalfWidthKanaToFullWidth, jpConvertNumericTofullWidth -jpConvertAlphabeticToKana, jpHiraganaToKatakana, jpKatakanaToHiragana, jpIsCodePointJapanese -Database, Deinflector*/ +/* global + * Database + * Deinflector + * dictEnabledSet + * dictTagBuildSource + * dictTagSanitize + * dictTagsSort + * dictTermsCompressTags + * dictTermsGroup + * dictTermsMergeByGloss + * dictTermsMergeBySequence + * dictTermsSort + * dictTermsUndupe + * jpConvertAlphabeticToKana + * jpConvertHalfWidthKanaToFullWidth + * jpConvertNumericTofullWidth + * jpDistributeFurigana + * jpHiraganaToKatakana + * jpIsCodePointJapanese + * jpKatakanaToHiragana + * requestJson + */ class Translator { constructor() { diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js index 35861475..490f61bb 100644 --- a/ext/fg/js/document.js +++ b/ext/fg/js/document.js @@ -16,7 +16,11 @@ * along with this program. If not, see . */ -/*global TextSourceElement, TextSourceRange, DOM*/ +/* global + * DOM + * TextSourceElement + * TextSourceRange + */ const REGEX_TRANSPARENT_COLOR = /rgba\s*\([^)]*,\s*0(?:\.0+)?\s*\)/; diff --git a/ext/fg/js/float.js b/ext/fg/js/float.js index bc459d23..393c2719 100644 --- a/ext/fg/js/float.js +++ b/ext/fg/js/float.js @@ -16,7 +16,12 @@ * along with this program. If not, see . */ -/*global popupNestedInitialize, apiForward, apiGetMessageToken, Display*/ +/* global + * Display + * apiForward + * apiGetMessageToken + * popupNestedInitialize + */ class DisplayFloat extends Display { constructor() { diff --git a/ext/fg/js/frontend-initialize.js b/ext/fg/js/frontend-initialize.js index e674724e..8424b21d 100644 --- a/ext/fg/js/frontend-initialize.js +++ b/ext/fg/js/frontend-initialize.js @@ -16,7 +16,11 @@ * along with this program. If not, see . */ -/*global PopupProxyHost, PopupProxy, Frontend*/ +/* global + * Frontend + * PopupProxy + * PopupProxyHost + */ async function main() { await yomichan.prepare(); diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index 929ab56a..768b9326 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -16,7 +16,14 @@ * along with this program. If not, see . */ -/*global apiGetZoom, apiOptionsGet, apiTermsFind, apiKanjiFind, docSentenceExtract, TextScanner*/ +/* global + * TextScanner + * apiGetZoom + * apiKanjiFind + * apiOptionsGet + * apiTermsFind + * docSentenceExtract + */ class Frontend extends TextScanner { constructor(popup, ignoreNodes) { diff --git a/ext/fg/js/popup-nested.js b/ext/fg/js/popup-nested.js index 3e5f5b80..06f8fc4b 100644 --- a/ext/fg/js/popup-nested.js +++ b/ext/fg/js/popup-nested.js @@ -16,7 +16,9 @@ * along with this program. If not, see . */ -/*global apiOptionsGet*/ +/* global + * apiOptionsGet + */ let popupNestedInitialized = false; diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js index 49123ee1..793d3949 100644 --- a/ext/fg/js/popup-proxy-host.js +++ b/ext/fg/js/popup-proxy-host.js @@ -16,7 +16,11 @@ * along with this program. If not, see . */ -/*global apiFrameInformationGet, FrontendApiReceiver, Popup*/ +/* global + * FrontendApiReceiver + * Popup + * apiFrameInformationGet + */ class PopupProxyHost { constructor() { diff --git a/ext/fg/js/popup-proxy.js b/ext/fg/js/popup-proxy.js index 093cdd2e..f7cef214 100644 --- a/ext/fg/js/popup-proxy.js +++ b/ext/fg/js/popup-proxy.js @@ -16,7 +16,9 @@ * along with this program. If not, see . */ -/*global FrontendApiSender*/ +/* global + * FrontendApiSender + */ class PopupProxy { constructor(id, depth, parentId, parentFrameId, url) { diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index bc40a8c4..d752812e 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -16,7 +16,10 @@ * along with this program. If not, see . */ -/*global apiInjectStylesheet, apiGetMessageToken*/ +/* global + * apiGetMessageToken + * apiInjectStylesheet + */ class Popup { constructor(id, depth, frameIdPromise) { diff --git a/ext/mixed/js/display-generator.js b/ext/mixed/js/display-generator.js index 470e2a15..49afc44b 100644 --- a/ext/mixed/js/display-generator.js +++ b/ext/mixed/js/display-generator.js @@ -16,7 +16,10 @@ * along with this program. If not, see . */ -/*global apiGetDisplayTemplatesHtml, TemplateHandler*/ +/* global + * TemplateHandler + * apiGetDisplayTemplatesHtml + */ class DisplayGenerator { constructor() { diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index a220c1f7..515e28a7 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -16,10 +16,24 @@ * along with this program. If not, see . */ -/*global docRangeFromPoint, docSentenceExtract -apiKanjiFind, apiTermsFind, apiNoteView, apiOptionsGet, apiDefinitionsAddable, apiDefinitionAdd -apiScreenshotGet, apiForward, apiAudioGetUri -AudioSystem, DisplayGenerator, WindowScroll, DisplayContext, DOM*/ +/* global + * AudioSystem + * DOM + * DisplayContext + * DisplayGenerator + * WindowScroll + * apiAudioGetUri + * apiDefinitionAdd + * apiDefinitionsAddable + * apiForward + * apiKanjiFind + * apiNoteView + * apiOptionsGet + * apiScreenshotGet + * apiTermsFind + * docRangeFromPoint + * docSentenceExtract + */ class Display { constructor(spinner, container) { diff --git a/ext/mixed/js/text-scanner.js b/ext/mixed/js/text-scanner.js index ff0eac8b..a08e09fb 100644 --- a/ext/mixed/js/text-scanner.js +++ b/ext/mixed/js/text-scanner.js @@ -16,7 +16,11 @@ * along with this program. If not, see . */ -/*global docRangeFromPoint, TextSourceRange, DOM*/ +/* global + * DOM + * TextSourceRange + * docRangeFromPoint + */ class TextScanner { constructor(node, ignoreNodes, ignoreElements, ignorePoints) { -- cgit v1.2.3