blob: 80fbfbfb444d689dbd336246f208cd34f5760dcc [file] [log] [blame]
Adrià Vilanova Martínez66836fd2024-05-04 22:43:06 +02001import DependenciesProviderSingleton, {
2 ExtraInfoDependency,
3} from '../../../common/architecture/dependenciesProvider/DependenciesProvider';
4import {
5 ScriptEnvironment,
6 ScriptPage,
7 ScriptRunPhase,
8} from '../../../common/architecture/scripts/Script';
9import NodeWatcherScript from '../../../common/architecture/scripts/nodeWatcher/NodeWatcherScript';
10import ExtraInfo from '../core';
11import CCExtraInfoProfileAbuseChipsHandler from '../nodeWatcherHandlers/profile/ccExtraInfoProfileAbuseChips.handler';
12import CCExtraInfoProfilePerForumStatsHandler from '../nodeWatcherHandlers/profile/ccExtraInfoProfilePerForumStats.handler';
13import CCExtraInfoThreadCommentHandler from '../nodeWatcherHandlers/thread/ccExtraInfoThreadComment.handler';
14import CCExtraInfoThreadListHandler from '../nodeWatcherHandlers/threadList/ccExtraInfoThreadList.handler';
15import CCExtraInfoThreadListToolbeltHandler from '../nodeWatcherHandlers/threadList/ccExtraInfoThreadListToolbelt.handler';
16import CCExtraInfoThreadQuestionHandler from '../nodeWatcherHandlers/thread/ccExtraInfoThreadQuestion.handler';
17import CCExtraInfoThreadReplyHandler from '../nodeWatcherHandlers/thread/ccExtraInfoThreadReply.handler';
18
19export interface CCExtraInfoMainOptions {
20 extraInfo: ExtraInfo;
21}
22
23export 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}