moderator-toolbox-nxg-for-reddit / util/ui/redditElementsInit

util/ui/redditElementsInit

Functions

getSubredditColorSalt()

getSubredditColorSalt(): string

Defined in: extension/data/util/ui/redditElementsInit.tsx:55

Returns the current subreddit color salt used when computing per-subreddit border colors.

Returns

string


makeCommentThread()

makeCommentThread(jsonInput, commentOptions?): HTMLElement

Defined in: extension/data/util/ui/redditElementsInit.tsx:204

Renders a TBCommentChildren React component for a list of comment API objects and returns the host element.

Parameters

jsonInput

(RedditMoreChildren | RedditThing<CommentData>)[]

Array of Reddit API comment/more child objects.

commentOptions?

CommentOptions

Optional rendering options forwarded to the comment components.

Returns

HTMLElement


makeSingleComment()

makeSingleComment(comment, commentOptions?): HTMLElement

Defined in: extension/data/util/ui/redditElementsInit.tsx:189

Renders a single TBComment React component into a detached host element and returns it.

Parameters

comment

RedditThing<CommentData>

commentOptions?

CommentOptions = {}

Returns

HTMLElement


makeSubmissionEntry()

makeSubmissionEntry(submission, submissionOptions?): HTMLElement

Defined in: extension/data/util/ui/redditElementsInit.tsx:176

Renders a TBSubmission React component into a detached host element and returns it. The host element uses display: contents so it is visually transparent.

Parameters

submission

RedditThing<SubmissionData>

submissionOptions?

SubmissionOptions

Returns

HTMLElement


tbRedditEvent()

tbRedditEvent(elements): void

Defined in: extension/data/util/ui/redditElementsInit.tsx:134

Processes all .toolbox-thing elements inside elements, injecting toolbox slots and tagging toolbox containers so modules can attach their UI.

Parameters

elements

Element | ArrayLike<Element>

A single element or array-like collection to scan.

Returns

void

Variables

colorSaltReady

const colorSaltReady: Promise<void>

Defined in: extension/data/util/ui/redditElementsInit.tsx:46

Resolves once the subreddit color salt has been loaded from extension storage. Await before any make* call where correctness is required.