moderator-toolbox-nxg-for-reddit / dom/shreddit/commentThread

dom/shreddit/commentThread

Functions

findCommentSortTargets()

findCommentSortTargets(root): CommentSortTarget[]

Defined in: extension/data/dom/shreddit/commentThread.ts:28

Finds div[slot="comment-sort"] elements that need a commentThreadControls slot injected. Context (postId, subreddit) is extracted from the nearest shreddit-comment-tree ancestor. Skips elements that already have a toolbox-thread-controls-slot child.

Parameters

root

Element

Returns

CommentSortTarget[]


findComposerTargets()

findComposerTargets(root): ComposerTarget[]

Defined in: extension/data/dom/shreddit/commentThread.ts:55

Finds shreddit-composer elements that need a commentComposerControls slot injected. The cancel-button slot sibling is used as the injection point so toolbox controls appear in the composer’s footer button row. Subreddit is extracted from the page URL since shreddit-composer carries no subreddit attribute directly. Skips elements that already have a toolbox-composer-controls-slot sibling of the cancel button.

Parameters

root

Element

Returns

ComposerTarget[]

Interfaces

CommentSortTarget

Defined in: extension/data/dom/shreddit/commentThread.ts:6

Data extracted from a shreddit-comments-sort-dropdown that needs a commentThreadControls slot.

Properties

postId

postId: string

Defined in: extension/data/dom/shreddit/commentThread.ts:10

Post fullname (e.g. t3_abc123).

sortDiv

sortDiv: Element

Defined in: extension/data/dom/shreddit/commentThread.ts:8

The <div slot="comment-sort"> element to append the slot into.

subreddit

subreddit: string

Defined in: extension/data/dom/shreddit/commentThread.ts:11


ComposerTarget

Defined in: extension/data/dom/shreddit/commentThread.ts:15

Data extracted from a shreddit-composer that needs a commentComposerControls slot.

Properties

composer

composer: Element

Defined in: extension/data/dom/shreddit/commentThread.ts:17

The <shreddit-composer> element - the cancel-button slot sibling is inserted here.

postId

postId: string

Defined in: extension/data/dom/shreddit/commentThread.ts:19

Post fullname (e.g. t3_abc123).

subreddit

subreddit: string

Defined in: extension/data/dom/shreddit/commentThread.ts:20