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