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:32
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:116
Whether a comment’s native action row is currently expanded.
Parameters¶
comment¶
Element
A shreddit-comment element.
Returns¶
boolean
parseScoreAttr()¶
parseScoreAttr(
el):number|null
Defined in: extension/data/dom/shreddit/commentActionRow.ts:46
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:56
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:108
Shows or hides a comment’s native action row inline (the CSS collapse rule keys off NATIVE_ROW_EXPANDED_CLASS).
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:19
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:21
Current score, or null when the comment’s score is hidden.
state¶
state:
NativeVoteState
Defined in: extension/data/dom/shreddit/commentActionRow.ts:23
Which arrow (if any) the current user has active.
Type Aliases¶
NativeVoteState¶
NativeVoteState =
"UP"|"DOWN"|"NONE"
Defined in: extension/data/dom/shreddit/commentActionRow.ts:16
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:13
CSS hook the Expand toggle flips on a shreddit-comment to reveal its collapsed native row.