From 8454f52378b9410393262122c6920606e187e18f Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Fri, 12 Feb 2021 20:37:43 -0500 Subject: [PATCH] Move more data files (#1373) * Move deinflect.json * Move button.mp3 * Move fonts --- ext/bg/js/backend.js | 2 +- ext/{mixed/mp3 => data/audio}/button.mp3 | Bin ext/{bg/lang => data}/deinflect.json | 0 .../ttf => data/fonts}/kanji-stroke-orders.ttf | Bin ext/mixed/css/display.css | 2 +- ext/mixed/js/audio-system.js | 2 +- test/test-deinflector.js | 2 +- test/test-translator.js | 2 +- 8 files changed, 5 insertions(+), 5 deletions(-) rename ext/{mixed/mp3 => data/audio}/button.mp3 (100%) rename ext/{bg/lang => data}/deinflect.json (100%) rename ext/{mixed/ttf => data/fonts}/kanji-stroke-orders.ttf (100%) diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 3970fe2d..a1f5e6d1 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -207,7 +207,7 @@ class Backend { yomichan.logError(e); } - const deinflectionReasions = await this._fetchAsset('/bg/lang/deinflect.json', true); + const deinflectionReasions = await this._fetchAsset('/data/deinflect.json', true); this._translator.prepare(deinflectionReasions); await this._optionsUtil.prepare(); diff --git a/ext/mixed/mp3/button.mp3 b/ext/data/audio/button.mp3 similarity index 100% rename from ext/mixed/mp3/button.mp3 rename to ext/data/audio/button.mp3 diff --git a/ext/bg/lang/deinflect.json b/ext/data/deinflect.json similarity index 100% rename from ext/bg/lang/deinflect.json rename to ext/data/deinflect.json diff --git a/ext/mixed/ttf/kanji-stroke-orders.ttf b/ext/data/fonts/kanji-stroke-orders.ttf similarity index 100% rename from ext/mixed/ttf/kanji-stroke-orders.ttf rename to ext/data/fonts/kanji-stroke-orders.ttf diff --git a/ext/mixed/css/display.css b/ext/mixed/css/display.css index 476b2c35..bd381c6d 100644 --- a/ext/mixed/css/display.css +++ b/ext/mixed/css/display.css @@ -208,7 +208,7 @@ /* Fonts */ @font-face { font-family: kanji-stroke-orders; - src: url('/mixed/ttf/kanji-stroke-orders.ttf'); + src: url('/data/fonts/kanji-stroke-orders.ttf'); } diff --git a/ext/mixed/js/audio-system.js b/ext/mixed/js/audio-system.js index 0933d90e..cf63511f 100644 --- a/ext/mixed/js/audio-system.js +++ b/ext/mixed/js/audio-system.js @@ -35,7 +35,7 @@ class AudioSystem { getFallbackAudio() { if (this._fallbackAudio === null) { - this._fallbackAudio = new Audio('/mixed/mp3/button.mp3'); + this._fallbackAudio = new Audio('/data/audio/button.mp3'); } return this._fallbackAudio; } diff --git a/test/test-deinflector.js b/test/test-deinflector.js index 6ab00a94..dbc1f7e2 100644 --- a/test/test-deinflector.js +++ b/test/test-deinflector.js @@ -884,7 +884,7 @@ function testDeinflections() { vm.execute(['bg/js/deinflector.js']); const [Deinflector] = vm.get(['Deinflector']); - const deinflectionReasions = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'ext', 'bg/lang/deinflect.json'))); + const deinflectionReasions = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'ext', 'data/deinflect.json'))); const deinflector = new Deinflector(deinflectionReasions); for (const {valid, tests} of data) { diff --git a/test/test-translator.js b/test/test-translator.js index cee7fe16..778a7ce1 100644 --- a/test/test-translator.js +++ b/test/test-translator.js @@ -81,7 +81,7 @@ async function createVM() { // Setup translator const japaneseUtil = new JapaneseUtil(null); const translator = new Translator({japaneseUtil, database: dictionaryDatabase}); - const deinflectionReasions = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'ext', 'bg/lang/deinflect.json'))); + const deinflectionReasions = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'ext', 'data/deinflect.json'))); translator.prepare(deinflectionReasions); // Done