Adrià Vilanova Martínez | 2d03555 | 2024-10-26 20:23:34 +0200 | [diff] [blame] | 1 | // Run legacy Javascript entry point |
| 2 | import '../../../contentScripts/communityConsole/start'; |
| 3 | |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 4 | import DependenciesProviderSingleton, { |
| 5 | AutoRefreshDependency, |
Adrià Vilanova Martínez | cb12c59 | 2024-11-09 20:46:03 +0100 | [diff] [blame] | 6 | ExtraInfoDependency, |
Adrià Vilanova Martínez | 3913f4d | 2024-10-26 21:16:38 +0200 | [diff] [blame] | 7 | OptionsProviderDependency, |
| 8 | StartupDataStorageDependency, |
Adrià Vilanova Martínez | 4e847f4 | 2024-11-09 23:03:32 +0100 | [diff] [blame] | 9 | ThreadPageDesignWarningDependency, |
Adrià Vilanova Martínez | ed1aba3 | 2024-10-26 21:23:12 +0200 | [diff] [blame] | 10 | WorkflowsImportDependency, |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 11 | } from '../../../common/architecture/dependenciesProvider/DependenciesProvider'; |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 12 | import AutoRefreshSetUpScript from '../../../features/autoRefresh/presentation/scripts/setUp.script'; |
Adrià Vilanova Martínez | fe69478 | 2024-11-09 20:40:43 +0100 | [diff] [blame] | 13 | import CCDarkThemeInjectAutoDarkTheme from '../../../features/ccDarkTheme/presentation/scripts/injectAutoDarkTheme.script'; |
| 14 | import CCDarkThemeInjectForcedDarkTheme from '../../../features/ccDarkTheme/presentation/scripts/injectForcedDarkTheme.script'; |
Adrià Vilanova Martínez | 2d03555 | 2024-10-26 20:23:34 +0200 | [diff] [blame] | 15 | import InteropThreadPageSetupScript from '../../../features/interopThreadPage/presentation/scripts/setup.script'; |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 16 | import ScriptRunner from '../../../infrastructure/presentation/scripts/ScriptRunner'; |
| 17 | import ScriptSorterAdapter from '../../../infrastructure/presentation/scripts/ScriptSorter.adapter'; |
| 18 | import { SortedScriptsProviderAdapter } from '../../../infrastructure/presentation/scripts/SortedScriptsProvider.adapter'; |
Adrià Vilanova Martínez | 3913f4d | 2024-10-26 21:16:38 +0200 | [diff] [blame] | 19 | import LoadDraftsSetupScript from '../../../features/loadDrafts/presentation/scripts/setup.script'; |
Adrià Vilanova Martínez | ed1aba3 | 2024-10-26 21:23:12 +0200 | [diff] [blame] | 20 | import WorkflowsImportSetUpScript from '../../../features/workflows/presentation/scripts/importSetUp.script'; |
Adrià Vilanova Martínez | cb12c59 | 2024-11-09 20:46:03 +0100 | [diff] [blame] | 21 | import CCExtraInfoSetUpScript from '../../../features/extraInfo/presentation/scripts/ccExtraInfoSetUp.script'; |
Adrià Vilanova Martínez | 33a009c | 2024-11-09 22:41:56 +0100 | [diff] [blame] | 22 | import MWI18nServerScript from '../../../presentation/standaloneScripts/mainWorldServers/MWI18nServerScript.script'; |
| 23 | import MWOptionsWatcherServerScript from '../../../presentation/standaloneScripts/mainWorldServers/MWOptionsWatcherServerScript.script'; |
| 24 | import ApplyStartupDataModificationsOnStartScript from '../../../presentation/standaloneScripts/startupDataStorage/applyStartupDataModificationsOnStart.script'; |
| 25 | import XHRInterceptorScript from '../../../presentation/standaloneScripts/xhrInterceptor/xhrInterceptor.script'; |
Adrià Vilanova Martínez | 4e847f4 | 2024-11-09 23:03:32 +0100 | [diff] [blame] | 26 | import ThreadPageDesignWarningSetUpScript from '../../../features/threadPageDesignWarning/presentation/scripts/setUp.script'; |
Adrià Vilanova Martínez | 3c13a76 | 2024-11-09 23:03:32 +0100 | [diff] [blame^] | 27 | import FlattenThreadsSetUpReplyActionHandlerScript from '../../../features/flattenThreads/presentation/scripts/setUpReplyActionHandler.script'; |
| 28 | import FlattenThreadsReplyActionHandler from '../../../features/flattenThreads/core/replyActionHandler'; |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 29 | |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 30 | const scriptRunner = createScriptRunner(); |
| 31 | scriptRunner.run(); |
| 32 | |
| 33 | function createScriptRunner() { |
| 34 | const dependenciesProvider = DependenciesProviderSingleton.getInstance(); |
| 35 | const autoRefresh = dependenciesProvider.getDependency(AutoRefreshDependency); |
Adrià Vilanova Martínez | cb12c59 | 2024-11-09 20:46:03 +0100 | [diff] [blame] | 36 | const extraInfo = dependenciesProvider.getDependency(ExtraInfoDependency); |
Adrià Vilanova Martínez | 3913f4d | 2024-10-26 21:16:38 +0200 | [diff] [blame] | 37 | const optionsProvider = dependenciesProvider.getDependency( |
| 38 | OptionsProviderDependency, |
| 39 | ); |
| 40 | const startupDataStorage = dependenciesProvider.getDependency( |
| 41 | StartupDataStorageDependency, |
| 42 | ); |
Adrià Vilanova Martínez | 4e847f4 | 2024-11-09 23:03:32 +0100 | [diff] [blame] | 43 | const threadPageDesignWarning = dependenciesProvider.getDependency( |
| 44 | ThreadPageDesignWarningDependency, |
| 45 | ); |
Adrià Vilanova Martínez | ed1aba3 | 2024-10-26 21:23:12 +0200 | [diff] [blame] | 46 | const workflowsImport = dependenciesProvider.getDependency( |
| 47 | WorkflowsImportDependency, |
| 48 | ); |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 49 | |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 50 | return new ScriptRunner( |
| 51 | new SortedScriptsProviderAdapter( |
| 52 | [ |
| 53 | // Individual feature scripts |
| 54 | new AutoRefreshSetUpScript(autoRefresh), |
Adrià Vilanova Martínez | 6ecaa0d | 2024-10-26 17:04:32 +0200 | [diff] [blame] | 55 | new CCDarkThemeInjectAutoDarkTheme(), |
| 56 | new CCDarkThemeInjectForcedDarkTheme(), |
Adrià Vilanova Martínez | cb12c59 | 2024-11-09 20:46:03 +0100 | [diff] [blame] | 57 | new CCExtraInfoSetUpScript(extraInfo), |
Adrià Vilanova Martínez | 3c13a76 | 2024-11-09 23:03:32 +0100 | [diff] [blame^] | 58 | new FlattenThreadsSetUpReplyActionHandlerScript( |
| 59 | new FlattenThreadsReplyActionHandler(optionsProvider), |
Adrià Vilanova Martínez | 4e847f4 | 2024-11-09 23:03:32 +0100 | [diff] [blame] | 60 | ), |
Adrià Vilanova Martínez | 3c13a76 | 2024-11-09 23:03:32 +0100 | [diff] [blame^] | 61 | new InteropThreadPageSetupScript(), |
| 62 | new ThreadPageDesignWarningSetUpScript(threadPageDesignWarning), |
Adrià Vilanova Martínez | 3913f4d | 2024-10-26 21:16:38 +0200 | [diff] [blame] | 63 | new LoadDraftsSetupScript(optionsProvider, startupDataStorage), |
Adrià Vilanova Martínez | ed1aba3 | 2024-10-26 21:23:12 +0200 | [diff] [blame] | 64 | new WorkflowsImportSetUpScript(workflowsImport), |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 65 | |
Adrià Vilanova Martínez | 33a009c | 2024-11-09 22:41:56 +0100 | [diff] [blame] | 66 | // Standalone scripts |
| 67 | new ApplyStartupDataModificationsOnStartScript(startupDataStorage), |
| 68 | new MWI18nServerScript(), |
| 69 | new MWOptionsWatcherServerScript(), |
| 70 | new XHRInterceptorScript(), |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 71 | ], |
| 72 | new ScriptSorterAdapter(), |
| 73 | ).getScripts(), |
| 74 | ); |
| 75 | } |