moderator-toolbox-nxg-for-reddit / modules/commenttriage/platformInterface

modules/commenttriage/platformInterface

Functions

createOldRedditAdapter()

createOldRedditAdapter(): CommentTriageAdapter

Defined in: extension/data/modules/commenttriage/platformInterface.ts:86

Returns the old-Reddit binding for CommentTriageAdapter.

Returns

CommentTriageAdapter

Interfaces

CommentTriageAdapter

Defined in: extension/data/modules/commenttriage/platformInterface.ts:19

Methods

collapse()

collapse(el): void

Defined in: extension/data/modules/commenttriage/platformInterface.ts:66

Collapses a comment element.

Parameters
el

Element

Returns

void

findNewComments()

findNewComments(): Element[]

Defined in: extension/data/modules/commenttriage/platformInterface.ts:24

Returns all comment elements not yet processed by the triage run.

Returns

Element[]

getAuthorHref()

getAuthorHref(el): string | null

Defined in: extension/data/modules/commenttriage/platformInterface.ts:44

Returns the href of the author link for a comment, used to identify the current user’s own comments.

Parameters
el

Element

Returns

string | null

The author profile URL, or null if not present.

getChildContainer()

getChildContainer(el): Element | null

Defined in: extension/data/modules/commenttriage/platformInterface.ts:57

Returns the child sitetable/container element of a comment, used when recursively sorting children.

Parameters
el

Element

Returns

Element | null

The child container, or null if the comment has no children.

getDirectChildren()

getDirectChildren(container): HTMLElement[]

Defined in: extension/data/modules/commenttriage/platformInterface.ts:52

Returns the direct child comment elements within a container, excluding “load more” stubs.

Parameters
container

Element

Returns

HTMLElement[]

getMoreChildrenContainer()

getMoreChildrenContainer(clickTarget): Element | null

Defined in: extension/data/modules/commenttriage/platformInterface.ts:82

Returns the sitetable container to re-sort after a “load more comments” click.

Parameters
clickTarget

Element

The element that was clicked.

Returns

Element | null

The container to re-sort, or null if not applicable.

getParentComment()

getParentComment(el): Element | null

Defined in: extension/data/modules/commenttriage/platformInterface.ts:50

Returns the nearest ancestor comment element, for walking the comment tree upward.

Parameters
el

Element

Returns

Element | null

The parent comment element, or null if at the root.

getRootContainer()

getRootContainer(): Element | null

Defined in: extension/data/modules/commenttriage/platformInterface.ts:63

Returns the root comment container for the page.

Returns

Element | null

The root sitetable or equivalent element, or null if not found.

isControversial()

isControversial(el): boolean

Defined in: extension/data/modules/commenttriage/platformInterface.ts:39

Returns true if the comment is marked controversial by Reddit.

Parameters
el

Element

Returns

boolean

markProcessed()

markProcessed(el): void

Defined in: extension/data/modules/commenttriage/platformInterface.ts:26

Marks a comment element as processed so it is not re-scored on subsequent runs.

Parameters
el

Element

Returns

void

preSortFixup()

preSortFixup(container): void

Defined in: extension/data/modules/commenttriage/platformInterface.ts:75

Performs any pre-sort fixup needed before the sort algorithm runs. On old Reddit this flattens Never-Ending Reddit (NER) pagination markers; on other platforms this is a no-op.

Parameters
container

Element

Returns

void

readChildCount()

readChildCount(el): number | null

Defined in: extension/data/modules/commenttriage/platformInterface.ts:37

Reads the number of child comments.

Parameters
el

Element

Returns

number | null

The child count, or null if unavailable on this platform.

readScore()

readScore(el): number | null

Defined in: extension/data/modules/commenttriage/platformInterface.ts:32

Reads the vote score for a comment.

Parameters
el

Element

Returns

number | null

The numeric score, or null if unavailable on this platform.

uncollapse()

uncollapse(el): void

Defined in: extension/data/modules/commenttriage/platformInterface.ts:68

Expands (uncollapses) a comment element.

Parameters
el

Element

Returns

void

Properties

commentSelector

commentSelector: string

Defined in: extension/data/modules/commenttriage/platformInterface.ts:21

CSS selector that matches a comment container element (e.g. .thing or shreddit-comment).