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[]


findInlineReplyComposerTargets()

findInlineReplyComposerTargets(root): InlineReplyComposerTarget[]

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

Finds inline comment-reply forms by locating “Comment as” label spans inside shreddit-comment elements. Top-level post composers are excluded; use findTopLevelComposerHosts for those.

Parameters

root

Element

Returns

InlineReplyComposerTarget[]


findTopLevelComposerHosts()

findTopLevelComposerHosts(root): TopLevelComposerHost[]

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

Finds comment-composer-host elements carrying a post-id - the top-level reply form for a post, typically added during SPA navigation.

Parameters

root

Element

Returns

TopLevelComposerHost[]

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


InlineReplyComposerTarget

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

An inline comment-reply form discovered inside a shreddit-comment.

Properties

container

container: Element

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

The <div> containing the “Comment as” label, used as the injection anchor.

thingId

thingId: string

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

Fullname of the comment being replied to (e.g. t1_abc123).


TopLevelComposerHost

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

A top-level post reply composer host element.

Properties

composerEl

composerEl: Element

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

The comment-composer-host element.

postId

postId: string

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

Post fullname (e.g. t3_abc123).