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

dom/shreddit/comments

Functions

findCommentMetaTargets()

findCommentMetaTargets(root): CommentMetaTarget[]

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

Finds div[slot="commentMeta"] elements that need a thingTaglineStatus slot injected. Each result’s badges field is the <shreddit-comment-badges> element to insert after. Skips elements that already have a toolbox-tagline-status-slot sibling.

Parameters

root

Element

Returns

CommentMetaTarget[]


findUsernameTargets()

findUsernameTargets(root): UsernameTarget[]

Defined in: extension/data/dom/shreddit/comments.ts:25

Find u/ username spans that need a toolbox author anchor. Skips spans inside mod-notes-opener elements, hover card slots, and already-processed spans. Only returns spans inside a shreddit-comment or shreddit-post.

shreddit-comment carries thingid and postid (no dashes) and has no subreddit-prefixed-name attribute - subreddit is extracted from permalink.

Parameters

root

Element

Returns

UsernameTarget[]


getCommentEntryByCommentId()

getCommentEntryByCommentId(root, commentId): Element | null

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

Finds the comment entry element with the given comment ID within a rendered comment thread.

Parameters

root

Element

commentId

string

Returns

Element | null

Interfaces

CommentMetaTarget

Defined in: extension/data/dom/shreddit/comments.ts:60

Data extracted from a div[slot="commentMeta"] that needs a thingTaglineStatus slot.

Properties

badges

badges: Element

Defined in: extension/data/dom/shreddit/comments.ts:62

The <shreddit-comment-badges> element to insert after.

postId

postId: string

Defined in: extension/data/dom/shreddit/comments.ts:66

Post fullname (e.g. t3_abc123).

subreddit

subreddit: string

Defined in: extension/data/dom/shreddit/comments.ts:67

thingId

thingId: string

Defined in: extension/data/dom/shreddit/comments.ts:64

Comment fullname (e.g. t1_abc123).


UsernameTarget

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

Data extracted from a u/ username span inside a shreddit comment or post.

Properties

author

author: string

Defined in: extension/data/dom/shreddit/comments.ts:9

commentId

commentId: string | undefined

Defined in: extension/data/dom/shreddit/comments.ts:14

Fullname of the comment, or undefined when extracted from a post element.

postId

postId: string

Defined in: extension/data/dom/shreddit/comments.ts:12

Fullname of the parent post (e.g. t3_abc123).

span

span: Element

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

The <span dir="auto"> element containing the username text.

subreddit

subreddit: string

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