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 | 3b585fd | 2024-11-10 19:17:31 +0100 | [diff] [blame] | 51 | import FixedToolbarStylesScript from '../../../features/fixedToolbar/presentation/scripts/styles.script'; |
| 52 | import EnhancedAnnouncementsDotStylesScript from '../../../features/enhancedAnnouncementsDot/presentation/scripts/styles.script'; |
| 53 | import ImageMaxHeightStylesScript from '../../../features/imageMaxHeight/presentation/scripts/styles.script'; |
| 54 | import RepositionExpandThreadStylesScript from '../../../features/repositionExpandThread/presentation/scripts/styles.script'; |
| 55 | import StickySidebarHeadersStylesScript from '../../../features/stickySidebarHeaders/presentation/scripts/styles.script'; |
| 56 | import IncreaseContrastStylesScript from '../../../features/increaseContrast/presentation/scripts/styles.script'; |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 57 | |
| 58 | const scriptRunner = createScriptRunner(); |
| 59 | scriptRunner.run(); |
| 60 | |
| 61 | function createScriptRunner() { |
| 62 | const dependenciesProvider = DependenciesProviderSingleton.getInstance(); |
| 63 | const autoRefresh = dependenciesProvider.getDependency(AutoRefreshDependency); |
Adrià Vilanova Martínez | cb12c59 | 2024-11-09 20:46:03 +0100 | [diff] [blame] | 64 | const extraInfo = dependenciesProvider.getDependency(ExtraInfoDependency); |
Adrià Vilanova Martínez | 6ecaa0d | 2024-10-26 17:04:32 +0200 | [diff] [blame] | 65 | const optionsProvider = dependenciesProvider.getDependency( |
| 66 | OptionsProviderDependency, |
| 67 | ); |
Adrià Vilanova Martínez | 33a009c | 2024-11-09 22:41:56 +0100 | [diff] [blame] | 68 | const startupDataStorage = dependenciesProvider.getDependency( |
| 69 | StartupDataStorageDependency, |
| 70 | ); |
Adrià Vilanova Martínez | 4e847f4 | 2024-11-09 23:03:32 +0100 | [diff] [blame] | 71 | const threadPageDesignWarning = dependenciesProvider.getDependency( |
| 72 | ThreadPageDesignWarningDependency, |
| 73 | ); |
Adrià Vilanova Martínez | ed1aba3 | 2024-10-26 21:23:12 +0200 | [diff] [blame] | 74 | const workflowsImport = dependenciesProvider.getDependency( |
| 75 | WorkflowsImportDependency, |
| 76 | ); |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 77 | |
Adrià Vilanova Martínez | 7c941c7 | 2024-10-26 20:23:34 +0200 | [diff] [blame] | 78 | const ccInfiniteScroll = new CCInfiniteScroll(); |
Adrià Vilanova Martínez | 3c13a76 | 2024-11-09 23:03:32 +0100 | [diff] [blame] | 79 | const flattenThreads = new FlattenThreads(); |
Adrià Vilanova Martínez | 7c941c7 | 2024-10-26 20:23:34 +0200 | [diff] [blame] | 80 | |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 81 | return new ScriptRunner( |
| 82 | new SortedScriptsProviderAdapter( |
| 83 | [ |
| 84 | // Node watcher script with handlers |
| 85 | new NodeWatcherScriptAdapter( |
| 86 | new NodeWatcherAdapter(), |
| 87 | new Map<string, NodeWatcherHandler>([ |
| 88 | [ |
| 89 | 'autoRefreshThreadListSetUp', |
| 90 | new AutoRefreshThreadListSetUpHandler(autoRefresh), |
| 91 | ], |
| 92 | [ |
| 93 | 'autoRefreshThreadListHide', |
| 94 | new AutoRefreshThreadListHideHandler(autoRefresh), |
| 95 | ], |
Adrià Vilanova Martínez | 6ecaa0d | 2024-10-26 17:04:32 +0200 | [diff] [blame] | 96 | ['ccDarkThemeEcApp', new CCDarkThemeEcAppHandler(optionsProvider)], |
| 97 | [ |
| 98 | 'ccDarkThemeReportDialog', |
| 99 | new CCDarkThemeReportDialogHandler( |
| 100 | optionsProvider, |
| 101 | new ReportDialogColorThemeFix(), |
| 102 | ), |
| 103 | ], |
| 104 | [ |
| 105 | 'ccDarkThemeUnifiedProfilesIframe', |
| 106 | new CCDarkThemeUnifiedProfilesIframeHandler(optionsProvider), |
| 107 | ], |
Adrià Vilanova Martínez | 7c941c7 | 2024-10-26 20:23:34 +0200 | [diff] [blame] | 108 | [ |
Adrià Vilanova Martínez | cb12c59 | 2024-11-09 20:46:03 +0100 | [diff] [blame] | 109 | 'ccExtraInfoProfile', |
| 110 | new CCExtraInfoProfileAbuseChipsHandler(extraInfo), |
| 111 | ], |
| 112 | [ |
| 113 | 'ccExtraInfoProfilePerForumStats', |
| 114 | new CCExtraInfoProfilePerForumStatsHandler(extraInfo), |
| 115 | ], |
| 116 | [ |
| 117 | 'ccExtraInfoThreadComment', |
| 118 | new CCExtraInfoThreadCommentHandler(extraInfo), |
| 119 | ], |
| 120 | [ |
| 121 | 'ccExtraInfoThreadList', |
| 122 | new CCExtraInfoThreadListHandler(extraInfo), |
| 123 | ], |
| 124 | [ |
| 125 | 'ccExtraInfoThreadListToolbelt', |
| 126 | new CCExtraInfoThreadListToolbeltHandler(extraInfo), |
| 127 | ], |
| 128 | [ |
| 129 | 'ccExtraInfoThreadQuestion', |
| 130 | new CCExtraInfoThreadQuestionHandler(extraInfo), |
| 131 | ], |
| 132 | [ |
| 133 | 'ccExtraInfoThreadReply', |
| 134 | new CCExtraInfoThreadReplyHandler(extraInfo), |
| 135 | ], |
| 136 | [ |
Adrià Vilanova Martínez | 7c941c7 | 2024-10-26 20:23:34 +0200 | [diff] [blame] | 137 | 'ccInfiniteScrollSetUp', |
| 138 | new CCInfiniteScrollSetUpHandler(ccInfiniteScroll), |
| 139 | ], |
| 140 | [ |
| 141 | 'ccInfiniteScrollLoadMoreBar', |
| 142 | new CCInfiniteScrollLoadMoreBarHandler(ccInfiniteScroll), |
| 143 | ], |
| 144 | [ |
| 145 | 'ccInfiniteScrollLoadMoreBtn', |
| 146 | new CCInfiniteScrollLoadMoreBtnHandler(ccInfiniteScroll), |
| 147 | ], |
Adrià Vilanova Martínez | ed1aba3 | 2024-10-26 21:23:12 +0200 | [diff] [blame] | 148 | [ |
Adrià Vilanova Martínez | 3c13a76 | 2024-11-09 23:03:32 +0100 | [diff] [blame] | 149 | 'flattenThreadsAdditionalInfo', |
| 150 | new FlattenThreadsAdditionalInfoHandler(flattenThreads), |
| 151 | ], |
| 152 | [ |
| 153 | 'flattenThreadsQuote', |
| 154 | new FlattenThreadsQuoteHandler(flattenThreads), |
| 155 | ], |
| 156 | [ |
| 157 | 'flattenThreadsReaddReplyBtn', |
| 158 | new FlattenThreadsReaddReplyBtnHandler(flattenThreads), |
| 159 | ], |
| 160 | [ |
| 161 | 'flattenThreadsReplyBtn', |
| 162 | new FlattenThreadsReplyBtnHandler(flattenThreads), |
| 163 | ], |
| 164 | [ |
Adrià Vilanova Martínez | 4e847f4 | 2024-11-09 23:03:32 +0100 | [diff] [blame] | 165 | 'threadPageDesignWarningInject', |
| 166 | new ThreadPageDesignWarningInjectHandler(threadPageDesignWarning), |
| 167 | ], |
| 168 | [ |
Adrià Vilanova Martínez | ed1aba3 | 2024-10-26 21:23:12 +0200 | [diff] [blame] | 169 | 'workflowsImportCRTags', |
| 170 | new WorkflowsImportCRTagsHandler(workflowsImport), |
| 171 | ], |
| 172 | [ |
| 173 | 'workflowsThreadListActionBar', |
| 174 | new WorkflowsThreadListActionBarHandler(new Workflows()), |
| 175 | ], |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 176 | ]), |
| 177 | ), |
| 178 | |
| 179 | // Individual feature scripts |
| 180 | new AutoRefreshStylesScript(), |
Adrià Vilanova Martínez | cb12c59 | 2024-11-09 20:46:03 +0100 | [diff] [blame] | 181 | new CCExtraInfoInjectScript(), |
| 182 | new CCExtraInfoStylesScript(), |
Adrià Vilanova Martínez | 3b585fd | 2024-11-10 19:17:31 +0100 | [diff] [blame] | 183 | new EnhancedAnnouncementsDotStylesScript(), |
| 184 | new FixedToolbarStylesScript(), |
Adrià Vilanova Martínez | 3c13a76 | 2024-11-09 23:03:32 +0100 | [diff] [blame] | 185 | new FlattenThreadsStylesScript(), |
Adrià Vilanova Martínez | 3b585fd | 2024-11-10 19:17:31 +0100 | [diff] [blame] | 186 | new ImageMaxHeightStylesScript(), |
| 187 | new IncreaseContrastStylesScript(), |
| 188 | new RepositionExpandThreadStylesScript(), |
| 189 | new StickySidebarHeadersStylesScript(), |
Adrià Vilanova Martínez | ed1aba3 | 2024-10-26 21:23:12 +0200 | [diff] [blame] | 190 | new WorkflowsImportStylesheetScript(), |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 191 | |
Adrià Vilanova Martínez | 33a009c | 2024-11-09 22:41:56 +0100 | [diff] [blame] | 192 | // Standalone scripts |
| 193 | new ApplyStartupDataModificationsOnMainScript(startupDataStorage), |
| 194 | new InjectLitComponentsScript(), |
Adrià Vilanova Martínez | f92172f | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 195 | ], |
| 196 | new ScriptSorterAdapter(), |
| 197 | ).getScripts(), |
| 198 | ); |
| 199 | } |