diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-02-12 19:56:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-12 19:56:24 -0500 |
commit | 2b4af57bd764ee07ed1d7db8e2985e34ba7ef8ea (patch) | |
tree | 06af52cf528773838c1144a323e74c93ddebdf45 | |
parent | 37f916171812afe22f1b435d9e06b52af5d8292a (diff) |
Move data folder (#1371)
* Move handlebars template files
* Move schema files
-rw-r--r-- | dev/dictionary-validate.js | 16 | ||||
-rw-r--r-- | ext/bg/js/audio-downloader.js | 2 | ||||
-rw-r--r-- | ext/bg/js/backend.js | 2 | ||||
-rw-r--r-- | ext/bg/js/dictionary-importer.js | 16 | ||||
-rw-r--r-- | ext/bg/js/options.js | 10 | ||||
-rw-r--r-- | ext/bg/settings2.html | 2 | ||||
-rw-r--r-- | ext/data/schemas/custom-audio-list-schema.json (renamed from ext/bg/data/custom-audio-list-schema.json) | 0 | ||||
-rw-r--r-- | ext/data/schemas/dictionary-index-schema.json (renamed from ext/bg/data/dictionary-index-schema.json) | 0 | ||||
-rw-r--r-- | ext/data/schemas/dictionary-kanji-bank-v1-schema.json (renamed from ext/bg/data/dictionary-kanji-bank-v1-schema.json) | 0 | ||||
-rw-r--r-- | ext/data/schemas/dictionary-kanji-bank-v3-schema.json (renamed from ext/bg/data/dictionary-kanji-bank-v3-schema.json) | 0 | ||||
-rw-r--r-- | ext/data/schemas/dictionary-kanji-meta-bank-v3-schema.json (renamed from ext/bg/data/dictionary-kanji-meta-bank-v3-schema.json) | 0 | ||||
-rw-r--r-- | ext/data/schemas/dictionary-tag-bank-v3-schema.json (renamed from ext/bg/data/dictionary-tag-bank-v3-schema.json) | 0 | ||||
-rw-r--r-- | ext/data/schemas/dictionary-term-bank-v1-schema.json (renamed from ext/bg/data/dictionary-term-bank-v1-schema.json) | 0 | ||||
-rw-r--r-- | ext/data/schemas/dictionary-term-bank-v3-schema.json (renamed from ext/bg/data/dictionary-term-bank-v3-schema.json) | 0 | ||||
-rw-r--r-- | ext/data/schemas/dictionary-term-meta-bank-v3-schema.json (renamed from ext/bg/data/dictionary-term-meta-bank-v3-schema.json) | 0 | ||||
-rw-r--r-- | ext/data/schemas/options-schema.json (renamed from ext/bg/data/options-schema.json) | 0 | ||||
-rw-r--r-- | ext/data/templates/anki-field-templates-upgrade-v2.handlebars (renamed from ext/bg/data/anki-field-templates-upgrade-v2.handlebars) | 0 | ||||
-rw-r--r-- | ext/data/templates/anki-field-templates-upgrade-v4.handlebars (renamed from ext/bg/data/anki-field-templates-upgrade-v4.handlebars) | 0 | ||||
-rw-r--r-- | ext/data/templates/anki-field-templates-upgrade-v6.handlebars (renamed from ext/bg/data/anki-field-templates-upgrade-v6.handlebars) | 0 | ||||
-rw-r--r-- | ext/data/templates/anki-field-templates-upgrade-v8.handlebars (renamed from ext/bg/data/anki-field-templates-upgrade-v8.handlebars) | 0 | ||||
-rw-r--r-- | ext/data/templates/default-anki-field-templates.handlebars (renamed from ext/bg/data/default-anki-field-templates.handlebars) | 0 | ||||
-rw-r--r-- | test/test-options-util.js | 8 |
22 files changed, 28 insertions, 28 deletions
diff --git a/dev/dictionary-validate.js b/dev/dictionary-validate.js index 26c8185b..873bcb8a 100644 --- a/dev/dictionary-validate.js +++ b/dev/dictionary-validate.js @@ -71,14 +71,14 @@ async function validateDictionary(archive, schemas) { function getSchemas() { return { - index: readSchema('../ext/bg/data/dictionary-index-schema.json'), - kanjiBankV1: readSchema('../ext/bg/data/dictionary-kanji-bank-v1-schema.json'), - kanjiBankV3: readSchema('../ext/bg/data/dictionary-kanji-bank-v3-schema.json'), - kanjiMetaBankV3: readSchema('../ext/bg/data/dictionary-kanji-meta-bank-v3-schema.json'), - tagBankV3: readSchema('../ext/bg/data/dictionary-tag-bank-v3-schema.json'), - termBankV1: readSchema('../ext/bg/data/dictionary-term-bank-v1-schema.json'), - termBankV3: readSchema('../ext/bg/data/dictionary-term-bank-v3-schema.json'), - termMetaBankV3: readSchema('../ext/bg/data/dictionary-term-meta-bank-v3-schema.json') + index: readSchema('../ext/data/schemas/dictionary-index-schema.json'), + kanjiBankV1: readSchema('../ext/data/schemas/dictionary-kanji-bank-v1-schema.json'), + kanjiBankV3: readSchema('../ext/data/schemas/dictionary-kanji-bank-v3-schema.json'), + kanjiMetaBankV3: readSchema('../ext/data/schemas/dictionary-kanji-meta-bank-v3-schema.json'), + tagBankV3: readSchema('../ext/data/schemas/dictionary-tag-bank-v3-schema.json'), + termBankV1: readSchema('../ext/data/schemas/dictionary-term-bank-v1-schema.json'), + termBankV3: readSchema('../ext/data/schemas/dictionary-term-bank-v3-schema.json'), + termMetaBankV3: readSchema('../ext/data/schemas/dictionary-term-meta-bank-v3-schema.json') }; } diff --git a/ext/bg/js/audio-downloader.js b/ext/bg/js/audio-downloader.js index 25c25250..4e77419b 100644 --- a/ext/bg/js/audio-downloader.js +++ b/ext/bg/js/audio-downloader.js @@ -300,7 +300,7 @@ class AudioDownloader { async _getCustomAudioListSchema() { let schema = this._customAudioListSchema; if (schema === null) { - const url = chrome.runtime.getURL('/bg/data/custom-audio-list-schema.json'); + const url = chrome.runtime.getURL('/data/schemas/custom-audio-list-schema.json'); const response = await fetch(url, { method: 'GET', mode: 'no-cors', diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 3dd1955f..3970fe2d 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -211,7 +211,7 @@ class Backend { this._translator.prepare(deinflectionReasions); await this._optionsUtil.prepare(); - this._defaultAnkiFieldTemplates = (await this._fetchAsset('/bg/data/default-anki-field-templates.handlebars')).trim(); + this._defaultAnkiFieldTemplates = (await this._fetchAsset('/data/templates/default-anki-field-templates.handlebars')).trim(); this._options = await this._optionsUtil.load(); this._applyOptions('background'); diff --git a/ext/bg/js/dictionary-importer.js b/ext/bg/js/dictionary-importer.js index 33870259..4cb608db 100644 --- a/ext/bg/js/dictionary-importer.js +++ b/ext/bg/js/dictionary-importer.js @@ -50,7 +50,7 @@ class DictionaryImporter { const index = JSON.parse(await indexFile.async('string')); - const indexSchema = await this._getSchema('/bg/data/dictionary-index-schema.json'); + const indexSchema = await this._getSchema('/data/schemas/dictionary-index-schema.json'); this._validateJsonSchema(index, indexSchema, indexFileName); const dictionaryTitle = index.title; @@ -280,17 +280,17 @@ class DictionaryImporter { _getDataBankSchemaPaths(version) { const termBank = ( version === 1 ? - '/bg/data/dictionary-term-bank-v1-schema.json' : - '/bg/data/dictionary-term-bank-v3-schema.json' + '/data/schemas/dictionary-term-bank-v1-schema.json' : + '/data/schemas/dictionary-term-bank-v3-schema.json' ); - const termMetaBank = '/bg/data/dictionary-term-meta-bank-v3-schema.json'; + const termMetaBank = '/data/schemas/dictionary-term-meta-bank-v3-schema.json'; const kanjiBank = ( version === 1 ? - '/bg/data/dictionary-kanji-bank-v1-schema.json' : - '/bg/data/dictionary-kanji-bank-v3-schema.json' + '/data/schemas/dictionary-kanji-bank-v1-schema.json' : + '/data/schemas/dictionary-kanji-bank-v3-schema.json' ); - const kanjiMetaBank = '/bg/data/dictionary-kanji-meta-bank-v3-schema.json'; - const tagBank = '/bg/data/dictionary-tag-bank-v3-schema.json'; + const kanjiMetaBank = '/data/schemas/dictionary-kanji-meta-bank-v3-schema.json'; + const tagBank = '/data/schemas/dictionary-tag-bank-v3-schema.json'; return [termBank, termMetaBank, kanjiBank, kanjiMetaBank, tagBank]; } diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index 9e0e9cf0..1105dfed 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -28,7 +28,7 @@ class OptionsUtil { } async prepare() { - this._optionsSchema = await this._fetchAsset('/bg/data/options-schema.json', true); + this._optionsSchema = await this._fetchAsset('/data/schemas/options-schema.json', true); } async update(options) { @@ -487,7 +487,7 @@ class OptionsUtil { async _updateVersion3(options) { // Version 3 changes: // Pitch accent Anki field templates added. - await this._applyAnkiFieldTemplatesPatch(options, '/bg/data/anki-field-templates-upgrade-v2.handlebars'); + await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v2.handlebars'); return options; } @@ -572,7 +572,7 @@ class OptionsUtil { }); profileOptions.scanning.inputs = scanningInputs; } - await this._applyAnkiFieldTemplatesPatch(options, '/bg/data/anki-field-templates-upgrade-v4.handlebars'); + await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v4.handlebars'); return options; } @@ -592,7 +592,7 @@ class OptionsUtil { // Added global option useSettingsV2. // Added anki.checkForDuplicates. // Added general.glossaryLayoutMode; removed general.compactGlossaries. - await this._applyAnkiFieldTemplatesPatch(options, '/bg/data/anki-field-templates-upgrade-v6.handlebars'); + await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v6.handlebars'); options.global.showPopupPreview = false; options.global.useSettingsV2 = false; for (const profile of options.profiles) { @@ -665,7 +665,7 @@ class OptionsUtil { // Moved general.enableClipboardMonitor => clipboard.enableSearchPageMonitor. Forced value to false due to a bug which caused its value to not be read. // Moved general.maximumClipboardSearchLength => clipboard.maximumSearchLength. // Added clipboard.autoSearchContent. - await this._applyAnkiFieldTemplatesPatch(options, '/bg/data/anki-field-templates-upgrade-v8.handlebars'); + await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v8.handlebars'); options.global.useSettingsV2 = true; for (const profile of options.profiles) { profile.options.translation.textReplacements = { diff --git a/ext/bg/settings2.html b/ext/bg/settings2.html index 88a55206..37bb1996 100644 --- a/ext/bg/settings2.html +++ b/ext/bg/settings2.html @@ -2283,7 +2283,7 @@ </li> <li> <strong>JSON</strong> - The link is interpreted as a link to a JSON file, which is downloaded and parsed for audio URLs. - The format of the JSON file is specified in <a href="/bg/data/custom-audio-list-schema.json" target="_blank" rel="noopener noreferrer">this schema file</a>. + The format of the JSON file is specified in <a href="/data/schemas/custom-audio-list-schema.json" target="_blank" rel="noopener noreferrer">this schema file</a>. </li> </ul> <p> diff --git a/ext/bg/data/custom-audio-list-schema.json b/ext/data/schemas/custom-audio-list-schema.json index 2cb3ca78..2cb3ca78 100644 --- a/ext/bg/data/custom-audio-list-schema.json +++ b/ext/data/schemas/custom-audio-list-schema.json diff --git a/ext/bg/data/dictionary-index-schema.json b/ext/data/schemas/dictionary-index-schema.json index 09cff711..09cff711 100644 --- a/ext/bg/data/dictionary-index-schema.json +++ b/ext/data/schemas/dictionary-index-schema.json diff --git a/ext/bg/data/dictionary-kanji-bank-v1-schema.json b/ext/data/schemas/dictionary-kanji-bank-v1-schema.json index 6dad5a7a..6dad5a7a 100644 --- a/ext/bg/data/dictionary-kanji-bank-v1-schema.json +++ b/ext/data/schemas/dictionary-kanji-bank-v1-schema.json diff --git a/ext/bg/data/dictionary-kanji-bank-v3-schema.json b/ext/data/schemas/dictionary-kanji-bank-v3-schema.json index a5b82039..a5b82039 100644 --- a/ext/bg/data/dictionary-kanji-bank-v3-schema.json +++ b/ext/data/schemas/dictionary-kanji-bank-v3-schema.json diff --git a/ext/bg/data/dictionary-kanji-meta-bank-v3-schema.json b/ext/data/schemas/dictionary-kanji-meta-bank-v3-schema.json index 62479026..62479026 100644 --- a/ext/bg/data/dictionary-kanji-meta-bank-v3-schema.json +++ b/ext/data/schemas/dictionary-kanji-meta-bank-v3-schema.json diff --git a/ext/bg/data/dictionary-tag-bank-v3-schema.json b/ext/data/schemas/dictionary-tag-bank-v3-schema.json index ee5ca64d..ee5ca64d 100644 --- a/ext/bg/data/dictionary-tag-bank-v3-schema.json +++ b/ext/data/schemas/dictionary-tag-bank-v3-schema.json diff --git a/ext/bg/data/dictionary-term-bank-v1-schema.json b/ext/data/schemas/dictionary-term-bank-v1-schema.json index 6ffb26e6..6ffb26e6 100644 --- a/ext/bg/data/dictionary-term-bank-v1-schema.json +++ b/ext/data/schemas/dictionary-term-bank-v1-schema.json diff --git a/ext/bg/data/dictionary-term-bank-v3-schema.json b/ext/data/schemas/dictionary-term-bank-v3-schema.json index 4790e561..4790e561 100644 --- a/ext/bg/data/dictionary-term-bank-v3-schema.json +++ b/ext/data/schemas/dictionary-term-bank-v3-schema.json diff --git a/ext/bg/data/dictionary-term-meta-bank-v3-schema.json b/ext/data/schemas/dictionary-term-meta-bank-v3-schema.json index ffffb546..ffffb546 100644 --- a/ext/bg/data/dictionary-term-meta-bank-v3-schema.json +++ b/ext/data/schemas/dictionary-term-meta-bank-v3-schema.json diff --git a/ext/bg/data/options-schema.json b/ext/data/schemas/options-schema.json index f4f5d0ca..f4f5d0ca 100644 --- a/ext/bg/data/options-schema.json +++ b/ext/data/schemas/options-schema.json diff --git a/ext/bg/data/anki-field-templates-upgrade-v2.handlebars b/ext/data/templates/anki-field-templates-upgrade-v2.handlebars index c018094e..c018094e 100644 --- a/ext/bg/data/anki-field-templates-upgrade-v2.handlebars +++ b/ext/data/templates/anki-field-templates-upgrade-v2.handlebars diff --git a/ext/bg/data/anki-field-templates-upgrade-v4.handlebars b/ext/data/templates/anki-field-templates-upgrade-v4.handlebars index dc88395a..dc88395a 100644 --- a/ext/bg/data/anki-field-templates-upgrade-v4.handlebars +++ b/ext/data/templates/anki-field-templates-upgrade-v4.handlebars diff --git a/ext/bg/data/anki-field-templates-upgrade-v6.handlebars b/ext/data/templates/anki-field-templates-upgrade-v6.handlebars index 809423ce..809423ce 100644 --- a/ext/bg/data/anki-field-templates-upgrade-v6.handlebars +++ b/ext/data/templates/anki-field-templates-upgrade-v6.handlebars diff --git a/ext/bg/data/anki-field-templates-upgrade-v8.handlebars b/ext/data/templates/anki-field-templates-upgrade-v8.handlebars index b3aed45f..b3aed45f 100644 --- a/ext/bg/data/anki-field-templates-upgrade-v8.handlebars +++ b/ext/data/templates/anki-field-templates-upgrade-v8.handlebars diff --git a/ext/bg/data/default-anki-field-templates.handlebars b/ext/data/templates/default-anki-field-templates.handlebars index 0f390e8d..0f390e8d 100644 --- a/ext/bg/data/default-anki-field-templates.handlebars +++ b/ext/data/templates/default-anki-field-templates.handlebars diff --git a/test/test-options-util.js b/test/test-options-util.js index 310e3d88..e4bc4e94 100644 --- a/test/test-options-util.js +++ b/test/test-options-util.js @@ -620,10 +620,10 @@ async function testFieldTemplatesUpdate(extDir) { const content = fs.readFileSync(path.join(extDir, fileName), {encoding: 'utf8'}); return templatePatcher.parsePatch(content).addition; }; - const update2 = loadDataFile('bg/data/anki-field-templates-upgrade-v2.handlebars'); - const update4 = loadDataFile('bg/data/anki-field-templates-upgrade-v4.handlebars'); - const update6 = loadDataFile('bg/data/anki-field-templates-upgrade-v6.handlebars'); - const update8 = loadDataFile('bg/data/anki-field-templates-upgrade-v8.handlebars'); + const update2 = loadDataFile('data/templates/anki-field-templates-upgrade-v2.handlebars'); + const update4 = loadDataFile('data/templates/anki-field-templates-upgrade-v4.handlebars'); + const update6 = loadDataFile('data/templates/anki-field-templates-upgrade-v6.handlebars'); + const update8 = loadDataFile('data/templates/anki-field-templates-upgrade-v8.handlebars'); const data = [ // Standard format |