moderator-toolbox-nxg-for-reddit / dom/shreddit/commentActionRow
dom/shreddit/commentActionRow¶
Functions¶
getCommentActionRow()¶
getCommentActionRow(
comment):Element|null
Defined in: extension/data/dom/shreddit/commentActionRow.ts:37
Returns a comment’s OWN <shreddit-comment-action-row> (not a nested reply’s), matched by the
action row’s comment-id to the comment’s thingid. Returns null when the row isn’t present
yet (Shreddit lazy-renders comment rows).
Parameters¶
comment¶
Element
A shreddit-comment element.
Returns¶
Element | null
isNativeRowExpanded()¶
isNativeRowExpanded(
comment):boolean
Defined in: extension/data/dom/shreddit/commentActionRow.ts:122
Whether a comment’s native action row is currently expanded (false when the row isn’t rendered).
Parameters¶
comment¶
Element
A shreddit-comment element.
Returns¶
boolean
parseScoreAttr()¶
parseScoreAttr(
el):number|null
Defined in: extension/data/dom/shreddit/commentActionRow.ts:51
Reads a score attribute off an element and parses it to a number, returning
null when the attribute is absent, empty, or non-numeric (Reddit hides the
score by omitting/blanking the attribute).
Parameters¶
el¶
Element | null
The element carrying a score attribute, or null.
Returns¶
number | null
readVoteState()¶
readVoteState(
actionRow):CommentVoteInfo
Defined in: extension/data/dom/shreddit/commentActionRow.ts:61
Reads the current score + vote direction off a comment action row.
Parameters¶
actionRow¶
Element | null
A shreddit-comment-action-row, or null (returns a neutral, score-hidden info).
Returns¶
setNativeRowExpanded()¶
setNativeRowExpanded(
comment,on):void
Defined in: extension/data/dom/shreddit/commentActionRow.ts:114
Shows or hides a comment’s native action row inline by flipping NATIVE_ROW_EXPANDED_CLASS on the comment’s OWN row (the CSS collapse rule keys off the class on the row). No-op when the row isn’t rendered yet.
Parameters¶
comment¶
Element
A shreddit-comment element.
on¶
boolean
true to reveal the native row, false to collapse it.
Returns¶
void
Interfaces¶
CommentVoteInfo¶
Defined in: extension/data/dom/shreddit/commentActionRow.ts:24
A comment’s current vote state and score (score is null when Reddit hides it).
Properties¶
score¶
score:
number|null
Defined in: extension/data/dom/shreddit/commentActionRow.ts:26
Current score, or null when the comment’s score is hidden.
state¶
state:
NativeVoteState
Defined in: extension/data/dom/shreddit/commentActionRow.ts:28
Which arrow (if any) the current user has active.
Type Aliases¶
NativeVoteState¶
NativeVoteState =
"UP"|"DOWN"|"NONE"
Defined in: extension/data/dom/shreddit/commentActionRow.ts:21
Native vote state, as stamped on the action row’s vote-state attribute.
Variables¶
NATIVE_ROW_EXPANDED_CLASS¶
constNATIVE_ROW_EXPANDED_CLASS:"toolbox-native-row-expanded"='toolbox-native-row-expanded'
Defined in: extension/data/dom/shreddit/commentActionRow.ts:18
CSS hook the Expand toggle flips on a comment’s own shreddit-comment-action-row to reveal the
collapsed native row. Lives on the ROW (not the shreddit-comment) so the collapse decision is
per-row: Shreddit nests a reply’s comment - and thus its row - inside the parent, so a class on the
comment would leak through the descendant-combinator collapse rule and re-hide an expanded reply.