Adrià Vilanova MartÃnez | 66836fd | 2024-05-04 22:43:06 +0200 | [diff] [blame] | 1 | import DependenciesProviderSingleton, { |
| 2 | ExtraInfoDependency, |
| 3 | } from '../../../common/architecture/dependenciesProvider/DependenciesProvider'; |
| 4 | import { |
| 5 | ScriptEnvironment, |
| 6 | ScriptPage, |
| 7 | ScriptRunPhase, |
| 8 | } from '../../../common/architecture/scripts/Script'; |
| 9 | import NodeWatcherScript from '../../../common/architecture/scripts/nodeWatcher/NodeWatcherScript'; |
| 10 | import ExtraInfo from '../core'; |
| 11 | import CCExtraInfoProfileAbuseChipsHandler from '../nodeWatcherHandlers/profile/ccExtraInfoProfileAbuseChips.handler'; |
| 12 | import CCExtraInfoProfilePerForumStatsHandler from '../nodeWatcherHandlers/profile/ccExtraInfoProfilePerForumStats.handler'; |
| 13 | import CCExtraInfoThreadCommentHandler from '../nodeWatcherHandlers/thread/ccExtraInfoThreadComment.handler'; |
| 14 | import CCExtraInfoThreadListHandler from '../nodeWatcherHandlers/threadList/ccExtraInfoThreadList.handler'; |
| 15 | import CCExtraInfoThreadListToolbeltHandler from '../nodeWatcherHandlers/threadList/ccExtraInfoThreadListToolbelt.handler'; |
| 16 | import CCExtraInfoThreadQuestionHandler from '../nodeWatcherHandlers/thread/ccExtraInfoThreadQuestion.handler'; |
| 17 | import CCExtraInfoThreadReplyHandler from '../nodeWatcherHandlers/thread/ccExtraInfoThreadReply.handler'; |
| 18 | |
| 19 | export interface CCExtraInfoMainOptions { |
| 20 | extraInfo: ExtraInfo; |
| 21 | } |
| 22 | |
| 23 | export default class CCExtraInfoMainScript extends NodeWatcherScript<CCExtraInfoMainOptions> { |
| 24 | page = ScriptPage.CommunityConsole; |
| 25 | environment = ScriptEnvironment.ContentScript; |
| 26 | runPhase = ScriptRunPhase.Main; |
| 27 | handlers = new Map([ |
| 28 | ['ccExtraInfoProfile', CCExtraInfoProfileAbuseChipsHandler], |
| 29 | ['ccExtraInfoProfilePerForumStats', CCExtraInfoProfilePerForumStatsHandler], |
| 30 | ['ccExtraInfoThreadComment', CCExtraInfoThreadCommentHandler], |
| 31 | ['ccExtraInfoThreadList', CCExtraInfoThreadListHandler], |
| 32 | ['ccExtraInfoThreadListToolbelt', CCExtraInfoThreadListToolbeltHandler], |
| 33 | ['ccExtraInfoThreadQuestion', CCExtraInfoThreadQuestionHandler], |
| 34 | ['ccExtraInfoThreadReply', CCExtraInfoThreadReplyHandler], |
| 35 | ]); |
| 36 | |
| 37 | protected optionsFactory(): CCExtraInfoMainOptions { |
| 38 | const dependenciesProvider = DependenciesProviderSingleton.getInstance(); |
| 39 | return { |
| 40 | extraInfo: dependenciesProvider.getDependency(ExtraInfoDependency), |
| 41 | }; |
| 42 | } |
| 43 | } |