| import OptionsWatcher from '../../../common/optionsWatcher.js'; |
| |
| import ProfileInfoHandler from './handlers/profile.js'; |
| import ThreadInfoHandler from './handlers/thread.js'; |
| import ThreadListInfoHandler from './handlers/threadList.js'; |
| import ExpandedThreadListExtraInfoInjection from './injections/expandedThreadList.js'; |
| import ProfileAbuseExtraInfoInjection from './injections/profileAbuse.js'; |
| import ProfilePerForumStatsExtraInfoInjection from './injections/profilePerForumStats.js'; |
| import ThreadCommentExtraInfoInjection from './injections/threadComment.js'; |
| import ThreadListExtraInfoInjection from './injections/threadList.js'; |
| import ThreadQuestionExtraInfoInjection from './injections/threadQuestion.js'; |
| import ThreadReplyExtraInfoInjection from './injections/threadReply.js'; |
| |
| export default class ExtraInfo { |
| constructor() { |
| const optionsWatcher = new OptionsWatcher(['extrainfo', 'perforumstats']); |
| |
| const profileInfoHandler = new ProfileInfoHandler(); |
| const threadInfoHandler = new ThreadInfoHandler(); |
| const threadListInfoHandler = new ThreadListInfoHandler(); |
| |
| this.profileAbuse = |
| new ProfileAbuseExtraInfoInjection(profileInfoHandler, optionsWatcher); |
| this.profilePerForumStats = new ProfilePerForumStatsExtraInfoInjection( |
| profileInfoHandler, optionsWatcher); |
| this.threadQuestion = |
| new ThreadQuestionExtraInfoInjection(threadInfoHandler, optionsWatcher); |
| this.threadReply = |
| new ThreadReplyExtraInfoInjection(threadInfoHandler, optionsWatcher); |
| this.threadComment = |
| new ThreadCommentExtraInfoInjection(threadInfoHandler, optionsWatcher); |
| this.expandedThreadList = new ExpandedThreadListExtraInfoInjection( |
| threadListInfoHandler, optionsWatcher); |
| this.threadList = |
| new ThreadListExtraInfoInjection(threadListInfoHandler, optionsWatcher); |
| } |
| |
| injectAbuseChipsAtProfileIfEnabled(card) { |
| this.profileAbuse.injectIfEnabled({card}); |
| } |
| |
| injectAtThreadListIfEnabled(li) { |
| const injectionDetails = this.threadList.getInjectionDetails(li); |
| this.threadList.injectIfEnabled(injectionDetails); |
| } |
| |
| injectAtExpandedThreadListIfEnabled(toolbelt) { |
| const injectionDetails = |
| this.expandedThreadList.getInjectionDetails(toolbelt); |
| this.expandedThreadList.injectIfEnabled(injectionDetails); |
| } |
| |
| injectPerForumStatsIfEnabled(chart) { |
| this.profilePerForumStats.injectIfEnabled({chart}); |
| } |
| |
| injectAtQuestionIfEnabled(stateChips) { |
| this.threadQuestion.injectIfEnabled({stateChips, isMessageNode: false}); |
| } |
| |
| injectAtReplyIfEnabled(messageNode) { |
| this.threadReply.injectIfEnabled({messageNode, isMessageNode: true}); |
| } |
| |
| injectAtCommentIfEnabled(messageNode) { |
| this.threadComment.injectIfEnabled({messageNode, isMessageNode: true}); |
| } |
| } |