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

modules/comment/platformInterface

Functions

createOldRedditCommentAdapter()

createOldRedditCommentAdapter(): CommentModuleAdapter

Defined in: extension/data/modules/comment/platformInterface.ts:112

Returns the old-Reddit binding for CommentModuleAdapter.

Returns

CommentModuleAdapter

Interfaces

CommentModuleAdapter

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

Platform-agnostic interface consumed by the Comments module’s feature handlers. Implementations bind abstract operations to concrete DOM manipulations for each Reddit platform.

Methods

expandOldThing()

expandOldThing(thing): void

Defined in: extension/data/modules/comment/platformInterface.ts:91

Fully expands a collapsed-old thing, restoring all direct children’s visibility.

Parameters
thing

Element

The comment thing element to expand.

Returns

void

getActionReasonElements()

getActionReasonElements(): HTMLElement[]

Defined in: extension/data/modules/comment/platformInterface.ts:36

Returns action-reason elements whose visibility is toggled along with removed comments.

Returns

HTMLElement[]

getApproveAnchor()

getApproveAnchor(thing): Element | null

Defined in: extension/data/modules/comment/platformInterface.ts:41

Returns the DOM anchor where an approve button should be inserted, or null if one already exists.

Parameters
thing

Element

The comment thing element.

Returns

Element | null

getCommentContainerForAction()

getCommentContainerForAction(action): HTMLElement | null

Defined in: extension/data/modules/comment/platformInterface.ts:103

Returns the comment container that wraps a given mod-action element.

Parameters
action

Element

A moderator action element.

Returns

HTMLElement | null

getCommentEntry()

getCommentEntry(thing): HTMLElement | null

Defined in: extension/data/modules/comment/platformInterface.ts:80

Returns the entry element for a comment thing, used as the visibility toggle target.

Parameters
thing

Element

The comment thing element.

Returns

HTMLElement | null

getHamButtonAnchor()

getHamButtonAnchor(thing): Element | null

Defined in: extension/data/modules/comment/platformInterface.ts:51

Returns the DOM anchor where a ham/remove button should be inserted, or null if one already exists.

Parameters
thing

Element

The comment thing element.

Returns

Element | null

getMarkedSpamEntries()

getMarkedSpamEntries(): HTMLElement[]

Defined in: extension/data/modules/comment/platformInterface.ts:64

Returns all comment entry elements currently marked as spam via markEntryAsSpam.

Returns

HTMLElement[]

getModeratorActionElements()

getModeratorActionElements(): Element[]

Defined in: extension/data/modules/comment/platformInterface.ts:98

Returns elements that represent moderator action comments on the page.

Returns

Element[]

getOldCommentThings()

getOldCommentThings(): Element[]

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

Returns comment thing elements that are considered “old” (already seen by the user).

Returns

Element[]

getSpamButtonAnchor()

getSpamButtonAnchor(thing): Element | null

Defined in: extension/data/modules/comment/platformInterface.ts:46

Returns the DOM anchor where a spam button should be inserted, or null if one already exists.

Parameters
thing

Element

The comment thing element.

Returns

Element | null

getSpammedCommentEntries()

getSpammedCommentEntries(): Element[]

Defined in: extension/data/modules/comment/platformInterface.ts:28

Returns all comment entry elements that are currently marked as spam/removed.

Returns

Element[]

getUncheckedCommentThings()

getUncheckedCommentThings(): Element[]

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

Returns comment thing elements that have not yet been processed by the spam-toggle run.

Returns

Element[]

hideCommentContainer()

hideCommentContainer(container): void

Defined in: extension/data/modules/comment/platformInterface.ts:108

Hides the given comment container from view.

Parameters
container

HTMLElement

The container element to hide.

Returns

void

insertActionButton()

insertActionButton(anchor, position, config): void

Defined in: extension/data/modules/comment/platformInterface.ts:58

Creates and inserts an action button (approve/spam/remove) adjacent to the given anchor.

Parameters
anchor

Element

The reference element to insert relative to.

position

InsertPosition

Where to insert relative to the anchor.

config

Button class, visible label, and thing fullname stored as a data attribute.

className

string

fullname

string

text

string

Returns

void

markEntryAsSpam()

markEntryAsSpam(entry): void

Defined in: extension/data/modules/comment/platformInterface.ts:30

Marks a comment entry element as spam so it can be targeted by visibility toggling.

Parameters
entry

Element

Returns

void

markThingChecked()

markThingChecked(thing): void

Defined in: extension/data/modules/comment/platformInterface.ts:34

Marks a thing as processed so it won’t be re-scanned on the next run.

Parameters
thing

Element

Returns

void

markThingOldCollapsed()

markThingOldCollapsed(thing, collapsed): void

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

Adds or removes the collapsed-old marker class on a thing.

Parameters
thing

Element

The comment thing element.

collapsed

boolean

True to mark as old-collapsed, false to unmark.

Returns

void

resetAllCommentVisibility()

resetAllCommentVisibility(): void

Defined in: extension/data/modules/comment/platformInterface.ts:93

Resets all comment visibility state, undoing any hide-old-comments operation.

Returns

void

setElementVisible()

setElementVisible(el, visible): void

Defined in: extension/data/modules/comment/platformInterface.ts:70

Shows or hides an element.

Parameters
el

HTMLElement

The element to affect.

visible

boolean

Whether the element should be visible.

Returns

void

Properties

oldExpandSelector

oldExpandSelector: string

Defined in: extension/data/modules/comment/platformInterface.ts:23

CSS selector matching old-collapsed comment things; used for lifecycle delegation.