summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-07-17 17:10:25 -0400
committerGitHub <noreply@github.com>2021-07-17 17:10:25 -0400
commitfafa746a632b1907d9cca262f689d7bec4e0f940 (patch)
treef328ef581376cbda0b9d99bd9c3f7892de50a3c1
parent74381302c7a658dc3fd5e6c3a76842dd430341bb (diff)
Sandbox script folders (#1837)
* Move scripts * Update paths * Fix ordering * Simplify eslint rules
-rw-r--r--.eslintrc.json28
-rw-r--r--dev/translator-vm.js6
-rw-r--r--docs/templates.md2
-rw-r--r--ext/background.html4
-rw-r--r--ext/js/data/sandbox/anki-note-data-creator.js (renamed from ext/js/data/anki-note-data-creator.js)0
-rw-r--r--ext/js/display/sandbox/pronunciation-generator.js (renamed from ext/js/display/pronunciation-generator.js)0
-rw-r--r--ext/js/display/sandbox/structured-content-generator.js (renamed from ext/js/display/structured-content-generator.js)0
-rw-r--r--ext/js/dom/sandbox/css-style-applier.js (renamed from ext/js/dom/css-style-applier.js)0
-rw-r--r--ext/js/language/sandbox/dictionary-data-util.js (renamed from ext/js/language/dictionary-data-util.js)0
-rw-r--r--ext/js/language/sandbox/japanese-util.js (renamed from ext/js/language/japanese-util.js)0
-rw-r--r--ext/js/templates/sandbox/template-renderer-frame-api.js (renamed from ext/js/templates/template-renderer-frame-api.js)0
-rw-r--r--ext/js/templates/sandbox/template-renderer-frame-main.js (renamed from ext/js/templates/template-renderer-frame-main.js)0
-rw-r--r--ext/js/templates/sandbox/template-renderer-media-provider.js (renamed from ext/js/templates/template-renderer-media-provider.js)0
-rw-r--r--ext/js/templates/sandbox/template-renderer.js (renamed from ext/js/templates/template-renderer.js)0
-rw-r--r--ext/popup.html8
-rw-r--r--ext/search.html8
-rw-r--r--ext/settings.html4
-rw-r--r--ext/sw.js4
-rw-r--r--ext/template-renderer.html18
-rw-r--r--test/test-anki-note-builder.js8
-rw-r--r--test/test-japanese-util.js2
21 files changed, 37 insertions, 55 deletions
diff --git a/.eslintrc.json b/.eslintrc.json
index ad06ff05..3ad61648 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -110,13 +110,7 @@
{
"files": [
"ext/js/core.js",
- "ext/js/data/anki-note-data-creator.js",
- "ext/js/display/pronunciation-generator.js",
- "ext/js/display/structured-content-generator.js",
- "ext/js/dom/css-style-applier.js",
- "ext/js/language/dictionary-data-util.js",
- "ext/js/templates/template-renderer.js",
- "ext/js/templates/template-renderer-media-provider.js"
+ "ext/js/**/sandbox/**/*.js"
],
"env": {
"webextensions": false
@@ -126,13 +120,7 @@
"files": ["ext/**/*.js"],
"excludedFiles": [
"ext/js/core.js",
- "ext/js/data/anki-note-data-creator.js",
- "ext/js/display/pronunciation-generator.js",
- "ext/js/display/structured-content-generator.js",
- "ext/js/dom/css-style-applier.js",
- "ext/js/language/dictionary-data-util.js",
- "ext/js/templates/template-renderer.js",
- "ext/js/templates/template-renderer-media-provider.js"
+ "ext/js/**/sandbox/**/*.js"
],
"globals": {
"serializeError": "readonly",
@@ -159,13 +147,7 @@
"excludedFiles": [
"ext/js/core.js",
"ext/js/yomichan.js",
- "ext/js/data/anki-note-data-creator.js",
- "ext/js/display/pronunciation-generator.js",
- "ext/js/display/structured-content-generator.js",
- "ext/js/dom/css-style-applier.js",
- "ext/js/language/dictionary-data-util.js",
- "ext/js/templates/template-renderer.js",
- "ext/js/templates/template-renderer-media-provider.js"
+ "ext/js/**/sandbox/**/*.js"
],
"globals": {
"yomichan": "readonly"
@@ -217,9 +199,9 @@
"ext/js/general/regex-util.js",
"ext/js/general/text-source-map.js",
"ext/js/language/deinflector.js",
- "ext/js/language/dictionary-data-util.js",
"ext/js/language/dictionary-database.js",
- "ext/js/language/japanese-util.js",
+ "ext/js/language/sandbox/dictionary-data-util.js",
+ "ext/js/language/sandbox/japanese-util.js",
"ext/js/language/translator.js",
"ext/js/media/audio-downloader.js",
"ext/js/media/media-util.js",
diff --git a/dev/translator-vm.js b/dev/translator-vm.js
index d628608a..742036a8 100644
--- a/dev/translator-vm.js
+++ b/dev/translator-vm.js
@@ -45,17 +45,17 @@ class TranslatorVM extends DatabaseVM {
async prepare(dictionaryDirectory, dictionaryName) {
this.execute([
'js/core.js',
- 'js/data/anki-note-data-creator.js',
+ 'js/data/sandbox/anki-note-data-creator.js',
'js/data/database.js',
'js/data/json-schema.js',
'js/general/cache-map.js',
'js/general/regex-util.js',
'js/general/text-source-map.js',
'js/language/deinflector.js',
- 'js/language/dictionary-data-util.js',
+ 'js/language/sandbox/dictionary-data-util.js',
'js/language/dictionary-importer.js',
'js/language/dictionary-database.js',
- 'js/language/japanese-util.js',
+ 'js/language/sandbox/japanese-util.js',
'js/language/translator.js',
'js/media/media-util.js'
]);
diff --git a/docs/templates.md b/docs/templates.md
index 28878c87..8ee3bb0c 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/js/templates/template-renderer.js).
+The source code for these templates can be found [here](../ext/js/templates/sandbox/template-renderer.js).
### `dumpObject`
diff --git a/ext/background.html b/ext/background.html
index 15cd0b8c..57caa671 100644
--- a/ext/background.html
+++ b/ext/background.html
@@ -42,9 +42,9 @@
<script src="/js/general/regex-util.js"></script>
<script src="/js/general/text-source-map.js"></script>
<script src="/js/language/deinflector.js"></script>
-<script src="/js/language/dictionary-data-util.js"></script>
<script src="/js/language/dictionary-database.js"></script>
-<script src="/js/language/japanese-util.js"></script>
+<script src="/js/language/sandbox/dictionary-data-util.js"></script>
+<script src="/js/language/sandbox/japanese-util.js"></script>
<script src="/js/language/translator.js"></script>
<script src="/js/media/audio-downloader.js"></script>
<script src="/js/media/media-util.js"></script>
diff --git a/ext/js/data/anki-note-data-creator.js b/ext/js/data/sandbox/anki-note-data-creator.js
index 3622e837..3622e837 100644
--- a/ext/js/data/anki-note-data-creator.js
+++ b/ext/js/data/sandbox/anki-note-data-creator.js
diff --git a/ext/js/display/pronunciation-generator.js b/ext/js/display/sandbox/pronunciation-generator.js
index bab36add..bab36add 100644
--- a/ext/js/display/pronunciation-generator.js
+++ b/ext/js/display/sandbox/pronunciation-generator.js
diff --git a/ext/js/display/structured-content-generator.js b/ext/js/display/sandbox/structured-content-generator.js
index 833df6f6..833df6f6 100644
--- a/ext/js/display/structured-content-generator.js
+++ b/ext/js/display/sandbox/structured-content-generator.js
diff --git a/ext/js/dom/css-style-applier.js b/ext/js/dom/sandbox/css-style-applier.js
index c617fead..c617fead 100644
--- a/ext/js/dom/css-style-applier.js
+++ b/ext/js/dom/sandbox/css-style-applier.js
diff --git a/ext/js/language/dictionary-data-util.js b/ext/js/language/sandbox/dictionary-data-util.js
index 951e10ff..951e10ff 100644
--- a/ext/js/language/dictionary-data-util.js
+++ b/ext/js/language/sandbox/dictionary-data-util.js
diff --git a/ext/js/language/japanese-util.js b/ext/js/language/sandbox/japanese-util.js
index c7f79751..c7f79751 100644
--- a/ext/js/language/japanese-util.js
+++ b/ext/js/language/sandbox/japanese-util.js
diff --git a/ext/js/templates/template-renderer-frame-api.js b/ext/js/templates/sandbox/template-renderer-frame-api.js
index f234c8e0..f234c8e0 100644
--- a/ext/js/templates/template-renderer-frame-api.js
+++ b/ext/js/templates/sandbox/template-renderer-frame-api.js
diff --git a/ext/js/templates/template-renderer-frame-main.js b/ext/js/templates/sandbox/template-renderer-frame-main.js
index bb9cac3a..bb9cac3a 100644
--- a/ext/js/templates/template-renderer-frame-main.js
+++ b/ext/js/templates/sandbox/template-renderer-frame-main.js
diff --git a/ext/js/templates/template-renderer-media-provider.js b/ext/js/templates/sandbox/template-renderer-media-provider.js
index 114d3387..114d3387 100644
--- a/ext/js/templates/template-renderer-media-provider.js
+++ b/ext/js/templates/sandbox/template-renderer-media-provider.js
diff --git a/ext/js/templates/template-renderer.js b/ext/js/templates/sandbox/template-renderer.js
index 02471c97..02471c97 100644
--- a/ext/js/templates/template-renderer.js
+++ b/ext/js/templates/sandbox/template-renderer.js
diff --git a/ext/popup.html b/ext/popup.html
index 065bcfa1..1f336943 100644
--- a/ext/popup.html
+++ b/ext/popup.html
@@ -110,9 +110,9 @@
<script src="/js/display/display-resizer.js"></script>
<script src="/js/display/element-overflow-controller.js"></script>
<script src="/js/display/option-toggle-hotkey-handler.js"></script>
-<script src="/js/display/pronunciation-generator.js"></script>
<script src="/js/display/query-parser.js"></script>
-<script src="/js/display/structured-content-generator.js"></script>
+<script src="/js/display/sandbox/pronunciation-generator.js"></script>
+<script src="/js/display/sandbox/structured-content-generator.js"></script>
<script src="/js/dom/document-focus-controller.js"></script>
<script src="/js/dom/document-util.js"></script>
<script src="/js/dom/dom-text-scanner.js"></script>
@@ -125,8 +125,8 @@
<script src="/js/input/hotkey-handler.js"></script>
<script src="/js/input/hotkey-help-controller.js"></script>
<script src="/js/input/hotkey-util.js"></script>
-<script src="/js/language/dictionary-data-util.js"></script>
-<script src="/js/language/japanese-util.js"></script>
+<script src="/js/language/sandbox/dictionary-data-util.js"></script>
+<script src="/js/language/sandbox/japanese-util.js"></script>
<script src="/js/language/text-scanner.js"></script>
<script src="/js/media/audio-system.js"></script>
<script src="/js/media/media-loader.js"></script>
diff --git a/ext/search.html b/ext/search.html
index beceeb18..f32b5412 100644
--- a/ext/search.html
+++ b/ext/search.html
@@ -94,12 +94,12 @@
<script src="/js/display/display-notification.js"></script>
<script src="/js/display/element-overflow-controller.js"></script>
<script src="/js/display/option-toggle-hotkey-handler.js"></script>
-<script src="/js/display/pronunciation-generator.js"></script>
<script src="/js/display/query-parser.js"></script>
+<script src="/js/display/sandbox/pronunciation-generator.js"></script>
+<script src="/js/display/sandbox/structured-content-generator.js"></script>
<script src="/js/display/search-action-popup-controller.js"></script>
<script src="/js/display/search-display-controller.js"></script>
<script src="/js/display/search-persistent-state-controller.js"></script>
-<script src="/js/display/structured-content-generator.js"></script>
<script src="/js/dom/document-focus-controller.js"></script>
<script src="/js/dom/document-util.js"></script>
<script src="/js/dom/dom-text-scanner.js"></script>
@@ -111,8 +111,8 @@
<script src="/js/input/hotkey-handler.js"></script>
<script src="/js/input/hotkey-help-controller.js"></script>
<script src="/js/input/hotkey-util.js"></script>
-<script src="/js/language/dictionary-data-util.js"></script>
-<script src="/js/language/japanese-util.js"></script>
+<script src="/js/language/sandbox/dictionary-data-util.js"></script>
+<script src="/js/language/sandbox/japanese-util.js"></script>
<script src="/js/language/text-scanner.js"></script>
<script src="/js/media/audio-system.js"></script>
<script src="/js/media/media-loader.js"></script>
diff --git a/ext/settings.html b/ext/settings.html
index b45d8c22..9d2d9791 100644
--- a/ext/settings.html
+++ b/ext/settings.html
@@ -3449,10 +3449,10 @@
<script src="/js/general/object-property-accessor.js"></script>
<script src="/js/general/task-accumulator.js"></script>
<script src="/js/input/hotkey-util.js"></script>
-<script src="/js/language/dictionary-data-util.js"></script>
<script src="/js/language/dictionary-database.js"></script>
<script src="/js/language/dictionary-importer.js"></script>
-<script src="/js/language/japanese-util.js"></script>
+<script src="/js/language/sandbox/dictionary-data-util.js"></script>
+<script src="/js/language/sandbox/japanese-util.js"></script>
<script src="/js/media/audio-system.js"></script>
<script src="/js/media/media-util.js"></script>
<script src="/js/media/text-to-speech-audio.js"></script>
diff --git a/ext/sw.js b/ext/sw.js
index a1fb7ea1..6394260e 100644
--- a/ext/sw.js
+++ b/ext/sw.js
@@ -39,9 +39,9 @@ self.importScripts(
'/js/general/regex-util.js',
'/js/general/text-source-map.js',
'/js/language/deinflector.js',
- '/js/language/dictionary-data-util.js',
'/js/language/dictionary-database.js',
- '/js/language/japanese-util.js',
+ '/js/language/sandbox/dictionary-data-util.js',
+ '/js/language/sandbox/japanese-util.js',
'/js/language/translator.js',
'/js/media/audio-downloader.js',
'/js/media/media-util.js',
diff --git a/ext/template-renderer.html b/ext/template-renderer.html
index a3812b37..9e0769f9 100644
--- a/ext/template-renderer.html
+++ b/ext/template-renderer.html
@@ -17,16 +17,16 @@
<!-- Scripts -->
<script src="/lib/handlebars.min.js"></script>
-<script src="/js/data/anki-note-data-creator.js"></script>
-<script src="/js/display/structured-content-generator.js"></script>
-<script src="/js/dom/css-style-applier.js"></script>
-<script src="/js/language/dictionary-data-util.js"></script>
-<script src="/js/language/japanese-util.js"></script>
-<script src="/js/templates/template-renderer.js"></script>
-<script src="/js/templates/template-renderer-frame-api.js"></script>
-<script src="/js/templates/template-renderer-media-provider.js"></script>
+<script src="/js/data/sandbox/anki-note-data-creator.js"></script>
+<script src="/js/display/sandbox/structured-content-generator.js"></script>
+<script src="/js/dom/sandbox/css-style-applier.js"></script>
+<script src="/js/language/sandbox/dictionary-data-util.js"></script>
+<script src="/js/language/sandbox/japanese-util.js"></script>
+<script src="/js/templates/sandbox/template-renderer.js"></script>
+<script src="/js/templates/sandbox/template-renderer-frame-api.js"></script>
+<script src="/js/templates/sandbox/template-renderer-media-provider.js"></script>
-<script src="/js/templates/template-renderer-frame-main.js"></script>
+<script src="/js/templates/sandbox/template-renderer-frame-main.js"></script>
</body>
</html>
diff --git a/test/test-anki-note-builder.js b/test/test-anki-note-builder.js
index 4433e3e6..d6b41c3b 100644
--- a/test/test-anki-note-builder.js
+++ b/test/test-anki-note-builder.js
@@ -43,10 +43,10 @@ async function createVM() {
vm.execute([
'js/data/anki-note-builder.js',
'js/data/anki-util.js',
- 'js/dom/css-style-applier.js',
- 'js/display/structured-content-generator.js',
- 'js/templates/template-renderer.js',
- 'js/templates/template-renderer-media-provider.js',
+ 'js/dom/sandbox/css-style-applier.js',
+ 'js/display/sandbox/structured-content-generator.js',
+ 'js/templates/sandbox/template-renderer.js',
+ 'js/templates/sandbox/template-renderer-media-provider.js',
'lib/handlebars.min.js'
]);
diff --git a/test/test-japanese-util.js b/test/test-japanese-util.js
index 82abf50b..bfeac4f5 100644
--- a/test/test-japanese-util.js
+++ b/test/test-japanese-util.js
@@ -22,7 +22,7 @@ const {VM} = require('../dev/vm');
const vm = new VM();
vm.execute([
'lib/wanakana.min.js',
- 'js/language/japanese-util.js',
+ 'js/language/sandbox/japanese-util.js',
'js/general/text-source-map.js'
]);
const [JapaneseUtil, TextSourceMap, wanakana] = vm.get(['JapaneseUtil', 'TextSourceMap', 'wanakana']);