From e2c5c16da68bb982e59dc69f469b2d13faa2f0b3 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 8 Dec 2019 20:53:42 -0500 Subject: Update backend message handlers --- ext/bg/js/backend.js | 129 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 103 insertions(+), 26 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index d9f9b586..32b6d4e9 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -72,17 +72,20 @@ class Backend { } onMessage({action, params}, sender, callback) { - const handlers = Backend.messageHandlers; - if (hasOwn(handlers, action)) { - const handler = handlers[action]; - const promise = handler(params, sender); + const handler = Backend._messageHandlers.get(action); + if (typeof handler !== 'function') { return false; } + + try { + const promise = handler(this, params, sender); promise.then( (result) => callback({result}), (error) => callback({error: errorToJson(error)}) ); + return true; + } catch (error) { + callback({error: errorToJson(error)}); + return false; } - - return true; } applyOptions() { @@ -180,28 +183,102 @@ class Backend { checkLastError() { // NOP } + + // Message handlers + + _onApiOptionsGet({optionsContext}) { + return apiOptionsGet(optionsContext); + } + + _onApiOptionsSet({changedOptions, optionsContext, source}) { + return apiOptionsSet(changedOptions, optionsContext, source); + } + + _onApiKanjiFind({text, optionsContext}) { + return apiKanjiFind(text, optionsContext); + } + + _onApiTermsFind({text, details, optionsContext}) { + return apiTermsFind(text, details, optionsContext); + } + + _onApiTextParse({text, optionsContext}) { + return apiTextParse(text, optionsContext); + } + + _onApiTextParseMecab({text, optionsContext}) { + return apiTextParseMecab(text, optionsContext); + } + + _onApiDefinitionAdd({definition, mode, context, optionsContext}) { + return apiDefinitionAdd(definition, mode, context, optionsContext); + } + + _onApiDefinitionsAddable({definitions, modes, optionsContext}) { + return apiDefinitionsAddable(definitions, modes, optionsContext); + } + + _onApiNoteView({noteId}) { + return apiNoteView(noteId); + } + + _onApiTemplateRender({template, data, dynamic}) { + return apiTemplateRender(template, data, dynamic); + } + + _onApiCommandExec({command, params}) { + return apiCommandExec(command, params); + } + + _onApiAudioGetUrl({definition, source, optionsContext}) { + return apiAudioGetUrl(definition, source, optionsContext); + } + + _onApiScreenshotGet({options}, sender) { + return apiScreenshotGet(options, sender); + } + + _onApiForward({action, params}, sender) { + return apiForward(action, params, sender); + } + + _onApiFrameInformationGet(params, sender) { + return apiFrameInformationGet(sender); + } + + _onApiInjectStylesheet({css}, sender) { + return apiInjectStylesheet(css, sender); + } + + _onApiGetEnvironmentInfo() { + return apiGetEnvironmentInfo(); + } + + _onApiClipboardGet() { + return apiClipboardGet(); + } } -Backend.messageHandlers = { - optionsGet: ({optionsContext}) => apiOptionsGet(optionsContext), - optionsSet: ({changedOptions, optionsContext, source}) => apiOptionsSet(changedOptions, optionsContext, source), - kanjiFind: ({text, optionsContext}) => apiKanjiFind(text, optionsContext), - termsFind: ({text, details, optionsContext}) => apiTermsFind(text, details, optionsContext), - textParse: ({text, optionsContext}) => apiTextParse(text, optionsContext), - textParseMecab: ({text, optionsContext}) => apiTextParseMecab(text, optionsContext), - definitionAdd: ({definition, mode, context, optionsContext}) => apiDefinitionAdd(definition, mode, context, optionsContext), - definitionsAddable: ({definitions, modes, optionsContext}) => apiDefinitionsAddable(definitions, modes, optionsContext), - noteView: ({noteId}) => apiNoteView(noteId), - templateRender: ({template, data, dynamic}) => apiTemplateRender(template, data, dynamic), - commandExec: ({command, params}) => apiCommandExec(command, params), - audioGetUrl: ({definition, source, optionsContext}) => apiAudioGetUrl(definition, source, optionsContext), - screenshotGet: ({options}, sender) => apiScreenshotGet(options, sender), - forward: ({action, params}, sender) => apiForward(action, params, sender), - frameInformationGet: (params, sender) => apiFrameInformationGet(sender), - injectStylesheet: ({css}, sender) => apiInjectStylesheet(css, sender), - getEnvironmentInfo: () => apiGetEnvironmentInfo(), - clipboardGet: () => apiClipboardGet() -}; +Backend._messageHandlers = new Map([ + ['optionsGet', (self, ...args) => self._onApiOptionsGet(...args)], + ['optionsSet', (self, ...args) => self._onApiOptionsSet(...args)], + ['kanjiFind', (self, ...args) => self._onApiKanjiFind(...args)], + ['termsFind', (self, ...args) => self._onApiTermsFind(...args)], + ['textParse', (self, ...args) => self._onApiTextParse(...args)], + ['textParseMecab', (self, ...args) => self._onApiTextParseMecab(...args)], + ['definitionAdd', (self, ...args) => self._onApiDefinitionAdd(...args)], + ['definitionsAddable', (self, ...args) => self._onApiDefinitionsAddable(...args)], + ['noteView', (self, ...args) => self._onApiNoteView(...args)], + ['templateRender', (self, ...args) => self._onApiTemplateRender(...args)], + ['commandExec', (self, ...args) => self._onApiCommandExec(...args)], + ['audioGetUrl', (self, ...args) => self._onApiAudioGetUrl(...args)], + ['screenshotGet', (self, ...args) => self._onApiScreenshotGet(...args)], + ['forward', (self, ...args) => self._onApiForward(...args)], + ['frameInformationGet', (self, ...args) => self._onApiFrameInformationGet(...args)], + ['injectStylesheet', (self, ...args) => self._onApiInjectStylesheet(...args)], + ['getEnvironmentInfo', (self, ...args) => self._onApiGetEnvironmentInfo(...args)], + ['clipboardGet', (self, ...args) => self._onApiClipboardGet(...args)] +]); window.yomichan_backend = new Backend(); window.yomichan_backend.prepare(); -- cgit v1.2.3 From 7addf5a2ddd345bceb7aa0ee492ad51c25019e1a Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:00:49 -0500 Subject: Add API calls for optionsGetFull and optionsSave --- ext/bg/js/backend.js | 10 ++++++++++ ext/fg/js/api.js | 8 ++++++++ 2 files changed, 18 insertions(+) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 32b6d4e9..72802ea1 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -190,10 +190,18 @@ class Backend { return apiOptionsGet(optionsContext); } + _onApiOptionsGetFull() { + return apiOptionsGetFull(); + } + _onApiOptionsSet({changedOptions, optionsContext, source}) { return apiOptionsSet(changedOptions, optionsContext, source); } + _onApiOptionsSave({source}) { + return apiOptionsSave(source); + } + _onApiKanjiFind({text, optionsContext}) { return apiKanjiFind(text, optionsContext); } @@ -261,7 +269,9 @@ class Backend { Backend._messageHandlers = new Map([ ['optionsGet', (self, ...args) => self._onApiOptionsGet(...args)], + ['optionsGetFull', (self, ...args) => self._onApiOptionsGetFull(...args)], ['optionsSet', (self, ...args) => self._onApiOptionsSet(...args)], + ['optionsSave', (self, ...args) => self._onApiOptionsSave(...args)], ['kanjiFind', (self, ...args) => self._onApiKanjiFind(...args)], ['termsFind', (self, ...args) => self._onApiTermsFind(...args)], ['textParse', (self, ...args) => self._onApiTextParse(...args)], diff --git a/ext/fg/js/api.js b/ext/fg/js/api.js index 0e100b59..ae74b8dc 100644 --- a/ext/fg/js/api.js +++ b/ext/fg/js/api.js @@ -21,10 +21,18 @@ function apiOptionsGet(optionsContext) { return _apiInvoke('optionsGet', {optionsContext}); } +function apiOptionsGetFull() { + return _apiInvoke('optionsGetFull'); +} + function apiOptionsSet(changedOptions, optionsContext, source) { return _apiInvoke('optionsSet', {changedOptions, optionsContext, source}); } +function apiOptionsSave(source) { + return _apiInvoke('optionsSave', {source}); +} + function apiTermsFind(text, details, optionsContext) { return _apiInvoke('termsFind', {text, details, optionsContext}); } -- cgit v1.2.3 From 4922d3433dbd5472295ac7d6721e1ecac3707da1 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:05:15 -0500 Subject: Move apiOptionsGet implementation into Backend --- ext/bg/js/api.js | 2 +- ext/bg/js/backend.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 5c9c7ab0..21a70ba7 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -18,7 +18,7 @@ function apiOptionsGet(optionsContext) { - return utilBackend().getOptions(optionsContext); + return utilBackend()._onApiOptionsGet({optionsContext}); } async function apiOptionsSet(changedOptions, optionsContext, source) { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 72802ea1..65f9ab4c 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -187,7 +187,7 @@ class Backend { // Message handlers _onApiOptionsGet({optionsContext}) { - return apiOptionsGet(optionsContext); + return this.getOptions(optionsContext); } _onApiOptionsGetFull() { -- cgit v1.2.3 From d6fe5c3e46bfba996e42f94b4303f1106a7fcdab Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:08:11 -0500 Subject: Move apiOptionsGetFull implementation into Backend --- ext/bg/js/api.js | 2 +- ext/bg/js/backend.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 21a70ba7..95ac782e 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -62,7 +62,7 @@ async function apiOptionsSet(changedOptions, optionsContext, source) { } function apiOptionsGetFull() { - return utilBackend().getFullOptions(); + return utilBackend()._onApiOptionsGetFull(); } async function apiOptionsSave(source) { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 65f9ab4c..6e3dfae6 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -191,7 +191,7 @@ class Backend { } _onApiOptionsGetFull() { - return apiOptionsGetFull(); + return this.getFullOptions(); } _onApiOptionsSet({changedOptions, optionsContext, source}) { -- cgit v1.2.3 From 6a1cfbaad62bc60e8415821039e028432d64b549 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:07:18 -0500 Subject: Move apiOptionsSet implementation into Backend --- ext/bg/js/api.js | 40 ++-------------------------------------- ext/bg/js/backend.js | 40 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 40 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 95ac782e..4c55c6e3 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -21,44 +21,8 @@ function apiOptionsGet(optionsContext) { return utilBackend()._onApiOptionsGet({optionsContext}); } -async function apiOptionsSet(changedOptions, optionsContext, source) { - const options = await apiOptionsGet(optionsContext); - - function getValuePaths(obj) { - const valuePaths = []; - const nodes = [{obj, path: []}]; - while (nodes.length > 0) { - const node = nodes.pop(); - for (const key of Object.keys(node.obj)) { - const path = node.path.concat(key); - const obj = node.obj[key]; - if (obj !== null && typeof obj === 'object') { - nodes.unshift({obj, path}); - } else { - valuePaths.push([obj, path]); - } - } - } - return valuePaths; - } - - function modifyOption(path, value, options) { - let pivot = options; - for (const key of path.slice(0, -1)) { - if (!hasOwn(pivot, key)) { - return false; - } - pivot = pivot[key]; - } - pivot[path[path.length - 1]] = value; - return true; - } - - for (const [value, path] of getValuePaths(changedOptions)) { - modifyOption(path, value, options); - } - - await apiOptionsSave(source); +function apiOptionsSet(changedOptions, optionsContext, source) { + return utilBackend()._onApiOptionsSet({changedOptions, optionsContext, source}); } function apiOptionsGetFull() { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 6e3dfae6..74cd2ab4 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -194,8 +194,44 @@ class Backend { return this.getFullOptions(); } - _onApiOptionsSet({changedOptions, optionsContext, source}) { - return apiOptionsSet(changedOptions, optionsContext, source); + async _onApiOptionsSet({changedOptions, optionsContext, source}) { + const options = await this.getOptions(optionsContext); + + function getValuePaths(obj) { + const valuePaths = []; + const nodes = [{obj, path: []}]; + while (nodes.length > 0) { + const node = nodes.pop(); + for (const key of Object.keys(node.obj)) { + const path = node.path.concat(key); + const obj = node.obj[key]; + if (obj !== null && typeof obj === 'object') { + nodes.unshift({obj, path}); + } else { + valuePaths.push([obj, path]); + } + } + } + return valuePaths; + } + + function modifyOption(path, value, options) { + let pivot = options; + for (const key of path.slice(0, -1)) { + if (!hasOwn(pivot, key)) { + return false; + } + pivot = pivot[key]; + } + pivot[path[path.length - 1]] = value; + return true; + } + + for (const [value, path] of getValuePaths(changedOptions)) { + modifyOption(path, value, options); + } + + await this._optionsSave({source}); } _onApiOptionsSave({source}) { -- cgit v1.2.3 From 8dff73679e909dab8f325cc9458cf5c40c9be485 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:11:10 -0500 Subject: Move apiOptionsSave implementation into Backend --- ext/bg/js/api.js | 7 ++----- ext/bg/js/backend.js | 6 ++++-- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 4c55c6e3..3e821333 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -29,11 +29,8 @@ function apiOptionsGetFull() { return utilBackend()._onApiOptionsGetFull(); } -async function apiOptionsSave(source) { - const backend = utilBackend(); - const options = await apiOptionsGetFull(); - await optionsSave(options); - backend.onOptionsUpdated(source); +function apiOptionsSave(source) { + return utilBackend()._onApiOptionsSave({source}); } async function apiTermsFind(text, details, optionsContext) { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 74cd2ab4..5753e16e 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -234,8 +234,10 @@ class Backend { await this._optionsSave({source}); } - _onApiOptionsSave({source}) { - return apiOptionsSave(source); + async _onApiOptionsSave({source}) { + const options = await this.getFullOptions(); + await optionsSave(options); + this.onOptionsUpdated(source); } _onApiKanjiFind({text, optionsContext}) { -- cgit v1.2.3 From 5cceba15e2db85f77dd80b24f1ad25b18775df94 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:13:03 -0500 Subject: Move apiKanjiFind implementation into Backend --- ext/bg/js/api.js | 7 ++----- ext/bg/js/backend.js | 7 +++++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 3e821333..474365ae 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -105,11 +105,8 @@ async function apiTextParseMecab(text, optionsContext) { return results; } -async function apiKanjiFind(text, optionsContext) { - const options = await apiOptionsGet(optionsContext); - const definitions = await utilBackend().translator.findKanji(text, options); - definitions.splice(options.general.maxResults); - return definitions; +function apiKanjiFind(text, optionsContext) { + return utilBackend()._onApiKanjiFind({text, optionsContext}); } async function apiDefinitionAdd(definition, mode, context, optionsContext) { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 5753e16e..0cac68f8 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -240,8 +240,11 @@ class Backend { this.onOptionsUpdated(source); } - _onApiKanjiFind({text, optionsContext}) { - return apiKanjiFind(text, optionsContext); + async _onApiKanjiFind({text, optionsContext}) { + const options = await this.getOptions(optionsContext); + const definitions = await this.translator.findKanji(text, options); + definitions.splice(options.general.maxResults); + return definitions; } _onApiTermsFind({text, details, optionsContext}) { -- cgit v1.2.3 From 73ce2fe3d3572faa194735052b1448f6a46fa969 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:15:37 -0500 Subject: Move apiTermsFind implementation into Backend --- ext/bg/js/api.js | 7 ++----- ext/bg/js/backend.js | 7 +++++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 474365ae..d361bde7 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -33,11 +33,8 @@ function apiOptionsSave(source) { return utilBackend()._onApiOptionsSave({source}); } -async function apiTermsFind(text, details, optionsContext) { - const options = await apiOptionsGet(optionsContext); - const [definitions, length] = await utilBackend().translator.findTerms(text, details, options); - definitions.splice(options.general.maxResults); - return {length, definitions}; +function apiTermsFind(text, details, optionsContext) { + return utilBackend()._onApiTermsFind({text, details, optionsContext}); } async function apiTextParse(text, optionsContext) { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 0cac68f8..4c3b3dfa 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -247,8 +247,11 @@ class Backend { return definitions; } - _onApiTermsFind({text, details, optionsContext}) { - return apiTermsFind(text, details, optionsContext); + async _onApiTermsFind({text, details, optionsContext}) { + const options = await this.getOptions(optionsContext); + const [definitions, length] = await this.translator.findTerms(text, details, options); + definitions.splice(options.general.maxResults); + return {length, definitions}; } _onApiTextParse({text, optionsContext}) { -- cgit v1.2.3 From ddad034aa6b8d3b67871af9bc2409412da29ec84 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:18:23 -0500 Subject: Move apiTextParse implementation into Backend --- ext/bg/js/api.js | 32 ++------------------------------ ext/bg/js/backend.js | 30 ++++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 32 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index d361bde7..7a4c2dcf 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -37,36 +37,8 @@ function apiTermsFind(text, details, optionsContext) { return utilBackend()._onApiTermsFind({text, details, optionsContext}); } -async function apiTextParse(text, optionsContext) { - const options = await apiOptionsGet(optionsContext); - const translator = utilBackend().translator; - - const results = []; - while (text.length > 0) { - const term = []; - const [definitions, sourceLength] = await translator.findTermsInternal( - text.substring(0, options.scanning.length), - dictEnabledSet(options), - options.scanning.alphanumeric, - {} - ); - if (definitions.length > 0) { - dictTermsSort(definitions); - const {expression, reading} = definitions[0]; - const source = text.substring(0, sourceLength); - for (const {text, furigana} of jpDistributeFuriganaInflected(expression, reading, source)) { - const reading = jpConvertReading(text, furigana, options.parsing.readingMode); - term.push({text, reading}); - } - text = text.substring(source.length); - } else { - const reading = jpConvertReading(text[0], null, options.parsing.readingMode); - term.push({text: text[0], reading}); - text = text.substring(1); - } - results.push(term); - } - return results; +function apiTextParse(text, optionsContext) { + return utilBackend()._onApiTextParse({text, optionsContext}); } async function apiTextParseMecab(text, optionsContext) { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 4c3b3dfa..56bd4fca 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -254,8 +254,34 @@ class Backend { return {length, definitions}; } - _onApiTextParse({text, optionsContext}) { - return apiTextParse(text, optionsContext); + async _onApiTextParse({text, optionsContext}) { + const options = await this.getOptions(optionsContext); + const results = []; + while (text.length > 0) { + const term = []; + const [definitions, sourceLength] = await this.translator.findTermsInternal( + text.substring(0, options.scanning.length), + dictEnabledSet(options), + options.scanning.alphanumeric, + {} + ); + if (definitions.length > 0) { + dictTermsSort(definitions); + const {expression, reading} = definitions[0]; + const source = text.substring(0, sourceLength); + for (const {text, furigana} of jpDistributeFuriganaInflected(expression, reading, source)) { + const reading = jpConvertReading(text, furigana, options.parsing.readingMode); + term.push({text, reading}); + } + text = text.substring(source.length); + } else { + const reading = jpConvertReading(text[0], null, options.parsing.readingMode); + term.push({text: text[0], reading}); + text = text.substring(1); + } + results.push(term); + } + return results; } _onApiTextParseMecab({text, optionsContext}) { -- cgit v1.2.3 From 7091c8c5c0a48630b1ca3b2ab500c131cec19a14 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:21:17 -0500 Subject: Move apiTextParseMecab implementation into Backend --- ext/bg/js/api.js | 33 ++------------------------------- ext/bg/js/backend.js | 31 +++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 33 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 7a4c2dcf..3be6ac56 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -41,37 +41,8 @@ function apiTextParse(text, optionsContext) { return utilBackend()._onApiTextParse({text, optionsContext}); } -async function apiTextParseMecab(text, optionsContext) { - const options = await apiOptionsGet(optionsContext); - const mecab = utilBackend().mecab; - - const results = {}; - const rawResults = await mecab.parseText(text); - for (const mecabName in rawResults) { - const result = []; - for (const parsedLine of rawResults[mecabName]) { - for (const {expression, reading, source} of parsedLine) { - const term = []; - if (expression !== null && reading !== null) { - for (const {text, furigana} of jpDistributeFuriganaInflected( - expression, - jpKatakanaToHiragana(reading), - source - )) { - const reading = jpConvertReading(text, furigana, options.parsing.readingMode); - term.push({text, reading}); - } - } else { - const reading = jpConvertReading(source, null, options.parsing.readingMode); - term.push({text: source, reading}); - } - result.push(term); - } - result.push([{text: '\n'}]); - } - results[mecabName] = result; - } - return results; +function apiTextParseMecab(text, optionsContext) { + return utilBackend()._onApiTextParseMecab({text, optionsContext}); } function apiKanjiFind(text, optionsContext) { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 56bd4fca..67197cf7 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -284,8 +284,35 @@ class Backend { return results; } - _onApiTextParseMecab({text, optionsContext}) { - return apiTextParseMecab(text, optionsContext); + async _onApiTextParseMecab({text, optionsContext}) { + const options = await this.getOptions(optionsContext); + const results = {}; + const rawResults = await this.mecab.parseText(text); + for (const mecabName in rawResults) { + const result = []; + for (const parsedLine of rawResults[mecabName]) { + for (const {expression, reading, source} of parsedLine) { + const term = []; + if (expression !== null && reading !== null) { + for (const {text, furigana} of jpDistributeFuriganaInflected( + expression, + jpKatakanaToHiragana(reading), + source + )) { + const reading = jpConvertReading(text, furigana, options.parsing.readingMode); + term.push({text, reading}); + } + } else { + const reading = jpConvertReading(source, null, options.parsing.readingMode); + term.push({text: source, reading}); + } + result.push(term); + } + result.push([{text: '\n'}]); + } + results[mecabName] = result; + } + return results; } _onApiDefinitionAdd({definition, mode, context, optionsContext}) { -- cgit v1.2.3 From c9cd29889dc72ce4b35ab16bfc7294ec3d008697 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:25:34 -0500 Subject: Move apiDefinitionAdd implementation into Backend --- ext/bg/js/api.js | 60 ++------------------------------------------------ ext/bg/js/backend.js | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 60 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 3be6ac56..2ce90b5c 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -49,28 +49,8 @@ function apiKanjiFind(text, optionsContext) { return utilBackend()._onApiKanjiFind({text, optionsContext}); } -async function apiDefinitionAdd(definition, mode, context, optionsContext) { - const options = await apiOptionsGet(optionsContext); - - if (mode !== 'kanji') { - await audioInject( - definition, - options.anki.terms.fields, - options.audio.sources, - optionsContext - ); - } - - if (context && context.screenshot) { - await _apiInjectScreenshot( - definition, - options.anki.terms.fields, - context.screenshot - ); - } - - const note = await dictNoteFormat(definition, mode, options); - return utilBackend().anki.addNote(note); +function apiDefinitionAdd(definition, mode, context, optionsContext) { + return utilBackend()._onApiDefinitionAdd({definition, mode, context, optionsContext}); } async function apiDefinitionsAddable(definitions, modes, optionsContext) { @@ -189,42 +169,6 @@ async function apiAudioGetUrl(definition, source, optionsContext) { return audioGetUrl(definition, source, optionsContext); } -async function _apiInjectScreenshot(definition, fields, screenshot) { - let usesScreenshot = false; - for (const name in fields) { - if (fields[name].includes('{screenshot}')) { - usesScreenshot = true; - break; - } - } - - if (!usesScreenshot) { - return; - } - - const dateToString = (date) => { - const year = date.getUTCFullYear(); - const month = date.getUTCMonth().toString().padStart(2, '0'); - const day = date.getUTCDate().toString().padStart(2, '0'); - const hours = date.getUTCHours().toString().padStart(2, '0'); - const minutes = date.getUTCMinutes().toString().padStart(2, '0'); - const seconds = date.getUTCSeconds().toString().padStart(2, '0'); - return `${year}-${month}-${day}-${hours}-${minutes}-${seconds}`; - }; - - const now = new Date(Date.now()); - const filename = `yomichan_browser_screenshot_${definition.reading}_${dateToString(now)}.${screenshot.format}`; - const data = screenshot.dataUrl.replace(/^data:[\w\W]*?,/, ''); - - try { - await utilBackend().anki.storeMediaFile(filename, data); - } catch (e) { - return; - } - - definition.screenshotFileName = filename; -} - function apiScreenshotGet(options, sender) { if (!(sender && sender.tab)) { return Promise.resolve(); diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 67197cf7..726a1714 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -315,8 +315,28 @@ class Backend { return results; } - _onApiDefinitionAdd({definition, mode, context, optionsContext}) { - return apiDefinitionAdd(definition, mode, context, optionsContext); + async _onApiDefinitionAdd({definition, mode, context, optionsContext}) { + const options = await this.getOptions(optionsContext); + + if (mode !== 'kanji') { + await audioInject( + definition, + options.anki.terms.fields, + options.audio.sources, + optionsContext + ); + } + + if (context && context.screenshot) { + await this._injectScreenshot( + definition, + options.anki.terms.fields, + context.screenshot + ); + } + + const note = await dictNoteFormat(definition, mode, options); + return this.anki.addNote(note); } _onApiDefinitionsAddable({definitions, modes, optionsContext}) { @@ -362,6 +382,44 @@ class Backend { _onApiClipboardGet() { return apiClipboardGet(); } + + // Utilities + + async _injectScreenshot(definition, fields, screenshot) { + let usesScreenshot = false; + for (const name in fields) { + if (fields[name].includes('{screenshot}')) { + usesScreenshot = true; + break; + } + } + + if (!usesScreenshot) { + return; + } + + const dateToString = (date) => { + const year = date.getUTCFullYear(); + const month = date.getUTCMonth().toString().padStart(2, '0'); + const day = date.getUTCDate().toString().padStart(2, '0'); + const hours = date.getUTCHours().toString().padStart(2, '0'); + const minutes = date.getUTCMinutes().toString().padStart(2, '0'); + const seconds = date.getUTCSeconds().toString().padStart(2, '0'); + return `${year}-${month}-${day}-${hours}-${minutes}-${seconds}`; + }; + + const now = new Date(Date.now()); + const filename = `yomichan_browser_screenshot_${definition.reading}_${dateToString(now)}.${screenshot.format}`; + const data = screenshot.dataUrl.replace(/^data:[\w\W]*?,/, ''); + + try { + await this.anki.storeMediaFile(filename, data); + } catch (e) { + return; + } + + definition.screenshotFileName = filename; + } } Backend._messageHandlers = new Map([ -- cgit v1.2.3 From 233ed4d0fb32291d9ba3f9b0a358496bf1093fb4 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:28:27 -0500 Subject: Move apiDefinitionsAddable implementation into Backend --- ext/bg/js/api.js | 47 ++--------------------------------------------- ext/bg/js/backend.js | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 47 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 2ce90b5c..497d81bf 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -53,51 +53,8 @@ function apiDefinitionAdd(definition, mode, context, optionsContext) { return utilBackend()._onApiDefinitionAdd({definition, mode, context, optionsContext}); } -async function apiDefinitionsAddable(definitions, modes, optionsContext) { - const options = await apiOptionsGet(optionsContext); - const states = []; - - try { - const notes = []; - for (const definition of definitions) { - for (const mode of modes) { - const note = await dictNoteFormat(definition, mode, options); - notes.push(note); - } - } - - const cannotAdd = []; - const anki = utilBackend().anki; - const results = await anki.canAddNotes(notes); - for (let resultBase = 0; resultBase < results.length; resultBase += modes.length) { - const state = {}; - for (let modeOffset = 0; modeOffset < modes.length; ++modeOffset) { - const index = resultBase + modeOffset; - const result = results[index]; - const info = {canAdd: result}; - state[modes[modeOffset]] = info; - if (!result) { - cannotAdd.push([notes[index], info]); - } - } - - states.push(state); - } - - if (cannotAdd.length > 0) { - const noteIdsArray = await anki.findNoteIds(cannotAdd.map((e) => e[0])); - for (let i = 0, ii = Math.min(cannotAdd.length, noteIdsArray.length); i < ii; ++i) { - const noteIds = noteIdsArray[i]; - if (noteIds.length > 0) { - cannotAdd[i][1].noteId = noteIds[0]; - } - } - } - } catch (e) { - // NOP - } - - return states; +function apiDefinitionsAddable(definitions, modes, optionsContext) { + return utilBackend()._onApiDefinitionsAddable({definitions, modes, optionsContext}); } async function apiNoteView(noteId) { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 726a1714..77dc0d33 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -339,8 +339,50 @@ class Backend { return this.anki.addNote(note); } - _onApiDefinitionsAddable({definitions, modes, optionsContext}) { - return apiDefinitionsAddable(definitions, modes, optionsContext); + async _onApiDefinitionsAddable({definitions, modes, optionsContext}) { + const options = await this.getOptions(optionsContext); + const states = []; + + try { + const notes = []; + for (const definition of definitions) { + for (const mode of modes) { + const note = await dictNoteFormat(definition, mode, options); + notes.push(note); + } + } + + const cannotAdd = []; + const results = await this.anki.canAddNotes(notes); + for (let resultBase = 0; resultBase < results.length; resultBase += modes.length) { + const state = {}; + for (let modeOffset = 0; modeOffset < modes.length; ++modeOffset) { + const index = resultBase + modeOffset; + const result = results[index]; + const info = {canAdd: result}; + state[modes[modeOffset]] = info; + if (!result) { + cannotAdd.push([notes[index], info]); + } + } + + states.push(state); + } + + if (cannotAdd.length > 0) { + const noteIdsArray = await this.anki.findNoteIds(cannotAdd.map((e) => e[0])); + for (let i = 0, ii = Math.min(cannotAdd.length, noteIdsArray.length); i < ii; ++i) { + const noteIds = noteIdsArray[i]; + if (noteIds.length > 0) { + cannotAdd[i][1].noteId = noteIds[0]; + } + } + } + } catch (e) { + // NOP + } + + return states; } _onApiNoteView({noteId}) { -- cgit v1.2.3 From 5a743505528cc2cc96ab6bf41a7460c75f6c084c Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:29:48 -0500 Subject: Move apiNoteView implementation into Backend --- ext/bg/js/api.js | 4 ++-- ext/bg/js/backend.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 497d81bf..9de1fb4b 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -57,8 +57,8 @@ function apiDefinitionsAddable(definitions, modes, optionsContext) { return utilBackend()._onApiDefinitionsAddable({definitions, modes, optionsContext}); } -async function apiNoteView(noteId) { - return utilBackend().anki.guiBrowse(`nid:${noteId}`); +function apiNoteView(noteId) { + return utilBackend()._onApiNoteView({noteId}); } async function apiTemplateRender(template, data, dynamic) { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 77dc0d33..4db88365 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -385,8 +385,8 @@ class Backend { return states; } - _onApiNoteView({noteId}) { - return apiNoteView(noteId); + async _onApiNoteView({noteId}) { + return this.anki.guiBrowse(`nid:${noteId}`); } _onApiTemplateRender({template, data, dynamic}) { -- cgit v1.2.3 From f07207c9bfd940cc77345d38cbfd780fda1e065c Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:31:03 -0500 Subject: Move apiTemplateRender implementation into Backend --- ext/bg/js/api.js | 8 ++------ ext/bg/js/backend.js | 8 ++++++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 9de1fb4b..f4818854 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -61,12 +61,8 @@ function apiNoteView(noteId) { return utilBackend()._onApiNoteView({noteId}); } -async function apiTemplateRender(template, data, dynamic) { - if (dynamic) { - return handlebarsRenderDynamic(template, data); - } else { - return handlebarsRenderStatic(template, data); - } +function apiTemplateRender(template, data, dynamic) { + return utilBackend()._onApiTemplateRender({template, data, dynamic}); } async function apiCommandExec(command, params) { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 4db88365..38dbd0f1 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -389,8 +389,12 @@ class Backend { return this.anki.guiBrowse(`nid:${noteId}`); } - _onApiTemplateRender({template, data, dynamic}) { - return apiTemplateRender(template, data, dynamic); + async _onApiTemplateRender({template, data, dynamic}) { + return ( + dynamic ? + handlebarsRenderDynamic(template, data) : + handlebarsRenderStatic(template, data) + ); } _onApiCommandExec({command, params}) { -- cgit v1.2.3 From f63220b6c501b1a2697e75ba407adb21dbb980b9 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:41:24 -0500 Subject: Move apiCommandExec implementation into Backend --- ext/bg/js/api.js | 134 +---------------------------------------------- ext/bg/js/backend.js | 143 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 143 insertions(+), 134 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index f4818854..1c3ad110 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -65,58 +65,9 @@ function apiTemplateRender(template, data, dynamic) { return utilBackend()._onApiTemplateRender({template, data, dynamic}); } -async function apiCommandExec(command, params) { - const handlers = apiCommandExec.handlers; - if (hasOwn(handlers, command)) { - const handler = handlers[command]; - handler(params); - } +function apiCommandExec(command, params) { + return utilBackend()._onApiCommandExec({command, params}); } -apiCommandExec.handlers = { - search: async (params) => { - const url = chrome.runtime.getURL('/bg/search.html'); - if (!(params && params.newTab)) { - try { - const tab = await _apiFindTab(1000, (url2) => ( - url2 !== null && - url2.startsWith(url) && - (url2.length === url.length || url2[url.length] === '?' || url2[url.length] === '#') - )); - if (tab !== null) { - await _apiFocusTab(tab); - return; - } - } catch (e) { - // NOP - } - } - chrome.tabs.create({url}); - }, - - help: () => { - chrome.tabs.create({url: 'https://foosoft.net/projects/yomichan/'}); - }, - - options: (params) => { - if (!(params && params.newTab)) { - chrome.runtime.openOptionsPage(); - } else { - const manifest = chrome.runtime.getManifest(); - const url = chrome.runtime.getURL(manifest.options_ui.page); - chrome.tabs.create({url}); - } - }, - - toggle: async () => { - const optionsContext = { - depth: 0, - url: window.location.href - }; - const options = await apiOptionsGet(optionsContext); - options.general.enable = !options.general.enable; - await apiOptionsSave('popup'); - } -}; async function apiAudioGetUrl(definition, source, optionsContext) { return audioGetUrl(definition, source, optionsContext); @@ -208,87 +159,6 @@ async function _apiGetBrowser() { } } -function _apiGetTabUrl(tab) { - return new Promise((resolve) => { - chrome.tabs.sendMessage(tab.id, {action: 'getUrl'}, {frameId: 0}, (response) => { - let url = null; - if (!chrome.runtime.lastError) { - url = (response !== null && typeof response === 'object' && !Array.isArray(response) ? response.url : null); - if (url !== null && typeof url !== 'string') { - url = null; - } - } - resolve({tab, url}); - }); - }); -} - -async function _apiFindTab(timeout, checkUrl) { - // This function works around the need to have the "tabs" permission to access tab.url. - const tabs = await new Promise((resolve) => chrome.tabs.query({}, resolve)); - let matchPromiseResolve = null; - const matchPromise = new Promise((resolve) => { matchPromiseResolve = resolve; }); - - const checkTabUrl = ({tab, url}) => { - if (checkUrl(url, tab)) { - matchPromiseResolve(tab); - } - }; - - const promises = []; - for (const tab of tabs) { - const promise = _apiGetTabUrl(tab); - promise.then(checkTabUrl); - promises.push(promise); - } - - const racePromises = [ - matchPromise, - Promise.all(promises).then(() => null) - ]; - if (typeof timeout === 'number') { - racePromises.push(new Promise((resolve) => setTimeout(() => resolve(null), timeout))); - } - - return await Promise.race(racePromises); -} - -async function _apiFocusTab(tab) { - await new Promise((resolve, reject) => { - chrome.tabs.update(tab.id, {active: true}, () => { - const e = chrome.runtime.lastError; - if (e) { reject(e); } - else { resolve(); } - }); - }); - - if (!(typeof chrome.windows === 'object' && chrome.windows !== null)) { - // Windows not supported (e.g. on Firefox mobile) - return; - } - - try { - const tabWindow = await new Promise((resolve) => { - chrome.windows.get(tab.windowId, {}, (tabWindow) => { - const e = chrome.runtime.lastError; - if (e) { reject(e); } - else { resolve(tabWindow); } - }); - }); - if (!tabWindow.focused) { - await new Promise((resolve, reject) => { - chrome.windows.update(tab.windowId, {focused: true}, () => { - const e = chrome.runtime.lastError; - if (e) { reject(e); } - else { resolve(); } - }); - }); - } - } catch (e) { - // Edge throws exception for no reason here. - } -} - async function apiClipboardGet() { const clipboardPasteTarget = utilBackend().clipboardPasteTarget; clipboardPasteTarget.innerText = ''; diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 38dbd0f1..8ae5574c 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -397,8 +397,11 @@ class Backend { ); } - _onApiCommandExec({command, params}) { - return apiCommandExec(command, params); + async _onApiCommandExec({command, params}) { + const handler = Backend._commandHandlers.get(command); + if (typeof handler !== 'function') { return false; } + + handler(this, params); } _onApiAudioGetUrl({definition, source, optionsContext}) { @@ -429,6 +432,54 @@ class Backend { return apiClipboardGet(); } + // Command handlers + + async _onCommandSearch(params) { + const url = chrome.runtime.getURL('/bg/search.html'); + if (!(params && params.newTab)) { + try { + const tab = await Backend._findTab(1000, (url2) => ( + url2 !== null && + url2.startsWith(url) && + (url2.length === url.length || url2[url.length] === '?' || url2[url.length] === '#') + )); + if (tab !== null) { + await Backend._focusTab(tab); + return; + } + } catch (e) { + // NOP + } + } + chrome.tabs.create({url}); + } + + _onCommandHelp() { + chrome.tabs.create({url: 'https://foosoft.net/projects/yomichan/'}); + } + + _onCommandOptions(params) { + if (!(params && params.newTab)) { + chrome.runtime.openOptionsPage(); + } else { + const manifest = chrome.runtime.getManifest(); + const url = chrome.runtime.getURL(manifest.options_ui.page); + chrome.tabs.create({url}); + } + } + + async _onCommandToggle() { + const optionsContext = { + depth: 0, + url: window.location.href + }; + const source = 'popup'; + + const options = await this.getOptions(optionsContext); + options.general.enable = !options.general.enable; + await this._optionsSave({source}); + } + // Utilities async _injectScreenshot(definition, fields, screenshot) { @@ -466,6 +517,87 @@ class Backend { definition.screenshotFileName = filename; } + + static _getTabUrl(tab) { + return new Promise((resolve) => { + chrome.tabs.sendMessage(tab.id, {action: 'getUrl'}, {frameId: 0}, (response) => { + let url = null; + if (!chrome.runtime.lastError) { + url = (response !== null && typeof response === 'object' && !Array.isArray(response) ? response.url : null); + if (url !== null && typeof url !== 'string') { + url = null; + } + } + resolve({tab, url}); + }); + }); + } + + static async _findTab(timeout, checkUrl) { + // This function works around the need to have the "tabs" permission to access tab.url. + const tabs = await new Promise((resolve) => chrome.tabs.query({}, resolve)); + let matchPromiseResolve = null; + const matchPromise = new Promise((resolve) => { matchPromiseResolve = resolve; }); + + const checkTabUrl = ({tab, url}) => { + if (checkUrl(url, tab)) { + matchPromiseResolve(tab); + } + }; + + const promises = []; + for (const tab of tabs) { + const promise = Backend._getTabUrl(tab); + promise.then(checkTabUrl); + promises.push(promise); + } + + const racePromises = [ + matchPromise, + Promise.all(promises).then(() => null) + ]; + if (typeof timeout === 'number') { + racePromises.push(new Promise((resolve) => setTimeout(() => resolve(null), timeout))); + } + + return await Promise.race(racePromises); + } + + static async _focusTab(tab) { + await new Promise((resolve, reject) => { + chrome.tabs.update(tab.id, {active: true}, () => { + const e = chrome.runtime.lastError; + if (e) { reject(e); } + else { resolve(); } + }); + }); + + if (!(typeof chrome.windows === 'object' && chrome.windows !== null)) { + // Windows not supported (e.g. on Firefox mobile) + return; + } + + try { + const tabWindow = await new Promise((resolve) => { + chrome.windows.get(tab.windowId, {}, (tabWindow) => { + const e = chrome.runtime.lastError; + if (e) { reject(e); } + else { resolve(tabWindow); } + }); + }); + if (!tabWindow.focused) { + await new Promise((resolve, reject) => { + chrome.windows.update(tab.windowId, {focused: true}, () => { + const e = chrome.runtime.lastError; + if (e) { reject(e); } + else { resolve(); } + }); + }); + } + } catch (e) { + // Edge throws exception for no reason here. + } + } } Backend._messageHandlers = new Map([ @@ -491,5 +623,12 @@ Backend._messageHandlers = new Map([ ['clipboardGet', (self, ...args) => self._onApiClipboardGet(...args)] ]); +Backend._commandHandlers = new Map([ + ['search', (self, ...args) => self._onCommandSearch(...args)], + ['help', (self, ...args) => self._onCommandHelp(...args)], + ['options', (self, ...args) => self._onCommandOptions(...args)], + ['toggle', (self, ...args) => self._onCommandToggle(...args)] +]); + window.yomichan_backend = new Backend(); window.yomichan_backend.prepare(); -- cgit v1.2.3 From 1202ad261eba2c684351ba4b9a53e68203a8ae45 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:46:24 -0500 Subject: Move apiAudioGetUrl implementation into Backend --- ext/bg/js/api.js | 4 ++-- ext/bg/js/backend.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 1c3ad110..db849cc5 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -69,8 +69,8 @@ function apiCommandExec(command, params) { return utilBackend()._onApiCommandExec({command, params}); } -async function apiAudioGetUrl(definition, source, optionsContext) { - return audioGetUrl(definition, source, optionsContext); +function apiAudioGetUrl(definition, source, optionsContext) { + return utilBackend()._onApiAudioGetUrl({definition, source, optionsContext}); } function apiScreenshotGet(options, sender) { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 8ae5574c..96f28925 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -404,8 +404,8 @@ class Backend { handler(this, params); } - _onApiAudioGetUrl({definition, source, optionsContext}) { - return apiAudioGetUrl(definition, source, optionsContext); + async _onApiAudioGetUrl({definition, source, optionsContext}) { + return audioGetUrl(definition, source, optionsContext); } _onApiScreenshotGet({options}, sender) { -- cgit v1.2.3 From d8b21606ba0f8878b718aef332c6616931e99dd0 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:54:03 -0500 Subject: Move apiScreenshotGet implementation into Backend --- ext/bg/js/api.js | 9 +-------- ext/bg/js/backend.js | 9 ++++++++- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index db849cc5..3b9af593 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -74,14 +74,7 @@ function apiAudioGetUrl(definition, source, optionsContext) { } function apiScreenshotGet(options, sender) { - if (!(sender && sender.tab)) { - return Promise.resolve(); - } - - const windowId = sender.tab.windowId; - return new Promise((resolve) => { - chrome.tabs.captureVisibleTab(windowId, options, (dataUrl) => resolve(dataUrl)); - }); + return utilBackend()._onApiScreenshotGet({options}, sender); } function apiForward(action, params, sender) { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 96f28925..5c5da2dd 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -409,7 +409,14 @@ class Backend { } _onApiScreenshotGet({options}, sender) { - return apiScreenshotGet(options, sender); + if (!(sender && sender.tab)) { + return Promise.resolve(); + } + + const windowId = sender.tab.windowId; + return new Promise((resolve) => { + chrome.tabs.captureVisibleTab(windowId, options, (dataUrl) => resolve(dataUrl)); + }); } _onApiForward({action, params}, sender) { -- cgit v1.2.3 From daff44a010b3b926004f6888d62fe408da90966d Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:54:45 -0500 Subject: Move apiForward implementation into Backend --- ext/bg/js/api.js | 9 +-------- ext/bg/js/backend.js | 9 ++++++++- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 3b9af593..bafbdf39 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -78,14 +78,7 @@ function apiScreenshotGet(options, sender) { } function apiForward(action, params, sender) { - if (!(sender && sender.tab)) { - return Promise.resolve(); - } - - const tabId = sender.tab.id; - return new Promise((resolve) => { - chrome.tabs.sendMessage(tabId, {action, params}, (response) => resolve(response)); - }); + return utilBackend()._onApiForward({action, params}, sender); } function apiFrameInformationGet(sender) { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 5c5da2dd..e9b50789 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -420,7 +420,14 @@ class Backend { } _onApiForward({action, params}, sender) { - return apiForward(action, params, sender); + if (!(sender && sender.tab)) { + return Promise.resolve(); + } + + const tabId = sender.tab.id; + return new Promise((resolve) => { + chrome.tabs.sendMessage(tabId, {action, params}, (response) => resolve(response)); + }); } _onApiFrameInformationGet(params, sender) { -- cgit v1.2.3 From 01a343262702d2c8641c7a4f990d439f38b90cb0 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:55:45 -0500 Subject: Move apiFrameInformationGet implementation into Backend --- ext/bg/js/api.js | 3 +-- ext/bg/js/backend.js | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index bafbdf39..ff5c8abf 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -82,8 +82,7 @@ function apiForward(action, params, sender) { } function apiFrameInformationGet(sender) { - const frameId = sender.frameId; - return Promise.resolve({frameId}); + return utilBackend()._onApiFrameInformationGet(null, sender); } function apiInjectStylesheet(css, sender) { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index e9b50789..4b94d073 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -431,7 +431,8 @@ class Backend { } _onApiFrameInformationGet(params, sender) { - return apiFrameInformationGet(sender); + const frameId = sender.frameId; + return Promise.resolve({frameId}); } _onApiInjectStylesheet({css}, sender) { -- cgit v1.2.3 From f78671346696ddac23e9f858f567e5db065effec Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:56:47 -0500 Subject: Move apiInjectStylesheet implementation into Backend --- ext/bg/js/api.js | 27 +-------------------------- ext/bg/js/backend.js | 27 ++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 27 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index ff5c8abf..82166007 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -86,32 +86,7 @@ function apiFrameInformationGet(sender) { } function apiInjectStylesheet(css, sender) { - if (!sender.tab) { - return Promise.reject(new Error('Invalid tab')); - } - - const tabId = sender.tab.id; - const frameId = sender.frameId; - const details = { - code: css, - runAt: 'document_start', - cssOrigin: 'user', - allFrames: false - }; - if (typeof frameId === 'number') { - details.frameId = frameId; - } - - return new Promise((resolve, reject) => { - chrome.tabs.insertCSS(tabId, details, () => { - const e = chrome.runtime.lastError; - if (e) { - reject(new Error(e.message)); - } else { - resolve(); - } - }); - }); + return utilBackend()._onApiInjectStylesheet({css}, sender); } async function apiGetEnvironmentInfo() { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 4b94d073..df021ea2 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -436,7 +436,32 @@ class Backend { } _onApiInjectStylesheet({css}, sender) { - return apiInjectStylesheet(css, sender); + if (!sender.tab) { + return Promise.reject(new Error('Invalid tab')); + } + + const tabId = sender.tab.id; + const frameId = sender.frameId; + const details = { + code: css, + runAt: 'document_start', + cssOrigin: 'user', + allFrames: false + }; + if (typeof frameId === 'number') { + details.frameId = frameId; + } + + return new Promise((resolve, reject) => { + chrome.tabs.insertCSS(tabId, details, () => { + const e = chrome.runtime.lastError; + if (e) { + reject(new Error(e.message)); + } else { + resolve(); + } + }); + }); } _onApiGetEnvironmentInfo() { -- cgit v1.2.3 From 2fef2bf5a87d142310ca79a75894098984ab1ffa Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:58:32 -0500 Subject: Move apiGetEnvironmentInfo implementation into Backend --- ext/bg/js/api.js | 30 ++---------------------------- ext/bg/js/backend.js | 30 ++++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 30 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 82166007..49a6c14f 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -89,34 +89,8 @@ function apiInjectStylesheet(css, sender) { return utilBackend()._onApiInjectStylesheet({css}, sender); } -async function apiGetEnvironmentInfo() { - const browser = await _apiGetBrowser(); - const platform = await new Promise((resolve) => chrome.runtime.getPlatformInfo(resolve)); - return { - browser, - platform: { - os: platform.os - } - }; -} - -async function _apiGetBrowser() { - if (EXTENSION_IS_BROWSER_EDGE) { - return 'edge'; - } - if (typeof browser !== 'undefined') { - try { - const info = await browser.runtime.getBrowserInfo(); - if (info.name === 'Fennec') { - return 'firefox-mobile'; - } - } catch (e) { - // NOP - } - return 'firefox'; - } else { - return 'chrome'; - } +function apiGetEnvironmentInfo() { + return utilBackend()._onApiGetEnvironmentInfo(); } async function apiClipboardGet() { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index df021ea2..62c077a2 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -464,8 +464,15 @@ class Backend { }); } - _onApiGetEnvironmentInfo() { - return apiGetEnvironmentInfo(); + async _onApiGetEnvironmentInfo() { + const browser = await Backend._getBrowser(); + const platform = await new Promise((resolve) => chrome.runtime.getPlatformInfo(resolve)); + return { + browser, + platform: { + os: platform.os + } + }; } _onApiClipboardGet() { @@ -638,6 +645,25 @@ class Backend { // Edge throws exception for no reason here. } } + + static async _getBrowser() { + if (EXTENSION_IS_BROWSER_EDGE) { + return 'edge'; + } + if (typeof browser !== 'undefined') { + try { + const info = await browser.runtime.getBrowserInfo(); + if (info.name === 'Fennec') { + return 'firefox-mobile'; + } + } catch (e) { + // NOP + } + return 'firefox'; + } else { + return 'chrome'; + } + } } Backend._messageHandlers = new Map([ -- cgit v1.2.3 From 11b300ab7670011c2a06e75f72eea4e9bf87cd97 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 9 Dec 2019 21:59:18 -0500 Subject: Move apiClipboardGet implementation into Backend --- ext/bg/js/api.js | 8 ++------ ext/bg/js/backend.js | 8 ++++++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 49a6c14f..095734fb 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -93,10 +93,6 @@ function apiGetEnvironmentInfo() { return utilBackend()._onApiGetEnvironmentInfo(); } -async function apiClipboardGet() { - const clipboardPasteTarget = utilBackend().clipboardPasteTarget; - clipboardPasteTarget.innerText = ''; - clipboardPasteTarget.focus(); - document.execCommand('paste'); - return clipboardPasteTarget.innerText; +function apiClipboardGet() { + return utilBackend()._onApiClipboardGet(); } diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 62c077a2..877161c7 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -475,8 +475,12 @@ class Backend { }; } - _onApiClipboardGet() { - return apiClipboardGet(); + async _onApiClipboardGet() { + const clipboardPasteTarget = this.clipboardPasteTarget; + clipboardPasteTarget.innerText = ''; + clipboardPasteTarget.focus(); + document.execCommand('paste'); + return clipboardPasteTarget.innerText; } // Command handlers -- cgit v1.2.3 From 69556533e172f32915f84413130ff2630804f5ec Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Thu, 12 Dec 2019 19:59:43 -0500 Subject: Fix command handling --- ext/bg/js/backend.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 877161c7..fb680304 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -42,7 +42,7 @@ class Backend { this.onOptionsUpdated('background'); if (chrome.commands !== null && typeof chrome.commands === 'object') { - chrome.commands.onCommand.addListener(this.onCommand.bind(this)); + chrome.commands.onCommand.addListener((command) => this._runCommand(command)); } chrome.runtime.onMessage.addListener(this.onMessage.bind(this)); @@ -67,10 +67,6 @@ class Backend { }); } - onCommand(command) { - apiCommandExec(command); - } - onMessage({action, params}, sender, callback) { const handler = Backend._messageHandlers.get(action); if (typeof handler !== 'function') { return false; } @@ -184,6 +180,14 @@ class Backend { // NOP } + _runCommand(command, params) { + const handler = Backend._commandHandlers.get(command); + if (typeof handler !== 'function') { return false; } + + handler(this, params); + return true; + } + // Message handlers _onApiOptionsGet({optionsContext}) { @@ -398,10 +402,7 @@ class Backend { } async _onApiCommandExec({command, params}) { - const handler = Backend._commandHandlers.get(command); - if (typeof handler !== 'function') { return false; } - - handler(this, params); + return this._runCommand(command, params); } async _onApiAudioGetUrl({definition, source, optionsContext}) { -- cgit v1.2.3 From e417a3fda36fd798298ff9210d34366a3d0adacc Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Thu, 12 Dec 2019 20:00:14 -0500 Subject: Fix incorrect function --- ext/bg/js/backend.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index fb680304..719e0361 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -235,7 +235,7 @@ class Backend { modifyOption(path, value, options); } - await this._optionsSave({source}); + await this._onApiOptionsSave({source}); } async _onApiOptionsSave({source}) { @@ -529,7 +529,7 @@ class Backend { const options = await this.getOptions(optionsContext); options.general.enable = !options.general.enable; - await this._optionsSave({source}); + await this._onApiOptionsSave({source}); } // Utilities -- cgit v1.2.3 From 7b9731e616415f90b61e94d4db627928a3a35a03 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Fri, 20 Dec 2019 22:54:28 -0500 Subject: Fix apiOptionsGet being used on the background page --- ext/bg/js/audio.js | 39 ++++++++++++++++++--------------------- ext/bg/js/backend.js | 3 ++- 2 files changed, 20 insertions(+), 22 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/audio.js b/ext/bg/js/audio.js index dc0ba5eb..b39b6c9d 100644 --- a/ext/bg/js/audio.js +++ b/ext/bg/js/audio.js @@ -17,8 +17,8 @@ */ -const audioUrlBuilders = { - 'jpod101': async (definition) => { +const audioUrlBuilders = new Map([ + ['jpod101', async (definition) => { let kana = definition.reading; let kanji = definition.expression; @@ -36,8 +36,8 @@ const audioUrlBuilders = { } return `https://assets.languagepod101.com/dictionary/japanese/audiomp3.php?${params.join('&')}`; - }, - 'jpod101-alternate': async (definition) => { + }], + ['jpod101-alternate', async (definition) => { const response = await new Promise((resolve, reject) => { const xhr = new XMLHttpRequest(); xhr.open('POST', 'https://www.japanesepod101.com/learningcenter/reference/dictionary_post'); @@ -61,8 +61,8 @@ const audioUrlBuilders = { } throw new Error('Failed to find audio URL'); - }, - 'jisho': async (definition) => { + }], + ['jisho', async (definition) => { const response = await new Promise((resolve, reject) => { const xhr = new XMLHttpRequest(); xhr.open('GET', `https://jisho.org/search/${definition.expression}`); @@ -85,37 +85,34 @@ const audioUrlBuilders = { } throw new Error('Failed to find audio URL'); - }, - 'text-to-speech': async (definition, optionsContext) => { - const options = await apiOptionsGet(optionsContext); + }], + ['text-to-speech', async (definition, options) => { const voiceURI = options.audio.textToSpeechVoice; if (!voiceURI) { throw new Error('No voice'); } return `tts:?text=${encodeURIComponent(definition.expression)}&voice=${encodeURIComponent(voiceURI)}`; - }, - 'text-to-speech-reading': async (definition, optionsContext) => { - const options = await apiOptionsGet(optionsContext); + }], + ['text-to-speech-reading', async (definition, options) => { const voiceURI = options.audio.textToSpeechVoice; if (!voiceURI) { throw new Error('No voice'); } return `tts:?text=${encodeURIComponent(definition.reading || definition.expression)}&voice=${encodeURIComponent(voiceURI)}`; - }, - 'custom': async (definition, optionsContext) => { - const options = await apiOptionsGet(optionsContext); + }], + ['custom', async (definition, options) => { const customSourceUrl = options.audio.customSourceUrl; return customSourceUrl.replace(/\{([^}]*)\}/g, (m0, m1) => (hasOwn(definition, m1) ? `${definition[m1]}` : m0)); - } -}; + }] +]); -async function audioGetUrl(definition, mode, optionsContext, download) { - if (hasOwn(audioUrlBuilders, mode)) { - const handler = audioUrlBuilders[mode]; +async function audioGetUrl(definition, mode, options, download) { + const handler = audioUrlBuilders.get(mode); + if (typeof handler === 'function') { try { - return await handler(definition, optionsContext, download); + return await handler(definition, options, download); } catch (e) { // NOP } diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 719e0361..b2872c3f 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -406,7 +406,8 @@ class Backend { } async _onApiAudioGetUrl({definition, source, optionsContext}) { - return audioGetUrl(definition, source, optionsContext); + const options = await this.getOptions(optionsContext); + return await audioGetUrl(definition, source, options); } _onApiScreenshotGet({options}, sender) { -- cgit v1.2.3 From 35216332bff4f654ce5ab3952369c012e2565fd9 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Fri, 20 Dec 2019 23:21:29 -0500 Subject: Replace window.yomichan_backend with window.yomichanBackend --- ext/bg/js/api.js | 2 +- ext/bg/js/backend.js | 4 ++-- ext/bg/js/util.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index d8200caf..9f37ccd8 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -41,7 +41,7 @@ function _apiInvoke(action, params={}) { reject(new Error(`${message} (${JSON.stringify(data)})`)); } }; - const backend = window.yomichan_backend; + const backend = window.yomichanBackend; backend.onMessage({action, params}, null, callback); } catch (e) { reject(e); diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index b2872c3f..7b6498e1 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -702,5 +702,5 @@ Backend._commandHandlers = new Map([ ['toggle', (self, ...args) => self._onCommandToggle(...args)] ]); -window.yomichan_backend = new Backend(); -window.yomichan_backend.prepare(); +window.yomichanBackend = new Backend(); +window.yomichanBackend.prepare(); diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js index 42480c37..c88c2768 100644 --- a/ext/bg/js/util.js +++ b/ext/bg/js/util.js @@ -97,7 +97,7 @@ function utilStringHashCode(string) { } function utilBackend() { - return chrome.extension.getBackgroundPage().yomichan_backend; + return chrome.extension.getBackgroundPage().yomichanBackend; } async function utilAnkiGetModelNames() { -- cgit v1.2.3 From 11b94d5a82f520706b344fd70ffa9e502d18086c Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Thu, 12 Dec 2019 21:01:49 -0500 Subject: Make apiClipboardGet use plaintext Also clear the value before returning --- ext/bg/background.html | 2 +- ext/bg/js/backend.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/background.html b/ext/bg/background.html index fc0758cf..c45ef3cd 100644 --- a/ext/bg/background.html +++ b/ext/bg/background.html @@ -12,7 +12,7 @@ -
+ diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 7b6498e1..ca03f94d 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -479,10 +479,12 @@ class Backend { async _onApiClipboardGet() { const clipboardPasteTarget = this.clipboardPasteTarget; - clipboardPasteTarget.innerText = ''; + clipboardPasteTarget.value = ''; clipboardPasteTarget.focus(); document.execCommand('paste'); - return clipboardPasteTarget.innerText; + const result = clipboardPasteTarget.value; + clipboardPasteTarget.value = ''; + return result; } // Command handlers -- cgit v1.2.3 From 3033fea31e4bc9ba7198d2d31d6f6046813926d1 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 14 Dec 2019 16:59:44 -0500 Subject: Treat null templates as the default value --- ext/bg/js/backend.js | 11 +++++++++-- ext/bg/js/dictionary.js | 8 ++++---- ext/bg/js/options.js | 2 +- ext/bg/js/settings/anki-templates.js | 4 +++- ext/bg/js/settings/main.js | 10 ++++++++-- ext/bg/js/util.js | 2 ++ 6 files changed, 27 insertions(+), 10 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index ca03f94d..1a874dc8 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -321,6 +321,7 @@ class Backend { async _onApiDefinitionAdd({definition, mode, context, optionsContext}) { const options = await this.getOptions(optionsContext); + const templates = Backend._getTemplates(options); if (mode !== 'kanji') { await audioInject( @@ -339,19 +340,20 @@ class Backend { ); } - const note = await dictNoteFormat(definition, mode, options); + const note = await dictNoteFormat(definition, mode, options, templates); return this.anki.addNote(note); } async _onApiDefinitionsAddable({definitions, modes, optionsContext}) { const options = await this.getOptions(optionsContext); + const templates = Backend._getTemplates(options); const states = []; try { const notes = []; for (const definition of definitions) { for (const mode of modes) { - const note = await dictNoteFormat(definition, mode, options); + const note = await dictNoteFormat(definition, mode, options, templates); notes.push(note); } } @@ -672,6 +674,11 @@ class Backend { return 'chrome'; } } + + static _getTemplates(options) { + const templates = options.anki.fieldTemplates; + return typeof templates === 'string' ? templates : profileOptionsGetDefaultFieldTemplates(); + } } Backend._messageHandlers = new Map([ diff --git a/ext/bg/js/dictionary.js b/ext/bg/js/dictionary.js index 0b35e32e..28705513 100644 --- a/ext/bg/js/dictionary.js +++ b/ext/bg/js/dictionary.js @@ -310,7 +310,7 @@ function dictFieldSplit(field) { return field.length === 0 ? [] : field.split(' '); } -async function dictFieldFormat(field, definition, mode, options, exceptions) { +async function dictFieldFormat(field, definition, mode, options, templates, exceptions) { const data = { marker: null, definition, @@ -329,7 +329,7 @@ async function dictFieldFormat(field, definition, mode, options, exceptions) { } data.marker = marker; try { - return await apiTemplateRender(options.anki.fieldTemplates, data, true); + return await apiTemplateRender(templates, data, true); } catch (e) { if (exceptions) { exceptions.push(e); } return `{${marker}-render-error}`; @@ -357,7 +357,7 @@ dictFieldFormat.markers = new Set([ 'url' ]); -async function dictNoteFormat(definition, mode, options) { +async function dictNoteFormat(definition, mode, options, templates) { const note = {fields: {}, tags: options.anki.tags}; let fields = []; @@ -391,7 +391,7 @@ async function dictNoteFormat(definition, mode, options) { } for (const name in fields) { - note.fields[name] = await dictFieldFormat(fields[name], definition, mode, options); + note.fields[name] = await dictFieldFormat(fields[name], definition, mode, options, templates); } return note; diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index 2d13f6d9..7f540a70 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -326,7 +326,7 @@ function profileOptionsCreateDefaults() { screenshot: {format: 'png', quality: 92}, terms: {deck: '', model: '', fields: {}}, kanji: {deck: '', model: '', fields: {}}, - fieldTemplates: profileOptionsGetDefaultFieldTemplates() + fieldTemplates: null } }; } diff --git a/ext/bg/js/settings/anki-templates.js b/ext/bg/js/settings/anki-templates.js index 9cdfc134..0e6e3cbd 100644 --- a/ext/bg/js/settings/anki-templates.js +++ b/ext/bg/js/settings/anki-templates.js @@ -73,7 +73,9 @@ async function ankiTemplatesValidate(infoNode, field, mode, showSuccessResult, i const definition = await ankiTemplatesValidateGetDefinition(text, optionsContext); if (definition !== null) { const options = await apiOptionsGet(optionsContext); - result = await dictFieldFormat(field, definition, mode, options, exceptions); + let templates = options.anki.fieldTemplates; + if (typeof templates !== 'string') { templates = profileOptionsGetDefaultFieldTemplates(); } + result = await dictFieldFormat(field, definition, mode, options, templates, exceptions); } } catch (e) { exceptions.push(e); diff --git a/ext/bg/js/settings/main.js b/ext/bg/js/settings/main.js index 870769e5..c0b2deb6 100644 --- a/ext/bg/js/settings/main.js +++ b/ext/bg/js/settings/main.js @@ -145,7 +145,11 @@ async function formWrite(options) { $('#interface-server').val(options.anki.server); $('#screenshot-format').val(options.anki.screenshot.format); $('#screenshot-quality').val(options.anki.screenshot.quality); - $('#field-templates').val(options.anki.fieldTemplates); + + let templates = options.anki.fieldTemplates; + if (typeof templates !== 'string') { templates = profileOptionsGetDefaultFieldTemplates(); } + + $('#field-templates').val(templates); onAnkiTemplatesValidateCompile(); await onAnkiOptionsChanged(options); @@ -166,7 +170,9 @@ function formUpdateVisibility(options) { if (options.general.debugInfo) { const temp = utilIsolate(options); - temp.anki.fieldTemplates = '...'; + if (typeof temp.anki.fieldTemplates === 'string') { + temp.anki.fieldTemplates = '...'; + } const text = JSON.stringify(temp, null, 4); $('#debug').text(text); } diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js index c88c2768..0527dc0b 100644 --- a/ext/bg/js/util.js +++ b/ext/bg/js/util.js @@ -88,6 +88,8 @@ function utilSetDifference(setA, setB) { function utilStringHashCode(string) { let hashCode = 0; + if (typeof string !== 'string') { return hashCode; } + for (let i = 0, charCode = string.charCodeAt(i); i < string.length; charCode = string.charCodeAt(++i)) { hashCode = ((hashCode << 5) - hashCode) + charCode; hashCode |= 0; -- cgit v1.2.3 From 50e0fbbb662230a3a9f6e7354c229200bd1a03a2 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Thu, 28 Nov 2019 15:18:27 -0500 Subject: Use schema to validate options --- ext/bg/background.html | 1 + ext/bg/js/backend.js | 10 ++++++++++ 2 files changed, 11 insertions(+) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/background.html b/ext/bg/background.html index 4c6f8795..af87eddb 100644 --- a/ext/bg/background.html +++ b/ext/bg/background.html @@ -31,6 +31,7 @@ + diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 1a874dc8..55841cd6 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -23,6 +23,7 @@ class Backend { this.anki = new AnkiNull(); this.mecab = new Mecab(); this.options = null; + this.optionsSchema = null; this.optionsContext = { depth: 0, url: window.location.href @@ -38,7 +39,16 @@ class Backend { async prepare() { await this.translator.prepare(); + + this.optionsSchema = await requestJson(chrome.runtime.getURL('/bg/data/options-schema.json'), 'GET'); this.options = await optionsLoad(); + try { + this.options = JsonSchema.getValidValueOrDefault(this.optionsSchema, this.options); + } catch (e) { + // This shouldn't happen, but catch errors just in case of bugs + logError(e); + } + this.onOptionsUpdated('background'); if (chrome.commands !== null && typeof chrome.commands === 'object') { -- cgit v1.2.3 From d2da4f7e62c42ed7f9fd82c8af2f1d9968bec2ce Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 14 Dec 2019 16:40:05 -0500 Subject: Add apiOptionsSchemaGet --- ext/bg/js/backend.js | 12 ++++++++++++ ext/mixed/js/api.js | 4 ++++ 2 files changed, 16 insertions(+) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 55841cd6..245e3de2 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -115,6 +115,13 @@ class Backend { } } + async getOptionsSchema() { + if (this.isPreparedPromise !== null) { + await this.isPreparedPromise; + } + return this.optionsSchema; + } + async getFullOptions() { if (this.isPreparedPromise !== null) { await this.isPreparedPromise; @@ -200,6 +207,10 @@ class Backend { // Message handlers + _onApiOptionsSchemaGet() { + return this.getOptionsSchema(); + } + _onApiOptionsGet({optionsContext}) { return this.getOptions(optionsContext); } @@ -692,6 +703,7 @@ class Backend { } Backend._messageHandlers = new Map([ + ['optionsSchemaGet', (self, ...args) => self._onApiOptionsSchemaGet(...args)], ['optionsGet', (self, ...args) => self._onApiOptionsGet(...args)], ['optionsGetFull', (self, ...args) => self._onApiOptionsGetFull(...args)], ['optionsSet', (self, ...args) => self._onApiOptionsSet(...args)], diff --git a/ext/mixed/js/api.js b/ext/mixed/js/api.js index 18b360a3..dc901efc 100644 --- a/ext/mixed/js/api.js +++ b/ext/mixed/js/api.js @@ -17,6 +17,10 @@ */ +function apiOptionsSchemaGet() { + return _apiInvoke('optionsSchemaGet'); +} + function apiOptionsGet(optionsContext) { return _apiInvoke('optionsGet', {optionsContext}); } -- cgit v1.2.3 From f17b55239e941394908fad4a6b1676a171342dac Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 14 Dec 2019 16:37:37 -0500 Subject: Implement settings import --- ext/bg/js/backend.js | 12 +++ ext/bg/js/settings/backup.js | 226 +++++++++++++++++++++++++++++++++++++++++++ ext/bg/js/util.js | 9 ++ ext/bg/settings.html | 49 ++++++++++ 4 files changed, 296 insertions(+) (limited to 'ext/bg/js/backend.js') diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 245e3de2..3c8a068b 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -129,6 +129,18 @@ class Backend { return this.options; } + async setFullOptions(options) { + if (this.isPreparedPromise !== null) { + await this.isPreparedPromise; + } + try { + this.options = JsonSchema.getValidValueOrDefault(this.optionsSchema, utilIsolate(options)); + } catch (e) { + // This shouldn't happen, but catch errors just in case of bugs + logError(e); + } + } + async getOptions(optionsContext) { if (this.isPreparedPromise !== null) { await this.isPreparedPromise; diff --git a/ext/bg/js/settings/backup.js b/ext/bg/js/settings/backup.js index 6494cd65..1e099288 100644 --- a/ext/bg/js/settings/backup.js +++ b/ext/bg/js/settings/backup.js @@ -115,8 +115,234 @@ async function _onSettingsExportClick() { } +// Importing + +async function _settingsImportSetOptionsFull(optionsFull) { + return utilIsolate(await utilBackend().setFullOptions( + utilBackgroundIsolate(optionsFull) + )); +} + +function _showSettingsImportError(error) { + logError(error); + document.querySelector('#settings-import-error-modal-message').textContent = `${error}`; + $('#settings-import-error-modal').modal('show'); +} + +async function _showSettingsImportWarnings(warnings) { + const modalNode = $('#settings-import-warning-modal'); + const buttons = document.querySelectorAll('.settings-import-warning-modal-import-button'); + const messageContainer = document.querySelector('#settings-import-warning-modal-message'); + if (modalNode.length === 0 || buttons.length === 0 || messageContainer === null) { + return {result: false}; + } + + // Set message + const fragment = document.createDocumentFragment(); + for (const warning of warnings) { + const node = document.createElement('li'); + node.textContent = `${warning}`; + fragment.appendChild(node); + } + messageContainer.textContent = ''; + messageContainer.appendChild(fragment); + + // Show modal + modalNode.modal('show'); + + // Wait for modal to close + return new Promise((resolve) => { + const onButtonClick = (e) => { + e.preventDefault(); + complete({ + result: true, + sanitize: e.currentTarget.dataset.importSanitize === 'true' + }); + modalNode.modal('hide'); + + }; + const onModalHide = () => { + complete({result: false}); + }; + + let completed = false; + const complete = (result) => { + if (completed) { return; } + completed = true; + + modalNode.off('hide.bs.modal', onModalHide); + for (const button of buttons) { + button.removeEventListener('click', onButtonClick, false); + } + + resolve(result); + }; + + // Hook events + modalNode.on('hide.bs.modal', onModalHide); + for (const button of buttons) { + button.addEventListener('click', onButtonClick, false); + } + }); +} + +function _isLocalhostUrl(urlString) { + try { + const url = new URL(urlString); + switch (url.hostname.toLowerCase()) { + case 'localhost': + case '127.0.0.1': + case '[::1]': + switch (url.protocol.toLowerCase()) { + case 'http:': + case 'https:': + return true; + } + break; + } + } catch (e) { + // NOP + } + return false; +} + +function _settingsImportSanitizeProfileOptions(options, dryRun) { + const warnings = []; + + const anki = options.anki; + if (isObject(anki)) { + const fieldTemplates = anki.fieldTemplates; + if (typeof fieldTemplates === 'string') { + warnings.push('anki.fieldTemplates contains a non-default value'); + if (!dryRun) { + delete anki.fieldTemplates; + } + } + const server = anki.server; + if (typeof server === 'string' && server.length > 0 && !_isLocalhostUrl(server)) { + warnings.push('anki.server uses a non-localhost URL'); + if (!dryRun) { + delete anki.server; + } + } + } + + const audio = options.audio; + if (isObject(audio)) { + const customSourceUrl = audio.customSourceUrl; + if (typeof customSourceUrl === 'string' && customSourceUrl.length > 0 && !_isLocalhostUrl(customSourceUrl)) { + warnings.push('audio.customSourceUrl uses a non-localhost URL'); + if (!dryRun) { + delete audio.customSourceUrl; + } + } + } + + return warnings; +} + +function _settingsImportSanitizeOptions(optionsFull, dryRun) { + const warnings = new Set(); + + const profiles = optionsFull.profiles; + if (Array.isArray(profiles)) { + for (const profile of profiles) { + if (!isObject(profile)) { continue; } + const options = profile.options; + if (!isObject(options)) { continue; } + + const warnings2 = _settingsImportSanitizeProfileOptions(options, dryRun); + for (const warning of warnings2) { + warnings.add(warning); + } + } + } + + return warnings; +} + +function _utf8Decode(arrayBuffer) { + try { + return new TextDecoder('utf-8').decode(arrayBuffer); + } catch (e) { + const binaryString = String.fromCharCode.apply(null, new Uint8Array(arrayBuffer)); + return decodeURIComponent(escape(binaryString)); + } +} + +async function _importSettingsFile(file) { + const dataString = _utf8Decode(await utilReadFileArrayBuffer(file)); + const data = JSON.parse(dataString); + + // Type check + if (!isObject(data)) { + throw new Error(`Invalid data type: ${typeof data}`); + } + + // Version check + const version = data.version; + if (!( + typeof version === 'number' && + Number.isFinite(version) && + version === Math.floor(version) + )) { + throw new Error(`Invalid version: ${version}`); + } + + if (!( + version >= 0 && + version <= SETTINGS_EXPORT_CURRENT_VERSION + )) { + throw new Error(`Unsupported version: ${version}`); + } + + // Verify options exists + let optionsFull = data.options; + if (!isObject(optionsFull)) { + throw new Error(`Invalid options type: ${typeof optionsFull}`); + } + + // Upgrade options + optionsFull = optionsUpdateVersion(optionsFull, {}); + + // Check for warnings + const sanitizationWarnings = _settingsImportSanitizeOptions(optionsFull, true); + + // Show sanitization warnings + if (sanitizationWarnings.size > 0) { + const {result, sanitize} = await _showSettingsImportWarnings(sanitizationWarnings); + if (!result) { return; } + + if (sanitize !== false) { + _settingsImportSanitizeOptions(optionsFull, false); + } + } + + // Assign options + await _settingsImportSetOptionsFull(optionsFull); + + // Reload settings page + window.location.reload(); +} + +function _onSettingsImportClick() { + document.querySelector('#settings-import-file').click(); +} + +function _onSettingsImportFileChange(e) { + const files = e.target.files; + if (files.length === 0) { return; } + + const file = files[0]; + e.target.value = null; + _importSettingsFile(file).catch(_showSettingsImportError); +} + + // Setup window.addEventListener('DOMContentLoaded', () => { 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); }, false); diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js index 0527dc0b..4c989642 100644 --- a/ext/bg/js/util.js +++ b/ext/bg/js/util.js @@ -155,3 +155,12 @@ function utilReadFile(file) { reader.readAsBinaryString(file); }); } + +function utilReadFileArrayBuffer(file) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onload = () => resolve(reader.result); + reader.onerror = () => reject(reader.error); + reader.readAsArrayBuffer(file); + }); +} diff --git a/ext/bg/settings.html b/ext/bg/settings.html index ec0e2939..56b5610e 100644 --- a/ext/bg/settings.html +++ b/ext/bg/settings.html @@ -866,6 +866,55 @@
+ +
+ + + + + + -- cgit v1.2.3 From 899ef167d184fedb072b727e0dc04f2579b08e1f Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Wed, 1 Jan 2020 12:00:00 -0500 Subject: Update copyright --- LICENSE | 2 +- ext/bg/css/settings.css | 2 +- ext/bg/js/anki.js | 2 +- ext/bg/js/api.js | 2 +- ext/bg/js/audio.js | 2 +- ext/bg/js/backend-api-forwarder.js | 2 +- ext/bg/js/backend.js | 2 +- ext/bg/js/conditions.js | 2 +- ext/bg/js/context.js | 2 +- ext/bg/js/database.js | 2 +- ext/bg/js/deinflector.js | 2 +- ext/bg/js/dictionary.js | 2 +- ext/bg/js/handlebars.js | 2 +- ext/bg/js/json-schema.js | 2 +- ext/bg/js/mecab.js | 2 +- ext/bg/js/options.js | 2 +- ext/bg/js/page-exit-prevention.js | 2 +- ext/bg/js/profile-conditions.js | 2 +- ext/bg/js/request.js | 2 +- ext/bg/js/search-frontend.js | 2 +- ext/bg/js/search-query-parser.js | 2 +- ext/bg/js/search.js | 2 +- ext/bg/js/settings/anki-templates.js | 2 +- ext/bg/js/settings/anki.js | 2 +- ext/bg/js/settings/audio-ui.js | 2 +- ext/bg/js/settings/audio.js | 2 +- ext/bg/js/settings/backup.js | 2 +- ext/bg/js/settings/conditions-ui.js | 2 +- ext/bg/js/settings/dictionaries.js | 2 +- ext/bg/js/settings/main.js | 2 +- ext/bg/js/settings/popup-preview-frame.js | 2 +- ext/bg/js/settings/popup-preview.js | 2 +- ext/bg/js/settings/profiles.js | 2 +- ext/bg/js/settings/storage.js | 2 +- ext/bg/js/translator.js | 2 +- ext/bg/js/util.js | 2 +- ext/bg/legal.html | 2 +- ext/fg/css/client.css | 2 +- ext/fg/js/document.js | 2 +- ext/fg/js/float.js | 2 +- ext/fg/js/frontend-api-receiver.js | 2 +- ext/fg/js/frontend-api-sender.js | 2 +- ext/fg/js/frontend-initialize.js | 2 +- ext/fg/js/frontend.js | 2 +- ext/fg/js/popup-nested.js | 2 +- ext/fg/js/popup-proxy-host.js | 2 +- ext/fg/js/popup-proxy.js | 2 +- ext/fg/js/popup.js | 2 +- ext/fg/js/source.js | 2 +- ext/mixed/css/display-dark.css | 2 +- ext/mixed/css/display-default.css | 2 +- ext/mixed/css/display.css | 2 +- ext/mixed/js/api.js | 2 +- ext/mixed/js/audio.js | 2 +- ext/mixed/js/core.js | 2 +- ext/mixed/js/display-context.js | 2 +- ext/mixed/js/display.js | 2 +- ext/mixed/js/dom.js | 2 +- ext/mixed/js/japanese.js | 2 +- ext/mixed/js/scroll.js | 2 +- ext/mixed/js/text-scanner.js | 2 +- ext/mixed/js/timer.js | 2 +- 62 files changed, 62 insertions(+), 62 deletions(-) (limited to 'ext/bg/js/backend.js') diff --git a/LICENSE b/LICENSE index 811a6915..266e6069 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2016-2019 Alex Yatskov +Copyright 2016-2020 Alex Yatskov This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/ext/bg/css/settings.css b/ext/bg/css/settings.css index 8adae47c..ee9d18a1 100644 --- a/ext/bg/css/settings.css +++ b/ext/bg/css/settings.css @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/anki.js b/ext/bg/js/anki.js index 17b93620..48ed66bf 100644 --- a/ext/bg/js/anki.js +++ b/ext/bg/js/anki.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 Alex Yatskov + * Copyright (C) 2016-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 9f37ccd8..8ad8d0bb 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/audio.js b/ext/bg/js/audio.js index b39b6c9d..0fc2148d 100644 --- a/ext/bg/js/audio.js +++ b/ext/bg/js/audio.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Alex Yatskov + * Copyright (C) 2017-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/backend-api-forwarder.js b/ext/bg/js/backend-api-forwarder.js index db4d30b9..0a387e08 100644 --- a/ext/bg/js/backend-api-forwarder.js +++ b/ext/bg/js/backend-api-forwarder.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 3c8a068b..2060f414 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2017 Alex Yatskov + * Copyright (C) 2016-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/conditions.js b/ext/bg/js/conditions.js index c0f0f301..d3d0b465 100644 --- a/ext/bg/js/conditions.js +++ b/ext/bg/js/conditions.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/context.js b/ext/bg/js/context.js index 0b21f662..84368256 100644 --- a/ext/bg/js/context.js +++ b/ext/bg/js/context.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Alex Yatskov + * Copyright (C) 2017-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js index 5aee2311..9c44f240 100644 --- a/ext/bg/js/database.js +++ b/ext/bg/js/database.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2017 Alex Yatskov + * Copyright (C) 2016-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/deinflector.js b/ext/bg/js/deinflector.js index 51f4723c..752a0959 100644 --- a/ext/bg/js/deinflector.js +++ b/ext/bg/js/deinflector.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2017 Alex Yatskov + * Copyright (C) 2016-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/dictionary.js b/ext/bg/js/dictionary.js index 28705513..43971f8a 100644 --- a/ext/bg/js/dictionary.js +++ b/ext/bg/js/dictionary.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2017 Alex Yatskov + * Copyright (C) 2016-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/handlebars.js b/ext/bg/js/handlebars.js index b57ba738..7e4b7b8d 100644 --- a/ext/bg/js/handlebars.js +++ b/ext/bg/js/handlebars.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2017 Alex Yatskov + * Copyright (C) 2016-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/json-schema.js b/ext/bg/js/json-schema.js index 3238bc3e..d56f8ef9 100644 --- a/ext/bg/js/json-schema.js +++ b/ext/bg/js/json-schema.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/mecab.js b/ext/bg/js/mecab.js index 62111f73..33f9949e 100644 --- a/ext/bg/js/mecab.js +++ b/ext/bg/js/mecab.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index 84e74bd8..63e7c023 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 Alex Yatskov + * Copyright (C) 2016-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/page-exit-prevention.js b/ext/bg/js/page-exit-prevention.js index aee4e3c2..4143a835 100644 --- a/ext/bg/js/page-exit-prevention.js +++ b/ext/bg/js/page-exit-prevention.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/profile-conditions.js b/ext/bg/js/profile-conditions.js index ebc6680a..20350f4b 100644 --- a/ext/bg/js/profile-conditions.js +++ b/ext/bg/js/profile-conditions.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/request.js b/ext/bg/js/request.js index 7d73d49b..6d05f66e 100644 --- a/ext/bg/js/request.js +++ b/ext/bg/js/request.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Alex Yatskov + * Copyright (C) 2017-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/search-frontend.js b/ext/bg/js/search-frontend.js index fdf7219c..2cf7f5a7 100644 --- a/ext/bg/js/search-frontend.js +++ b/ext/bg/js/search-frontend.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/search-query-parser.js b/ext/bg/js/search-query-parser.js index fc95ddff..fec21d3b 100644 --- a/ext/bg/js/search-query-parser.js +++ b/ext/bg/js/search-query-parser.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js index cbfce6a5..439cde40 100644 --- a/ext/bg/js/search.js +++ b/ext/bg/js/search.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2017 Alex Yatskov + * Copyright (C) 2016-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/settings/anki-templates.js b/ext/bg/js/settings/anki-templates.js index 281383a7..4644214b 100644 --- a/ext/bg/js/settings/anki-templates.js +++ b/ext/bg/js/settings/anki-templates.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/settings/anki.js b/ext/bg/js/settings/anki.js index 25096531..ccce16fe 100644 --- a/ext/bg/js/settings/anki.js +++ b/ext/bg/js/settings/anki.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/settings/audio-ui.js b/ext/bg/js/settings/audio-ui.js index de3be083..dc968628 100644 --- a/ext/bg/js/settings/audio-ui.js +++ b/ext/bg/js/settings/audio-ui.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/settings/audio.js b/ext/bg/js/settings/audio.js index d36876df..5809375c 100644 --- a/ext/bg/js/settings/audio.js +++ b/ext/bg/js/settings/audio.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/settings/backup.js b/ext/bg/js/settings/backup.js index d278b718..3a4d1fd2 100644 --- a/ext/bg/js/settings/backup.js +++ b/ext/bg/js/settings/backup.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/settings/conditions-ui.js b/ext/bg/js/settings/conditions-ui.js index cc9db087..a186a5be 100644 --- a/ext/bg/js/settings/conditions-ui.js +++ b/ext/bg/js/settings/conditions-ui.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/settings/dictionaries.js b/ext/bg/js/settings/dictionaries.js index 717d02cb..330e935a 100644 --- a/ext/bg/js/settings/dictionaries.js +++ b/ext/bg/js/settings/dictionaries.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/settings/main.js b/ext/bg/js/settings/main.js index 3c7d6fce..70650d8b 100644 --- a/ext/bg/js/settings/main.js +++ b/ext/bg/js/settings/main.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2017 Alex Yatskov + * Copyright (C) 2016-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/settings/popup-preview-frame.js b/ext/bg/js/settings/popup-preview-frame.js index 6d017275..7be3466d 100644 --- a/ext/bg/js/settings/popup-preview-frame.js +++ b/ext/bg/js/settings/popup-preview-frame.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/settings/popup-preview.js b/ext/bg/js/settings/popup-preview.js index d8579eb1..ba0c979d 100644 --- a/ext/bg/js/settings/popup-preview.js +++ b/ext/bg/js/settings/popup-preview.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/settings/profiles.js b/ext/bg/js/settings/profiles.js index 946d6944..61fe9bff 100644 --- a/ext/bg/js/settings/profiles.js +++ b/ext/bg/js/settings/profiles.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/settings/storage.js b/ext/bg/js/settings/storage.js index 51ca6855..c040a041 100644 --- a/ext/bg/js/settings/storage.js +++ b/ext/bg/js/settings/storage.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Alex Yatskov + * Copyright (C) 2019-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index 0f3d0aa0..d6f62fd8 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 Alex Yatskov + * Copyright (C) 2016-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js index 4c989642..09c45c08 100644 --- a/ext/bg/js/util.js +++ b/ext/bg/js/util.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2017 Alex Yatskov + * Copyright (C) 2016-2020 Alex Yatskov * Author: Alex Yatskov * * This program is free software: you can redistribute it and/or modify diff --git a/ext/bg/legal.html b/ext/bg/legal.html index 082239d7..4c9029a0 100644 --- a/ext/bg/legal.html +++ b/ext/bg/legal.html @@ -17,7 +17,7 @@

Yomichan License

-Copyright (C) 2016-2019  Alex Yatskov
+Copyright (C) 2016-2020  Alex Yatskov
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/ext/fg/css/client.css b/ext/fg/css/client.css
index 633c88ef..6f52b676 100644
--- a/ext/fg/css/client.css
+++ b/ext/fg/css/client.css
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016  Alex Yatskov 
+ * Copyright (C) 2016-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js
index fa7e7cbc..d6ef5f29 100644
--- a/ext/fg/js/document.js
+++ b/ext/fg/js/document.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017  Alex Yatskov 
+ * Copyright (C) 2016-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/fg/js/float.js b/ext/fg/js/float.js
index 7375b68f..302bcda1 100644
--- a/ext/fg/js/float.js
+++ b/ext/fg/js/float.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017  Alex Yatskov 
+ * Copyright (C) 2016-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/fg/js/frontend-api-receiver.js b/ext/fg/js/frontend-api-receiver.js
index 8d5e52ee..72490f2c 100644
--- a/ext/fg/js/frontend-api-receiver.js
+++ b/ext/fg/js/frontend-api-receiver.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019 Alex Yatskov 
+ * Copyright (C) 2019-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/fg/js/frontend-api-sender.js b/ext/fg/js/frontend-api-sender.js
index b7c2c57c..b90310d6 100644
--- a/ext/fg/js/frontend-api-sender.js
+++ b/ext/fg/js/frontend-api-sender.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019 Alex Yatskov 
+ * Copyright (C) 2019-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/fg/js/frontend-initialize.js b/ext/fg/js/frontend-initialize.js
index c153b5b6..d819688f 100644
--- a/ext/fg/js/frontend-initialize.js
+++ b/ext/fg/js/frontend-initialize.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019  Alex Yatskov 
+ * Copyright (C) 2019-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 6239a057..0ddcecf1 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017  Alex Yatskov 
+ * Copyright (C) 2016-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/fg/js/popup-nested.js b/ext/fg/js/popup-nested.js
index 3df469fe..df619141 100644
--- a/ext/fg/js/popup-nested.js
+++ b/ext/fg/js/popup-nested.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019 Alex Yatskov 
+ * Copyright (C) 2019-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js
index e13d6f05..3cc8a132 100644
--- a/ext/fg/js/popup-proxy-host.js
+++ b/ext/fg/js/popup-proxy-host.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019 Alex Yatskov 
+ * Copyright (C) 2019-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/fg/js/popup-proxy.js b/ext/fg/js/popup-proxy.js
index 0e6a88a7..c29e9e55 100644
--- a/ext/fg/js/popup-proxy.js
+++ b/ext/fg/js/popup-proxy.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019 Alex Yatskov 
+ * Copyright (C) 2019-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index 4d00f629..5d445dba 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017  Alex Yatskov 
+ * Copyright (C) 2016-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/fg/js/source.js b/ext/fg/js/source.js
index a84feed4..cea6623d 100644
--- a/ext/fg/js/source.js
+++ b/ext/fg/js/source.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017  Alex Yatskov 
+ * Copyright (C) 2016-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/mixed/css/display-dark.css b/ext/mixed/css/display-dark.css
index 681d248c..236f36c4 100644
--- a/ext/mixed/css/display-dark.css
+++ b/ext/mixed/css/display-dark.css
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019  Alex Yatskov 
+ * Copyright (C) 2019-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/mixed/css/display-default.css b/ext/mixed/css/display-default.css
index add0a9c8..b563d831 100644
--- a/ext/mixed/css/display-default.css
+++ b/ext/mixed/css/display-default.css
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019  Alex Yatskov 
+ * Copyright (C) 2019-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/mixed/css/display.css b/ext/mixed/css/display.css
index 70fffdc1..5a7cbf5d 100644
--- a/ext/mixed/css/display.css
+++ b/ext/mixed/css/display.css
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016  Alex Yatskov 
+ * Copyright (C) 2016-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/mixed/js/api.js b/ext/mixed/js/api.js
index dc901efc..c801baa3 100644
--- a/ext/mixed/js/api.js
+++ b/ext/mixed/js/api.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017  Alex Yatskov 
+ * Copyright (C) 2016-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/mixed/js/audio.js b/ext/mixed/js/audio.js
index 35f283a4..d9a72a12 100644
--- a/ext/mixed/js/audio.js
+++ b/ext/mixed/js/audio.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019  Alex Yatskov 
+ * Copyright (C) 2019-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/mixed/js/core.js b/ext/mixed/js/core.js
index 5e560a58..9e2b419e 100644
--- a/ext/mixed/js/core.js
+++ b/ext/mixed/js/core.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019  Alex Yatskov 
+ * Copyright (C) 2019-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/mixed/js/display-context.js b/ext/mixed/js/display-context.js
index 4b399881..45c2a823 100644
--- a/ext/mixed/js/display-context.js
+++ b/ext/mixed/js/display-context.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019  Alex Yatskov 
+ * Copyright (C) 2019-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 089941a9..513d2596 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017  Alex Yatskov 
+ * Copyright (C) 2017-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/mixed/js/dom.js b/ext/mixed/js/dom.js
index 4e4d49e3..87448b89 100644
--- a/ext/mixed/js/dom.js
+++ b/ext/mixed/js/dom.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019  Alex Yatskov 
+ * Copyright (C) 2019-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/mixed/js/japanese.js b/ext/mixed/js/japanese.js
index ea1c0065..b046019c 100644
--- a/ext/mixed/js/japanese.js
+++ b/ext/mixed/js/japanese.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016  Alex Yatskov 
+ * Copyright (C) 2016-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/mixed/js/scroll.js b/ext/mixed/js/scroll.js
index 824fd92b..869f0945 100644
--- a/ext/mixed/js/scroll.js
+++ b/ext/mixed/js/scroll.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019  Alex Yatskov 
+ * Copyright (C) 2019-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/mixed/js/text-scanner.js b/ext/mixed/js/text-scanner.js
index 9a739c7e..455c756f 100644
--- a/ext/mixed/js/text-scanner.js
+++ b/ext/mixed/js/text-scanner.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019  Alex Yatskov 
+ * Copyright (C) 2019-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/ext/mixed/js/timer.js b/ext/mixed/js/timer.js
index 87ab62a7..bfa2e087 100644
--- a/ext/mixed/js/timer.js
+++ b/ext/mixed/js/timer.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019  Alex Yatskov 
+ * Copyright (C) 2019-2020  Alex Yatskov 
  * Author: Alex Yatskov 
  *
  * This program is free software: you can redistribute it and/or modify
-- 
cgit v1.2.3


From 0d7ccf25b88abc414358e7cb435a227d43ba548f Mon Sep 17 00:00:00 2001
From: toasted-nutbread 
Date: Wed, 1 Jan 2020 12:00:31 -0500
Subject: Update license info URL

---
 LICENSE                                   | 2 +-
 ext/bg/css/settings.css                   | 2 +-
 ext/bg/js/anki.js                         | 2 +-
 ext/bg/js/api.js                          | 2 +-
 ext/bg/js/audio.js                        | 2 +-
 ext/bg/js/backend-api-forwarder.js        | 2 +-
 ext/bg/js/backend.js                      | 2 +-
 ext/bg/js/conditions.js                   | 2 +-
 ext/bg/js/context.js                      | 2 +-
 ext/bg/js/database.js                     | 2 +-
 ext/bg/js/deinflector.js                  | 2 +-
 ext/bg/js/dictionary.js                   | 2 +-
 ext/bg/js/handlebars.js                   | 2 +-
 ext/bg/js/json-schema.js                  | 2 +-
 ext/bg/js/mecab.js                        | 2 +-
 ext/bg/js/options.js                      | 2 +-
 ext/bg/js/page-exit-prevention.js         | 2 +-
 ext/bg/js/profile-conditions.js           | 2 +-
 ext/bg/js/request.js                      | 2 +-
 ext/bg/js/search-frontend.js              | 2 +-
 ext/bg/js/search-query-parser.js          | 2 +-
 ext/bg/js/search.js                       | 2 +-
 ext/bg/js/settings/anki-templates.js      | 2 +-
 ext/bg/js/settings/anki.js                | 2 +-
 ext/bg/js/settings/audio-ui.js            | 2 +-
 ext/bg/js/settings/audio.js               | 2 +-
 ext/bg/js/settings/backup.js              | 2 +-
 ext/bg/js/settings/conditions-ui.js       | 2 +-
 ext/bg/js/settings/dictionaries.js        | 2 +-
 ext/bg/js/settings/main.js                | 2 +-
 ext/bg/js/settings/popup-preview-frame.js | 2 +-
 ext/bg/js/settings/popup-preview.js       | 2 +-
 ext/bg/js/settings/profiles.js            | 2 +-
 ext/bg/js/settings/storage.js             | 2 +-
 ext/bg/js/translator.js                   | 2 +-
 ext/bg/js/util.js                         | 2 +-
 ext/bg/legal.html                         | 2 +-
 ext/fg/css/client.css                     | 2 +-
 ext/fg/js/document.js                     | 2 +-
 ext/fg/js/float.js                        | 2 +-
 ext/fg/js/frontend-api-receiver.js        | 2 +-
 ext/fg/js/frontend-api-sender.js          | 2 +-
 ext/fg/js/frontend-initialize.js          | 2 +-
 ext/fg/js/frontend.js                     | 2 +-
 ext/fg/js/popup-nested.js                 | 2 +-
 ext/fg/js/popup-proxy-host.js             | 2 +-
 ext/fg/js/popup-proxy.js                  | 2 +-
 ext/fg/js/popup.js                        | 2 +-
 ext/fg/js/source.js                       | 2 +-
 ext/mixed/css/display-dark.css            | 2 +-
 ext/mixed/css/display-default.css         | 2 +-
 ext/mixed/css/display.css                 | 2 +-
 ext/mixed/js/api.js                       | 2 +-
 ext/mixed/js/audio.js                     | 2 +-
 ext/mixed/js/core.js                      | 2 +-
 ext/mixed/js/display-context.js           | 2 +-
 ext/mixed/js/display.js                   | 2 +-
 ext/mixed/js/dom.js                       | 2 +-
 ext/mixed/js/japanese.js                  | 2 +-
 ext/mixed/js/scroll.js                    | 2 +-
 ext/mixed/js/text-scanner.js              | 2 +-
 ext/mixed/js/timer.js                     | 2 +-
 62 files changed, 62 insertions(+), 62 deletions(-)

(limited to 'ext/bg/js/backend.js')

diff --git a/LICENSE b/LICENSE
index 266e6069..f8531a9f 100644
--- a/LICENSE
+++ b/LICENSE
@@ -11,4 +11,4 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program.  If not, see .
+along with this program.  If not, see .
diff --git a/ext/bg/css/settings.css b/ext/bg/css/settings.css
index ee9d18a1..63cead6b 100644
--- a/ext/bg/css/settings.css
+++ b/ext/bg/css/settings.css
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/anki.js b/ext/bg/js/anki.js
index 48ed66bf..10a07061 100644
--- a/ext/bg/js/anki.js
+++ b/ext/bg/js/anki.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js
index 8ad8d0bb..906aaa30 100644
--- a/ext/bg/js/api.js
+++ b/ext/bg/js/api.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/audio.js b/ext/bg/js/audio.js
index 0fc2148d..36ac413b 100644
--- a/ext/bg/js/audio.js
+++ b/ext/bg/js/audio.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/backend-api-forwarder.js b/ext/bg/js/backend-api-forwarder.js
index 0a387e08..170a6b32 100644
--- a/ext/bg/js/backend-api-forwarder.js
+++ b/ext/bg/js/backend-api-forwarder.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index 2060f414..28b0201e 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/conditions.js b/ext/bg/js/conditions.js
index d3d0b465..d4d1c0e0 100644
--- a/ext/bg/js/conditions.js
+++ b/ext/bg/js/conditions.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/context.js b/ext/bg/js/context.js
index 84368256..834174bf 100644
--- a/ext/bg/js/context.js
+++ b/ext/bg/js/context.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js
index 9c44f240..42a143f3 100644
--- a/ext/bg/js/database.js
+++ b/ext/bg/js/database.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/deinflector.js b/ext/bg/js/deinflector.js
index 752a0959..33b2a8b3 100644
--- a/ext/bg/js/deinflector.js
+++ b/ext/bg/js/deinflector.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/dictionary.js b/ext/bg/js/dictionary.js
index 43971f8a..92adc532 100644
--- a/ext/bg/js/dictionary.js
+++ b/ext/bg/js/dictionary.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/handlebars.js b/ext/bg/js/handlebars.js
index 7e4b7b8d..6d1581be 100644
--- a/ext/bg/js/handlebars.js
+++ b/ext/bg/js/handlebars.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/json-schema.js b/ext/bg/js/json-schema.js
index d56f8ef9..5d596a8b 100644
--- a/ext/bg/js/json-schema.js
+++ b/ext/bg/js/json-schema.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/mecab.js b/ext/bg/js/mecab.js
index 33f9949e..8bcbb91c 100644
--- a/ext/bg/js/mecab.js
+++ b/ext/bg/js/mecab.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js
index 63e7c023..8021672b 100644
--- a/ext/bg/js/options.js
+++ b/ext/bg/js/options.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/page-exit-prevention.js b/ext/bg/js/page-exit-prevention.js
index 4143a835..3a320db3 100644
--- a/ext/bg/js/page-exit-prevention.js
+++ b/ext/bg/js/page-exit-prevention.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/profile-conditions.js b/ext/bg/js/profile-conditions.js
index 20350f4b..1fd78e5d 100644
--- a/ext/bg/js/profile-conditions.js
+++ b/ext/bg/js/profile-conditions.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/request.js b/ext/bg/js/request.js
index 6d05f66e..b584c9a9 100644
--- a/ext/bg/js/request.js
+++ b/ext/bg/js/request.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/search-frontend.js b/ext/bg/js/search-frontend.js
index 2cf7f5a7..2fe50a13 100644
--- a/ext/bg/js/search-frontend.js
+++ b/ext/bg/js/search-frontend.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/search-query-parser.js b/ext/bg/js/search-query-parser.js
index fec21d3b..0b3eccbd 100644
--- a/ext/bg/js/search-query-parser.js
+++ b/ext/bg/js/search-query-parser.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js
index 439cde40..a4103ef2 100644
--- a/ext/bg/js/search.js
+++ b/ext/bg/js/search.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 class DisplaySearch extends Display {
diff --git a/ext/bg/js/settings/anki-templates.js b/ext/bg/js/settings/anki-templates.js
index 4644214b..5e74358f 100644
--- a/ext/bg/js/settings/anki-templates.js
+++ b/ext/bg/js/settings/anki-templates.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/settings/anki.js b/ext/bg/js/settings/anki.js
index ccce16fe..5f7989b8 100644
--- a/ext/bg/js/settings/anki.js
+++ b/ext/bg/js/settings/anki.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/settings/audio-ui.js b/ext/bg/js/settings/audio-ui.js
index dc968628..711c2291 100644
--- a/ext/bg/js/settings/audio-ui.js
+++ b/ext/bg/js/settings/audio-ui.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/settings/audio.js b/ext/bg/js/settings/audio.js
index 5809375c..cff3f521 100644
--- a/ext/bg/js/settings/audio.js
+++ b/ext/bg/js/settings/audio.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/settings/backup.js b/ext/bg/js/settings/backup.js
index 3a4d1fd2..becdc568 100644
--- a/ext/bg/js/settings/backup.js
+++ b/ext/bg/js/settings/backup.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/settings/conditions-ui.js b/ext/bg/js/settings/conditions-ui.js
index a186a5be..4d041451 100644
--- a/ext/bg/js/settings/conditions-ui.js
+++ b/ext/bg/js/settings/conditions-ui.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/settings/dictionaries.js b/ext/bg/js/settings/dictionaries.js
index 330e935a..ed171ae9 100644
--- a/ext/bg/js/settings/dictionaries.js
+++ b/ext/bg/js/settings/dictionaries.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/settings/main.js b/ext/bg/js/settings/main.js
index 70650d8b..56828a15 100644
--- a/ext/bg/js/settings/main.js
+++ b/ext/bg/js/settings/main.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 function getOptionsMutable(optionsContext) {
diff --git a/ext/bg/js/settings/popup-preview-frame.js b/ext/bg/js/settings/popup-preview-frame.js
index 7be3466d..2b727cbd 100644
--- a/ext/bg/js/settings/popup-preview-frame.js
+++ b/ext/bg/js/settings/popup-preview-frame.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/settings/popup-preview.js b/ext/bg/js/settings/popup-preview.js
index ba0c979d..0d20471e 100644
--- a/ext/bg/js/settings/popup-preview.js
+++ b/ext/bg/js/settings/popup-preview.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/settings/profiles.js b/ext/bg/js/settings/profiles.js
index 61fe9bff..c4e68b53 100644
--- a/ext/bg/js/settings/profiles.js
+++ b/ext/bg/js/settings/profiles.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 let currentProfileIndex = 0;
diff --git a/ext/bg/js/settings/storage.js b/ext/bg/js/settings/storage.js
index c040a041..6c10f665 100644
--- a/ext/bg/js/settings/storage.js
+++ b/ext/bg/js/settings/storage.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js
index d6f62fd8..7473c6ad 100644
--- a/ext/bg/js/translator.js
+++ b/ext/bg/js/translator.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js
index 09c45c08..333e814b 100644
--- a/ext/bg/js/util.js
+++ b/ext/bg/js/util.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 function utilIsolate(value) {
diff --git a/ext/bg/legal.html b/ext/bg/legal.html
index 4c9029a0..c1e606d7 100644
--- a/ext/bg/legal.html
+++ b/ext/bg/legal.html
@@ -30,7 +30,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+along with this program.  If not, see <https://www.gnu.org/licenses/>.
 

EDRDG License

diff --git a/ext/fg/css/client.css b/ext/fg/css/client.css
index 6f52b676..b9c59da7 100644
--- a/ext/fg/css/client.css
+++ b/ext/fg/css/client.css
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js
index d6ef5f29..e068e3ba 100644
--- a/ext/fg/js/document.js
+++ b/ext/fg/js/document.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/fg/js/float.js b/ext/fg/js/float.js
index 302bcda1..513d246b 100644
--- a/ext/fg/js/float.js
+++ b/ext/fg/js/float.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/fg/js/frontend-api-receiver.js b/ext/fg/js/frontend-api-receiver.js
index 72490f2c..642d96df 100644
--- a/ext/fg/js/frontend-api-receiver.js
+++ b/ext/fg/js/frontend-api-receiver.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/fg/js/frontend-api-sender.js b/ext/fg/js/frontend-api-sender.js
index b90310d6..93c2e593 100644
--- a/ext/fg/js/frontend-api-sender.js
+++ b/ext/fg/js/frontend-api-sender.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/fg/js/frontend-initialize.js b/ext/fg/js/frontend-initialize.js
index d819688f..9c923fea 100644
--- a/ext/fg/js/frontend-initialize.js
+++ b/ext/fg/js/frontend-initialize.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 0ddcecf1..034d9075 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/fg/js/popup-nested.js b/ext/fg/js/popup-nested.js
index df619141..bacf3b93 100644
--- a/ext/fg/js/popup-nested.js
+++ b/ext/fg/js/popup-nested.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js
index 3cc8a132..c4f0c6ff 100644
--- a/ext/fg/js/popup-proxy-host.js
+++ b/ext/fg/js/popup-proxy-host.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/fg/js/popup-proxy.js b/ext/fg/js/popup-proxy.js
index c29e9e55..ae0cffad 100644
--- a/ext/fg/js/popup-proxy.js
+++ b/ext/fg/js/popup-proxy.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index 5d445dba..7a0c6133 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/fg/js/source.js b/ext/fg/js/source.js
index cea6623d..5cdf47b5 100644
--- a/ext/fg/js/source.js
+++ b/ext/fg/js/source.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 // \u200c (Zero-width non-joiner) appears on Google Docs from Chrome 76 onwards
diff --git a/ext/mixed/css/display-dark.css b/ext/mixed/css/display-dark.css
index 236f36c4..e26c72aa 100644
--- a/ext/mixed/css/display-dark.css
+++ b/ext/mixed/css/display-dark.css
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/mixed/css/display-default.css b/ext/mixed/css/display-default.css
index b563d831..ac237e79 100644
--- a/ext/mixed/css/display-default.css
+++ b/ext/mixed/css/display-default.css
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/mixed/css/display.css b/ext/mixed/css/display.css
index 5a7cbf5d..7a00bccb 100644
--- a/ext/mixed/css/display.css
+++ b/ext/mixed/css/display.css
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/mixed/js/api.js b/ext/mixed/js/api.js
index c801baa3..8ed1d996 100644
--- a/ext/mixed/js/api.js
+++ b/ext/mixed/js/api.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/mixed/js/audio.js b/ext/mixed/js/audio.js
index d9a72a12..b0c5fa82 100644
--- a/ext/mixed/js/audio.js
+++ b/ext/mixed/js/audio.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/mixed/js/core.js b/ext/mixed/js/core.js
index 9e2b419e..54e8a9d2 100644
--- a/ext/mixed/js/core.js
+++ b/ext/mixed/js/core.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/mixed/js/display-context.js b/ext/mixed/js/display-context.js
index 45c2a823..c11c2342 100644
--- a/ext/mixed/js/display-context.js
+++ b/ext/mixed/js/display-context.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 513d2596..e756f948 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/mixed/js/dom.js b/ext/mixed/js/dom.js
index 87448b89..807a48e1 100644
--- a/ext/mixed/js/dom.js
+++ b/ext/mixed/js/dom.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/mixed/js/japanese.js b/ext/mixed/js/japanese.js
index b046019c..23b2bd36 100644
--- a/ext/mixed/js/japanese.js
+++ b/ext/mixed/js/japanese.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/mixed/js/scroll.js b/ext/mixed/js/scroll.js
index 869f0945..5829d294 100644
--- a/ext/mixed/js/scroll.js
+++ b/ext/mixed/js/scroll.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/mixed/js/text-scanner.js b/ext/mixed/js/text-scanner.js
index 455c756f..a05dd2ee 100644
--- a/ext/mixed/js/text-scanner.js
+++ b/ext/mixed/js/text-scanner.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
diff --git a/ext/mixed/js/timer.js b/ext/mixed/js/timer.js
index bfa2e087..1caf7a05 100644
--- a/ext/mixed/js/timer.js
+++ b/ext/mixed/js/timer.js
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * along with this program.  If not, see .
  */
 
 
-- 
cgit v1.2.3