Pop-up dictionary browser extension for language learning. Successor to Yomichan. (PERSONAL FORK)
1/*
2 * Copyright (C) 2023-2025 Yomitan Authors
3 * Copyright (C) 2019-2022 Yomichan Authors
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
19import {Application} from '../application.js';
20import {DocumentFocusController} from '../dom/document-focus-controller.js';
21import {HotkeyHandler} from '../input/hotkey-handler.js';
22import {ModalController} from '../pages/settings/modal-controller.js';
23import {SettingsController} from '../pages/settings/settings-controller.js';
24import {SettingsDisplayController} from '../pages/settings/settings-display-controller.js';
25import {DisplayAnki} from './display-anki.js';
26import {DisplayAudio} from './display-audio.js';
27import {Display} from './display.js';
28import {SearchActionPopupController} from './search-action-popup-controller.js';
29import {SearchDisplayController} from './search-display-controller.js';
30import {SearchPersistentStateController} from './search-persistent-state-controller.js';
31
32await Application.main(true, async (application) => {
33 const documentFocusController = new DocumentFocusController('#search-textbox');
34 documentFocusController.prepare();
35
36 const searchPersistentStateController = new SearchPersistentStateController();
37 searchPersistentStateController.prepare();
38
39 const searchActionPopupController = new SearchActionPopupController(searchPersistentStateController);
40 searchActionPopupController.prepare();
41
42 const hotkeyHandler = new HotkeyHandler();
43 hotkeyHandler.prepare(application.crossFrame);
44
45 const display = new Display(application, 'search', documentFocusController, hotkeyHandler);
46 await display.prepare();
47
48 const displayAudio = new DisplayAudio(display);
49 displayAudio.prepare();
50
51 const displayAnki = new DisplayAnki(display, displayAudio);
52 displayAnki.prepare();
53
54 const searchDisplayController = new SearchDisplayController(display, displayAudio, searchPersistentStateController);
55 await searchDisplayController.prepare();
56
57 const modalController = new ModalController([]);
58 await modalController.prepare();
59
60 const settingsController = new SettingsController(application);
61 await settingsController.prepare();
62
63 const settingsDisplayController = new SettingsDisplayController(settingsController, modalController);
64 await settingsDisplayController.prepare();
65
66 document.body.hidden = false;
67
68 documentFocusController.focusElement();
69
70 display.initializeState();
71
72 document.documentElement.dataset.loaded = 'true';
73});