summaryrefslogtreecommitdiff
path: root/ext/js/app
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/app')
-rw-r--r--ext/js/app/content-script-main.js10
-rw-r--r--ext/js/app/content-script-wrapper.js23
-rw-r--r--ext/js/app/frontend.js18
-rw-r--r--ext/js/app/popup-factory.js14
-rw-r--r--ext/js/app/popup-proxy.js7
-rw-r--r--ext/js/app/popup-window.js6
-rw-r--r--ext/js/app/popup.js14
-rw-r--r--ext/js/app/theme-controller.js2
8 files changed, 65 insertions, 29 deletions
diff --git a/ext/js/app/content-script-main.js b/ext/js/app/content-script-main.js
index 0006a244..d5ae0d93 100644
--- a/ext/js/app/content-script-main.js
+++ b/ext/js/app/content-script-main.js
@@ -16,11 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/* global
- * Frontend
- * HotkeyHandler
- * PopupFactory
- */
+import {log} from '../core.js';
+import {HotkeyHandler} from '../input/hotkey-handler.js';
+import {yomichan} from '../yomichan.js';
+import {Frontend} from './frontend.js';
+import {PopupFactory} from './popup-factory.js';
(async () => {
try {
diff --git a/ext/js/app/content-script-wrapper.js b/ext/js/app/content-script-wrapper.js
new file mode 100644
index 00000000..795d3d8b
--- /dev/null
+++ b/ext/js/app/content-script-wrapper.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2023 Yomitan Authors
+ * Copyright (C) 2019-2022 Yomichan Authors
+ *
+ * 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * 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 <https://www.gnu.org/licenses/>.
+ */
+
+(async () => {
+ const src = chrome.runtime.getURL('js/app/content-script-main.js');
+ // eslint-disable-next-line no-unsanitized/method
+ await import(src);
+})();
diff --git a/ext/js/app/frontend.js b/ext/js/app/frontend.js
index dc16701d..acc70667 100644
--- a/ext/js/app/frontend.js
+++ b/ext/js/app/frontend.js
@@ -16,17 +16,21 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/* global
- * DocumentUtil
- * GoogleDocsUtil
- * TextScanner
- * TextSourceRange
- */
+import {GoogleDocsUtil} from '../accessibility/google-docs-util.js';
+import {EventListenerCollection, invokeMessageHandler, isObject, log, promiseAnimationFrame} from '../core.js';
+import {DocumentUtil} from '../dom/document-util.js';
+import {TextSourceElement} from '../dom/text-source-element.js';
+import {TextSourceRange} from '../dom/text-source-range.js';
+import {HotkeyHandler} from '../input/hotkey-handler.js';
+import {TextScanner} from '../language/text-scanner.js';
+import {yomichan} from '../yomichan.js';
+import {PopupFactory} from './popup-factory.js';
+import {Popup} from './popup.js';
/**
* This is the main class responsible for scanning and handling webpage content.
*/
-class Frontend {
+export class Frontend {
/**
* Creates a new instance.
* @param {object} details Details about how to set up the instance.
diff --git a/ext/js/app/popup-factory.js b/ext/js/app/popup-factory.js
index c3c98162..7a17c106 100644
--- a/ext/js/app/popup-factory.js
+++ b/ext/js/app/popup-factory.js
@@ -16,17 +16,17 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/* global
- * FrameOffsetForwarder
- * Popup
- * PopupProxy
- * PopupWindow
- */
+import {FrameOffsetForwarder} from '../comm/frame-offset-forwarder.js';
+import {generateId} from '../core.js';
+import {yomichan} from '../yomichan.js';
+import {PopupProxy} from './popup-proxy.js';
+import {PopupWindow} from './popup-window.js';
+import {Popup} from './popup.js';
/**
* A class which is used to generate and manage popups.
*/
-class PopupFactory {
+export class PopupFactory {
/**
* Creates a new instance.
* @param {number} frameId The frame ID of the host frame.
diff --git a/ext/js/app/popup-proxy.js b/ext/js/app/popup-proxy.js
index e7e51ddf..d16a16f1 100644
--- a/ext/js/app/popup-proxy.js
+++ b/ext/js/app/popup-proxy.js
@@ -16,11 +16,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import {FrameOffsetForwarder} from '../comm/frame-offset-forwarder.js';
+import {EventDispatcher, log} from '../core.js';
+import {yomichan} from '../yomichan.js';
+import {Popup} from './popup.js';
+
/**
* This class is a proxy for a Popup that is hosted in a different frame.
* It effectively forwards all API calls to the underlying Popup.
*/
-class PopupProxy extends EventDispatcher {
+export class PopupProxy extends EventDispatcher {
/**
* Creates a new instance.
* @param {object} details Details about how to set up the instance.
diff --git a/ext/js/app/popup-window.js b/ext/js/app/popup-window.js
index 32e8b250..b5fd9eb6 100644
--- a/ext/js/app/popup-window.js
+++ b/ext/js/app/popup-window.js
@@ -16,10 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import {EventDispatcher} from '../core.js';
+import {yomichan} from '../yomichan.js';
+import {Popup} from './popup.js';
+
/**
* This class represents a popup that is hosted in a new native window.
*/
-class PopupWindow extends EventDispatcher {
+export class PopupWindow extends EventDispatcher {
/**
* Creates a new instance.
* @param {object} details Details about how to set up the instance.
diff --git a/ext/js/app/popup.js b/ext/js/app/popup.js
index 8d140064..6f1807a6 100644
--- a/ext/js/app/popup.js
+++ b/ext/js/app/popup.js
@@ -16,17 +16,17 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/* global
- * DocumentUtil
- * FrameClient
- * ThemeController
- * dynamicLoader
- */
+import {FrameClient} from '../comm/frame-client.js';
+import {DynamicProperty, EventDispatcher, EventListenerCollection, deepEqual} from '../core.js';
+import {DocumentUtil} from '../dom/document-util.js';
+import {dynamicLoader} from '../script/dynamic-loader.js';
+import {yomichan} from '../yomichan.js';
+import {ThemeController} from './theme-controller.js';
/**
* This class is the container which hosts the display of search results.
*/
-class Popup extends EventDispatcher {
+export class Popup extends EventDispatcher {
/**
* Information about how popup content should be shown, specifically related to the outer popup frame.
* @typedef {object} ContentDetails
diff --git a/ext/js/app/theme-controller.js b/ext/js/app/theme-controller.js
index f8d5410b..f403a534 100644
--- a/ext/js/app/theme-controller.js
+++ b/ext/js/app/theme-controller.js
@@ -19,7 +19,7 @@
/**
* This class is used to control theme attributes on DOM elements.
*/
-class ThemeController {
+export class ThemeController {
/**
* Creates a new instance of the class.
* @param {?Element} element A DOM element which theme properties are applied to.