diff --git a/.eslintrc.json b/.eslintrc.json index b345234c..fce741ae 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -85,7 +85,7 @@ { "files": [ "ext/js/core.js", - "ext/bg/js/template-renderer.js", + "ext/js/templates/template-renderer.js", "ext/js/language/dictionary-data-util.js" ], "env": { @@ -96,8 +96,8 @@ "files": ["ext/**/*.js"], "excludedFiles": [ "ext/js/core.js", - "ext/bg/js/template-renderer.js", - "ext/bg/js/anki-note-data.js", + "ext/js/templates/template-renderer.js", + "ext/js/data/anki-note-data.js", "ext/js/language/dictionary-data-util.js" ], "globals": { @@ -165,26 +165,26 @@ "ext/js/general/cache-map.js", "ext/js/language/dictionary-data-util.js", "ext/js/general/object-property-accessor.js", - "ext/bg/js/anki.js", - "ext/bg/js/audio-downloader.js", - "ext/bg/js/clipboard-monitor.js", - "ext/bg/js/clipboard-reader.js", - "ext/bg/js/database.js", - "ext/bg/js/deinflector.js", - "ext/bg/js/dictionary-database.js", - "ext/bg/js/json-schema.js", - "ext/bg/js/mecab.js", - "ext/bg/js/media-utility.js", - "ext/bg/js/options.js", - "ext/bg/js/permissions-util.js", - "ext/bg/js/profile-conditions.js", - "ext/bg/js/request-builder.js", - "ext/bg/js/simple-dom-parser.js", - "ext/bg/js/template-patcher.js", - "ext/bg/js/text-source-map.js", - "ext/bg/js/translator.js", - "ext/bg/js/backend.js", - "ext/bg/js/background-main.js" + "ext/js/comm/anki.js", + "ext/js/media/audio-downloader.js", + "ext/js/comm/clipboard-monitor.js", + "ext/js/comm/clipboard-reader.js", + "ext/js/data/database.js", + "ext/js/language/deinflector.js", + "ext/js/language/dictionary-database.js", + "ext/js/data/json-schema.js", + "ext/js/comm/mecab.js", + "ext/js/media/media-utility.js", + "ext/js/data/options-util.js", + "ext/js/data/permissions-util.js", + "ext/js/background/profile-conditions.js", + "ext/js/background/request-builder.js", + "ext/js/dom/simple-dom-parser.js", + "ext/js/templates/template-patcher.js", + "ext/js/general/text-source-map.js", + "ext/js/language/translator.js", + "ext/js/background/backend.js", + "ext/js/background/background-main.js" ], "env": { "browser": false, diff --git a/dev/data/manifest-variants.json b/dev/data/manifest-variants.json index 72e07086..178f1395 100644 --- a/dev/data/manifest-variants.json +++ b/dev/data/manifest-variants.json @@ -122,7 +122,7 @@ "fileName": "yomichan-chrome.zip", "excludeFiles": [ "sw.js", - "bg/js/simple-dom-parser.js", + "js/dom/simple-dom-parser.js", "lib/parse5.js" ] }, @@ -147,7 +147,7 @@ ], "excludeFiles": [ "sw.js", - "bg/js/simple-dom-parser.js", + "js/dom/simple-dom-parser.js", "lib/parse5.js" ] }, @@ -175,7 +175,7 @@ ], "excludeFiles": [ "background.html", - "bg/js/native-simple-dom-parser.js" + "js/dom/native-simple-dom-parser.js" ] }, { @@ -219,7 +219,7 @@ ], "excludeFiles": [ "sw.js", - "bg/js/simple-dom-parser.js", + "js/dom/simple-dom-parser.js", "lib/parse5.js" ] }, @@ -255,7 +255,7 @@ ], "excludeFiles": [ "sw.js", - "bg/js/simple-dom-parser.js", + "js/dom/simple-dom-parser.js", "lib/parse5.js" ] } diff --git a/dev/dictionary-validate.js b/dev/dictionary-validate.js index 17d6e3de..fbb22cfc 100644 --- a/dev/dictionary-validate.js +++ b/dev/dictionary-validate.js @@ -24,7 +24,7 @@ const vm = new VM(); vm.execute([ 'js/core.js', 'js/general/cache-map.js', - 'bg/js/json-schema.js' + 'js/data/json-schema.js' ]); const JsonSchemaValidator = vm.get('JsonSchemaValidator'); diff --git a/dev/schema-validate.js b/dev/schema-validate.js index 0ede032b..1cb69618 100644 --- a/dev/schema-validate.js +++ b/dev/schema-validate.js @@ -22,7 +22,7 @@ const vm = new VM(); vm.execute([ 'js/core.js', 'js/general/cache-map.js', - 'bg/js/json-schema.js' + 'js/data/json-schema.js' ]); const JsonSchemaValidator = vm.get('JsonSchemaValidator'); diff --git a/docs/templates.md b/docs/templates.md index 7425bc4a..8e88a7dc 100644 --- a/docs/templates.md +++ b/docs/templates.md @@ -3,7 +3,7 @@ ## Helpers Yomichan supports several custom Handlebars helpers for rendering templates. -The source code for these templates can be found [here](../ext/bg/js/template-renderer.js). +The source code for these templates can be found [here](../ext/js/templates/template-renderer.js). ### `dumpObject` diff --git a/ext/action-popup.html b/ext/action-popup.html index e6dbdc44..79a3df88 100644 --- a/ext/action-popup.html +++ b/ext/action-popup.html @@ -89,9 +89,9 @@ - + - + diff --git a/ext/background.html b/ext/background.html index 92c3b0aa..740bee57 100644 --- a/ext/background.html +++ b/ext/background.html @@ -26,28 +26,28 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/ext/permissions.html b/ext/permissions.html index 67dc5f85..23d3412a 100644 --- a/ext/permissions.html +++ b/ext/permissions.html @@ -168,11 +168,11 @@ - + - + diff --git a/ext/popup.html b/ext/popup.html index e31237dd..9f3220bc 100644 --- a/ext/popup.html +++ b/ext/popup.html @@ -121,10 +121,10 @@ - - + + - + diff --git a/ext/search.html b/ext/search.html index 1efef61e..65e04949 100644 --- a/ext/search.html +++ b/ext/search.html @@ -104,14 +104,14 @@ - - + + - - - + + + - + diff --git a/ext/settings-old.html b/ext/settings-old.html index d95c4ee4..8b541ab3 100644 --- a/ext/settings-old.html +++ b/ext/settings-old.html @@ -1297,17 +1297,17 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/ext/settings.html b/ext/settings.html index eece5157..faea4aa3 100644 --- a/ext/settings.html +++ b/ext/settings.html @@ -3211,17 +3211,17 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/ext/sw.js b/ext/sw.js index 2cc9a6c3..23f9732c 100644 --- a/ext/sw.js +++ b/ext/sw.js @@ -25,24 +25,24 @@ self.importScripts( '/js/general/cache-map.js', '/js/language/dictionary-data-util.js', '/js/general/object-property-accessor.js', - '/bg/js/anki.js', - '/bg/js/audio-downloader.js', - '/bg/js/clipboard-monitor.js', - '/bg/js/clipboard-reader.js', - '/bg/js/database.js', - '/bg/js/deinflector.js', - '/bg/js/dictionary-database.js', - '/bg/js/json-schema.js', - '/bg/js/mecab.js', - '/bg/js/media-utility.js', - '/bg/js/options.js', - '/bg/js/permissions-util.js', - '/bg/js/profile-conditions.js', - '/bg/js/request-builder.js', - '/bg/js/simple-dom-parser.js', - '/bg/js/template-patcher.js', - '/bg/js/text-source-map.js', - '/bg/js/translator.js', - '/bg/js/backend.js', - '/bg/js/background-main.js' + '/js/comm/anki.js', + '/js/media/audio-downloader.js', + '/js/comm/clipboard-monitor.js', + '/js/comm/clipboard-reader.js', + '/js/data/database.js', + '/js/language/deinflector.js', + '/js/language/dictionary-database.js', + '/js/data/json-schema.js', + '/js/comm/mecab.js', + '/js/media/media-utility.js', + '/js/data/options-util.js', + '/js/data/permissions-util.js', + '/js/background/profile-conditions.js', + '/js/background/request-builder.js', + '/js/dom/simple-dom-parser.js', + '/js/templates/template-patcher.js', + '/js/general/text-source-map.js', + '/js/language/translator.js', + '/js/background/backend.js', + '/js/background/background-main.js' ); diff --git a/ext/template-renderer.html b/ext/template-renderer.html index 11c19067..7245ed62 100644 --- a/ext/template-renderer.html +++ b/ext/template-renderer.html @@ -16,9 +16,9 @@ - - - - + + + + diff --git a/ext/welcome.html b/ext/welcome.html index 98992aec..16dd964d 100644 --- a/ext/welcome.html +++ b/ext/welcome.html @@ -331,12 +331,12 @@ - - - - - - + + + + + + @@ -349,7 +349,7 @@ - + diff --git a/test/test-database.js b/test/test-database.js index 8b075fd4..ae827318 100644 --- a/test/test-database.js +++ b/test/test-database.js @@ -25,11 +25,11 @@ const vm = new DatabaseVM(); vm.execute([ 'js/core.js', 'js/general/cache-map.js', - 'bg/js/json-schema.js', - 'bg/js/media-utility.js', - 'bg/js/dictionary-importer.js', - 'bg/js/database.js', - 'bg/js/dictionary-database.js' + 'js/data/json-schema.js', + 'js/media/media-utility.js', + 'js/language/dictionary-importer.js', + 'js/data/database.js', + 'js/language/dictionary-database.js' ]); const DictionaryImporter = vm.get('DictionaryImporter'); const DictionaryDatabase = vm.get('DictionaryDatabase'); diff --git a/test/test-deinflector.js b/test/test-deinflector.js index dbc1f7e2..a5d6c06f 100644 --- a/test/test-deinflector.js +++ b/test/test-deinflector.js @@ -881,7 +881,7 @@ function testDeinflections() { ]; const vm = new VM(); - vm.execute(['bg/js/deinflector.js']); + vm.execute(['js/language/deinflector.js']); const [Deinflector] = vm.get(['Deinflector']); const deinflectionReasions = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'ext', 'data/deinflect.json'))); diff --git a/test/test-japanese.js b/test/test-japanese.js index e2be2315..590d3157 100644 --- a/test/test-japanese.js +++ b/test/test-japanese.js @@ -23,7 +23,7 @@ const vm = new VM(); vm.execute([ 'lib/wanakana.min.js', 'js/language/japanese-util.js', - 'bg/js/text-source-map.js' + 'js/general/text-source-map.js' ]); const [JapaneseUtil, TextSourceMap, wanakana] = vm.get(['JapaneseUtil', 'TextSourceMap', 'wanakana']); const jp = new JapaneseUtil(wanakana); diff --git a/test/test-options-util.js b/test/test-options-util.js index 3e3f93bc..20b1f3f4 100644 --- a/test/test-options-util.js +++ b/test/test-options-util.js @@ -49,9 +49,9 @@ function createVM(extDir) { vm.execute([ 'js/core.js', 'js/general/cache-map.js', - 'bg/js/json-schema.js', - 'bg/js/template-patcher.js', - 'bg/js/options.js' + 'js/data/json-schema.js', + 'js/templates/template-patcher.js', + 'js/data/options-util.js' ]); return vm; diff --git a/test/test-profile-conditions.js b/test/test-profile-conditions.js index 7ceda8c4..e1e6a72c 100644 --- a/test/test-profile-conditions.js +++ b/test/test-profile-conditions.js @@ -24,8 +24,8 @@ const vm = new VM({}); vm.execute([ 'js/core.js', 'js/general/cache-map.js', - 'bg/js/json-schema.js', - 'bg/js/profile-conditions.js' + 'js/data/json-schema.js', + 'js/background/profile-conditions.js' ]); const [JsonSchemaValidator, ProfileConditions] = vm.get(['JsonSchemaValidator', 'ProfileConditions']); diff --git a/test/test-schema.js b/test/test-schema.js index 2c48f5f5..7a1ea9bc 100644 --- a/test/test-schema.js +++ b/test/test-schema.js @@ -23,7 +23,7 @@ const vm = new VM(); vm.execute([ 'js/core.js', 'js/general/cache-map.js', - 'bg/js/json-schema.js' + 'js/data/json-schema.js' ]); const JsonSchemaValidator = vm.get('JsonSchemaValidator'); diff --git a/test/test-sw.js b/test/test-sw.js index 803bb0c2..498a0a32 100644 --- a/test/test-sw.js +++ b/test/test-sw.js @@ -38,9 +38,9 @@ function getAllHtmlScriptPaths(fileName) { function convertBackgroundScriptsToServiceWorkerScripts(scripts) { // Use parse5-based SimpleDOMParser scripts.splice(0, 0, '/lib/parse5.js'); - const index = scripts.indexOf('/bg/js/native-simple-dom-parser.js'); + const index = scripts.indexOf('/js/dom/native-simple-dom-parser.js'); assert.ok(index >= 0); - scripts[index] = '/bg/js/simple-dom-parser.js'; + scripts[index] = '/js/dom/simple-dom-parser.js'; } function main() { diff --git a/test/test-text-source-map.js b/test/test-text-source-map.js index 68bb97b0..9f0c17bd 100644 --- a/test/test-text-source-map.js +++ b/test/test-text-source-map.js @@ -20,7 +20,7 @@ const {testMain} = require('../dev/util'); const {VM} = require('../dev/vm'); const vm = new VM(); -vm.execute(['bg/js/text-source-map.js']); +vm.execute(['js/general/text-source-map.js']); const TextSourceMap = vm.get('TextSourceMap'); diff --git a/test/test-translator.js b/test/test-translator.js index e1161a15..2d7b6baa 100644 --- a/test/test-translator.js +++ b/test/test-translator.js @@ -39,14 +39,14 @@ async function createVM() { 'js/core.js', 'js/general/cache-map.js', 'js/language/japanese-util.js', - 'bg/js/json-schema.js', - 'bg/js/media-utility.js', - 'bg/js/dictionary-importer.js', - 'bg/js/database.js', - 'bg/js/dictionary-database.js', - 'bg/js/text-source-map.js', - 'bg/js/deinflector.js', - 'bg/js/translator.js' + 'js/data/json-schema.js', + 'js/media/media-utility.js', + 'js/language/dictionary-importer.js', + 'js/data/database.js', + 'js/language/dictionary-database.js', + 'js/general/text-source-map.js', + 'js/language/deinflector.js', + 'js/language/translator.js' ]); const [ DictionaryImporter,