Adrià Vilanova Martínez | 7c941c7 | 2024-10-26 20:23:34 +0200 | [diff] [blame] | 1 | // Run legacy Javascript entry point |
| 2 | import '../../../contentScripts/communityConsole/main'; |
| 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 | 6ecaa0d | 2024-10-26 17:04:32 +0200 | [diff] [blame] | 7 | OptionsProviderDependency, |
Adrià Vilanova Martínez | 33a009c | 2024-11-09 22:41:56 +0100 | [diff] [blame] | 8 | StartupDataStorageDependency, |
Adrià Vilanova Martínez | ed1aba3 | 2024-10-26 21:23:12 +0200 | [diff] [blame] | 9 | WorkflowsImportDependency, |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 10 | } from '../../../common/architecture/dependenciesProvider/DependenciesProvider'; |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 11 | import AutoRefreshThreadListHideHandler from '../../../features/autoRefresh/presentation/nodeWatcherHandlers/threadListHide.handler'; |
| 12 | import AutoRefreshThreadListSetUpHandler from '../../../features/autoRefresh/presentation/nodeWatcherHandlers/threadListSetUp.handler'; |
| 13 | import AutoRefreshStylesScript from '../../../features/autoRefresh/presentation/scripts/styles.script'; |
Adrià Vilanova Martínez | 7c941c7 | 2024-10-26 20:23:34 +0200 | [diff] [blame] | 14 | import ReportDialogColorThemeFix from '../../../features/ccDarkTheme/core/logic/reportDialog'; |
Adrià Vilanova Martínez | fe69478 | 2024-11-09 20:40:43 +0100 | [diff] [blame] | 15 | import CCDarkThemeEcAppHandler from '../../../features/ccDarkTheme/presentation/nodeWatcherHandlers/ecApp.handler'; |
| 16 | import CCDarkThemeReportDialogHandler from '../../../features/ccDarkTheme/presentation/nodeWatcherHandlers/reportDialog.handler'; |
| 17 | import CCDarkThemeUnifiedProfilesIframeHandler from '../../../features/ccDarkTheme/presentation/nodeWatcherHandlers/unifiedProfilesIframe.handler'; |
Adrià Vilanova Martínez | 7c941c7 | 2024-10-26 20:23:34 +0200 | [diff] [blame] | 18 | import CCInfiniteScroll from '../../../features/infiniteScroll/core/ccInfiniteScroll'; |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 19 | import { NodeWatcherAdapter } from '../../../infrastructure/presentation/nodeWatcher/NodeWatcher.adapter'; |
| 20 | import NodeWatcherScriptAdapter from '../../../infrastructure/presentation/scripts/NodeWatcherScript.adapter'; |
| 21 | import ScriptRunner from '../../../infrastructure/presentation/scripts/ScriptRunner'; |
| 22 | import ScriptSorterAdapter from '../../../infrastructure/presentation/scripts/ScriptSorter.adapter'; |
| 23 | import { SortedScriptsProviderAdapter } from '../../../infrastructure/presentation/scripts/SortedScriptsProvider.adapter'; |
| 24 | import { NodeWatcherHandler } from '../../../presentation/nodeWatcher/NodeWatcherHandler'; |
Adrià Vilanova Martínez | fe69478 | 2024-11-09 20:40:43 +0100 | [diff] [blame] | 25 | import CCInfiniteScrollSetUpHandler from '../../../features/infiniteScroll/presentation/nodeWatcherHandlers/ccInfiniteScrollSetUp.handler'; |
| 26 | import CCInfiniteScrollLoadMoreBarHandler from '../../../features/infiniteScroll/presentation/nodeWatcherHandlers/ccInfiniteScrollLoadMoreBar.handler'; |
| 27 | import CCInfiniteScrollLoadMoreBtnHandler from '../../../features/infiniteScroll/presentation/nodeWatcherHandlers/ccInfiniteScrollLoadMoreBtn.handler'; |
Adrià Vilanova Martínez | ed1aba3 | 2024-10-26 21:23:12 +0200 | [diff] [blame] | 28 | import WorkflowsThreadListActionBarHandler from '../../../features/workflows/presentation/nodeWatcherHandlers/threadListActionBar.handler'; |
| 29 | import WorkflowsImportCRTagsHandler from '../../../features/workflows/presentation/nodeWatcherHandlers/crTags.handler'; |
| 30 | import Workflows from '../../../features/workflows/core/communityConsole/workflows'; |
| 31 | import WorkflowsImportStylesheetScript from '../../../features/workflows/presentation/scripts/importStylesheet'; |
Adrià Vilanova Martínez | cb12c59 | 2024-11-09 20:46:03 +0100 | [diff] [blame] | 32 | import CCExtraInfoProfileAbuseChipsHandler from '../../../features/extraInfo/presentation/nodeWatcherHandlers/profile/ccExtraInfoProfileAbuseChips.handler'; |
| 33 | import CCExtraInfoProfilePerForumStatsHandler from '../../../features/extraInfo/presentation/nodeWatcherHandlers/profile/ccExtraInfoProfilePerForumStats.handler'; |
| 34 | import CCExtraInfoThreadCommentHandler from '../../../features/extraInfo/presentation/nodeWatcherHandlers/thread/ccExtraInfoThreadComment.handler'; |
| 35 | import CCExtraInfoThreadListHandler from '../../../features/extraInfo/presentation/nodeWatcherHandlers/threadList/ccExtraInfoThreadList.handler'; |
| 36 | import CCExtraInfoThreadListToolbeltHandler from '../../../features/extraInfo/presentation/nodeWatcherHandlers/threadList/ccExtraInfoThreadListToolbelt.handler'; |
| 37 | import CCExtraInfoThreadQuestionHandler from '../../../features/extraInfo/presentation/nodeWatcherHandlers/thread/ccExtraInfoThreadQuestion.handler'; |
| 38 | import CCExtraInfoThreadReplyHandler from '../../../features/extraInfo/presentation/nodeWatcherHandlers/thread/ccExtraInfoThreadReply.handler'; |
| 39 | import CCExtraInfoInjectScript from '../../../features/extraInfo/presentation/scripts/ccExtraInfoInject.script'; |
| 40 | import CCExtraInfoStylesScript from '../../../features/extraInfo/presentation/scripts/ccExtraInfoStyles.script'; |
Adrià Vilanova Martínez | 33a009c | 2024-11-09 22:41:56 +0100 | [diff] [blame] | 41 | import InjectLitComponentsScript from '../../../presentation/standaloneScripts/litComponents/injectLitComponents.script'; |
| 42 | import ApplyStartupDataModificationsOnMainScript from '../../../presentation/standaloneScripts/startupDataStorage/applyStartupDataModificationsOnMain.script'; |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 43 | |
| 44 | const scriptRunner = createScriptRunner(); |
| 45 | scriptRunner.run(); |
| 46 | |
| 47 | function createScriptRunner() { |
| 48 | const dependenciesProvider = DependenciesProviderSingleton.getInstance(); |
| 49 | const autoRefresh = dependenciesProvider.getDependency(AutoRefreshDependency); |
Adrià Vilanova Martínez | cb12c59 | 2024-11-09 20:46:03 +0100 | [diff] [blame] | 50 | const extraInfo = dependenciesProvider.getDependency(ExtraInfoDependency); |
Adrià Vilanova Martínez | 6ecaa0d | 2024-10-26 17:04:32 +0200 | [diff] [blame] | 51 | const optionsProvider = dependenciesProvider.getDependency( |
| 52 | OptionsProviderDependency, |
| 53 | ); |
Adrià Vilanova Martínez | 33a009c | 2024-11-09 22:41:56 +0100 | [diff] [blame] | 54 | const startupDataStorage = dependenciesProvider.getDependency( |
| 55 | StartupDataStorageDependency, |
| 56 | ); |
Adrià Vilanova Martínez | ed1aba3 | 2024-10-26 21:23:12 +0200 | [diff] [blame] | 57 | const workflowsImport = dependenciesProvider.getDependency( |
| 58 | WorkflowsImportDependency, |
| 59 | ); |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 60 | |
Adrià Vilanova Martínez | 7c941c7 | 2024-10-26 20:23:34 +0200 | [diff] [blame] | 61 | const ccInfiniteScroll = new CCInfiniteScroll(); |
| 62 | |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 63 | return new ScriptRunner( |
| 64 | new SortedScriptsProviderAdapter( |
| 65 | [ |
| 66 | // Node watcher script with handlers |
| 67 | new NodeWatcherScriptAdapter( |
| 68 | new NodeWatcherAdapter(), |
| 69 | new Map<string, NodeWatcherHandler>([ |
| 70 | [ |
| 71 | 'autoRefreshThreadListSetUp', |
| 72 | new AutoRefreshThreadListSetUpHandler(autoRefresh), |
| 73 | ], |
| 74 | [ |
| 75 | 'autoRefreshThreadListHide', |
| 76 | new AutoRefreshThreadListHideHandler(autoRefresh), |
| 77 | ], |
Adrià Vilanova Martínez | 6ecaa0d | 2024-10-26 17:04:32 +0200 | [diff] [blame] | 78 | ['ccDarkThemeEcApp', new CCDarkThemeEcAppHandler(optionsProvider)], |
| 79 | [ |
| 80 | 'ccDarkThemeReportDialog', |
| 81 | new CCDarkThemeReportDialogHandler( |
| 82 | optionsProvider, |
| 83 | new ReportDialogColorThemeFix(), |
| 84 | ), |
| 85 | ], |
| 86 | [ |
| 87 | 'ccDarkThemeUnifiedProfilesIframe', |
| 88 | new CCDarkThemeUnifiedProfilesIframeHandler(optionsProvider), |
| 89 | ], |
Adrià Vilanova Martínez | 7c941c7 | 2024-10-26 20:23:34 +0200 | [diff] [blame] | 90 | [ |
Adrià Vilanova Martínez | cb12c59 | 2024-11-09 20:46:03 +0100 | [diff] [blame] | 91 | 'ccExtraInfoProfile', |
| 92 | new CCExtraInfoProfileAbuseChipsHandler(extraInfo), |
| 93 | ], |
| 94 | [ |
| 95 | 'ccExtraInfoProfilePerForumStats', |
| 96 | new CCExtraInfoProfilePerForumStatsHandler(extraInfo), |
| 97 | ], |
| 98 | [ |
| 99 | 'ccExtraInfoThreadComment', |
| 100 | new CCExtraInfoThreadCommentHandler(extraInfo), |
| 101 | ], |
| 102 | [ |
| 103 | 'ccExtraInfoThreadList', |
| 104 | new CCExtraInfoThreadListHandler(extraInfo), |
| 105 | ], |
| 106 | [ |
| 107 | 'ccExtraInfoThreadListToolbelt', |
| 108 | new CCExtraInfoThreadListToolbeltHandler(extraInfo), |
| 109 | ], |
| 110 | [ |
| 111 | 'ccExtraInfoThreadQuestion', |
| 112 | new CCExtraInfoThreadQuestionHandler(extraInfo), |
| 113 | ], |
| 114 | [ |
| 115 | 'ccExtraInfoThreadReply', |
| 116 | new CCExtraInfoThreadReplyHandler(extraInfo), |
| 117 | ], |
| 118 | [ |
Adrià Vilanova Martínez | 7c941c7 | 2024-10-26 20:23:34 +0200 | [diff] [blame] | 119 | 'ccInfiniteScrollSetUp', |
| 120 | new CCInfiniteScrollSetUpHandler(ccInfiniteScroll), |
| 121 | ], |
| 122 | [ |
| 123 | 'ccInfiniteScrollLoadMoreBar', |
| 124 | new CCInfiniteScrollLoadMoreBarHandler(ccInfiniteScroll), |
| 125 | ], |
| 126 | [ |
| 127 | 'ccInfiniteScrollLoadMoreBtn', |
| 128 | new CCInfiniteScrollLoadMoreBtnHandler(ccInfiniteScroll), |
| 129 | ], |
Adrià Vilanova Martínez | ed1aba3 | 2024-10-26 21:23:12 +0200 | [diff] [blame] | 130 | [ |
| 131 | 'workflowsImportCRTags', |
| 132 | new WorkflowsImportCRTagsHandler(workflowsImport), |
| 133 | ], |
| 134 | [ |
| 135 | 'workflowsThreadListActionBar', |
| 136 | new WorkflowsThreadListActionBarHandler(new Workflows()), |
| 137 | ], |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 138 | ]), |
| 139 | ), |
| 140 | |
| 141 | // Individual feature scripts |
| 142 | new AutoRefreshStylesScript(), |
Adrià Vilanova Martínez | cb12c59 | 2024-11-09 20:46:03 +0100 | [diff] [blame] | 143 | new CCExtraInfoInjectScript(), |
| 144 | new CCExtraInfoStylesScript(), |
Adrià Vilanova Martínez | ed1aba3 | 2024-10-26 21:23:12 +0200 | [diff] [blame] | 145 | new WorkflowsImportStylesheetScript(), |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 146 | |
Adrià Vilanova Martínez | 33a009c | 2024-11-09 22:41:56 +0100 | [diff] [blame] | 147 | // Standalone scripts |
| 148 | new ApplyStartupDataModificationsOnMainScript(startupDataStorage), |
| 149 | new InjectLitComponentsScript(), |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 150 | ], |
| 151 | new ScriptSorterAdapter(), |
| 152 | ).getScripts(), |
| 153 | ); |
| 154 | } |