moderator-toolbox-nxg-for-reddit / dom/oldReddit/things

dom/oldReddit/things

Functions

collapseCommentThing()

collapseCommentThing(thing): void

Defined in: extension/data/dom/oldReddit/things.ts:244

Collapses a comment thing by adding the .collapsed class and updating the expand button text to [+].

Parameters

thing

Element

Returns

void


ensureThingAuthorContainer()

ensureThingAuthorContainer(thing): Element | null

Defined in: extension/data/dom/oldReddit/things.ts:191

Creates (if absent) the .toolbox-author-slot span after the author element. Returns the container element, or null when no author element was found.

Parameters

thing

Element

Returns

Element | null


ensureThingSlot()

ensureThingSlot(thing): Element | null

Defined in: extension/data/dom/oldReddit/things.ts:118

Creates (if absent) the .toolbox-thing-slot div (with a span[data-name="toolbox"] inside) as a child of the thing’s .entry. Returns the container, or null when no entry exists.

Parameters

thing

Element

Returns

Element | null


getCommentRemoveButton()

getCommentRemoveButton(comment): Element | null

Defined in: extension/data/dom/oldReddit/things.ts:158

Returns the remove button anchor within a comment’s button row, or null.

Parameters

comment

Element

Returns

Element | null


getCommentThingChildCount()

getCommentThingChildCount(thing): number | null

Defined in: extension/data/dom/oldReddit/things.ts:275

Reads the child-comment count from a comment thing’s .numchildren element.

Parameters

thing

Element

Returns

number | null

The child count, or null if the element is absent or unparseable.


getCommentThingScore()

getCommentThingScore(thing): number | null

Defined in: extension/data/dom/oldReddit/things.ts:264

Reads the vote score from a comment thing’s .score.unvoted element.

Parameters

thing

Element

Returns

number | null

The numeric score, or null if the element is absent or unparseable.


getEntry()

getEntry(thing): Element | null

Defined in: extension/data/dom/oldReddit/things.ts:53

Returns the .entry element of a thing, or null.

Parameters

thing

Element

Returns

Element | null


getLinkThings()

getLinkThings(container?): Element[]

Defined in: extension/data/dom/oldReddit/things.ts:15

Returns all div.thing.link elements, optionally scoped to a container.

Parameters

container?

Element | Document

Returns

Element[]


getListingPageLinkThings()

getListingPageLinkThings(): Element[]

Defined in: extension/data/dom/oldReddit/things.ts:143

Returns all link things on a listing page (.listing-page .content .thing.link).

Returns

Element[]


getNativeRemoveButton()

getNativeRemoveButton(thing): HTMLElement | null

Defined in: extension/data/dom/oldReddit/things.ts:291

Returns the native remove button (or its inner action link) for a thing.

Prefers the .remove-button wrapper whose action is “remove” (as opposed to the spam button, which shares the class); identified via the data-event-action attribute or the hidden spam/executed form inputs. On subreddit listing pages there is no .remove-button wrapper, so the <a data-event-action="remove"> link is returned directly.

Parameters

thing

HTMLElement

Returns

HTMLElement | null


getReportedStamp()

getReportedStamp(thing): Element | null

Defined in: extension/data/dom/oldReddit/things.ts:58

Returns the .reported-stamp element of a thing, or null.

Parameters

thing

Element

Returns

Element | null


getThingApproveButton()

getThingApproveButton(thing): Element | null

Defined in: extension/data/dom/oldReddit/things.ts:90

Returns the approve/positive button within a thing’s entry button row, or null.

Parameters

thing

Element

Returns

Element | null


getThingAuthorContainer()

getThingAuthorContainer(thing): Element | null

Defined in: extension/data/dom/oldReddit/things.ts:182

Returns the .toolbox-author-slot span inserted by Toolbox after the author element, or null when not yet created.

Parameters

thing

Element

Returns

Element | null


getThingAuthorEl()

getThingAuthorEl(thing): Element | null

Defined in: extension/data/dom/oldReddit/things.ts:168

Returns the .author link in a thing’s entry, or - for deleted content - a span in the first .tagline whose text includes [deleted]. Returns null when neither is found.

Parameters

thing

Element

Returns

Element | null


getThingBigModButtons()

getThingBigModButtons(thing): Element | null

Defined in: extension/data/dom/oldReddit/things.ts:85

Returns the .big-mod-buttons element within a thing’s entry, or null.

Parameters

thing

Element

Returns

Element | null


getThingByFullname()

getThingByFullname(fullname): Element | null

Defined in: extension/data/dom/oldReddit/things.ts:20

Returns the first div.thing element whose data-fullname matches.

Parameters

fullname

string

Returns

Element | null


getThingBylinkAnchor()

getThingBylinkAnchor(thing): HTMLAnchorElement | null

Defined in: extension/data/dom/oldReddit/things.ts:100

Returns the a.bylink (context permalink) anchor within a thing, or null.

Parameters

thing

Element

Returns

HTMLAnchorElement | null


getThingChildSitetable()

getThingChildSitetable(thing): Element | null

Defined in: extension/data/dom/oldReddit/things.ts:231

Returns the child sitetable element of a comment thing, used when recursively processing children. Returns null when the comment has no children.

Parameters

thing

Element

Returns

Element | null


getThingDirectCommentChildren()

getThingDirectCommentChildren(container): HTMLElement[]

Defined in: extension/data/dom/oldReddit/things.ts:223

Returns all direct child comment things within a container, excluding “load more” stubs. Equivalent to the immediate children of a sitetable that are real comments.

Parameters

container

Element

Returns

HTMLElement[]


getThingDomain()

getThingDomain(thing): string | null

Defined in: extension/data/dom/oldReddit/things.ts:39

Returns the parsed domain string from a thing’s span.domain a href, e.g. "self.programming" or "/r/programming". Returns null when the domain element or href is absent.

Parameters

thing

Element

Returns

string | null


getThingDomainEl()

getThingDomainEl(thing): Element | null

Defined in: extension/data/dom/oldReddit/things.ts:48

Returns the span.domain element within a thing’s entry, or null.

Parameters

thing

Element

Returns

Element | null


getThingFlatListButtons()

getThingFlatListButtons(thing): Element | null

Defined in: extension/data/dom/oldReddit/things.ts:133

Returns the .flat-list button row within a thing, or null.

Parameters

thing

Element

Returns

Element | null


getThingFromDescendant()

getThingFromDescendant(element): Element | null

Defined in: extension/data/dom/oldReddit/things.ts:63

Returns the nearest .thing ancestor of an element, or null.

Parameters

element

Element

Returns

Element | null


getThingFullname()

getThingFullname(thing): string | null

Defined in: extension/data/dom/oldReddit/things.ts:25

Returns the data-fullname attribute of a thing element.

Parameters

thing

Element

Returns

string | null


getThingParentComment()

getThingParentComment(thing): Element | null

Defined in: extension/data/dom/oldReddit/things.ts:215

Returns the nearest .thing ancestor of a comment thing’s own parent - i.e. the parent comment in the thread tree. Returns null when the comment is at the root.

Parameters

thing

Element

Returns

Element | null


getThingParentLinkThing()

getThingParentLinkThing(thing): HTMLElement | null

Defined in: extension/data/dom/oldReddit/things.ts:105

Returns the nearest div.link[data-fullname] ancestor (parent submission), or null.

Parameters

thing

Element

Returns

HTMLElement | null


getThingRemovedBy()

getThingRemovedBy(thing): string | null

Defined in: extension/data/dom/oldReddit/things.ts:80

Returns the text content of the .flat-list li[title] element inside a thing’s entry, which old Reddit uses to show the removal/spam action reason. Returns null when absent.

Parameters

thing

Element

Returns

string | null


getThingRemovedInput()

getThingRemovedInput(thing): Element | null

Defined in: extension/data/dom/oldReddit/things.ts:95

Returns the input[value="removed"] within a thing’s entry, or null.

Parameters

thing

Element

Returns

Element | null


getThings()

getThings(container?): Element[]

Defined in: extension/data/dom/oldReddit/things.ts:10

Returns all div.thing elements, optionally scoped to a container.

Parameters

container?

Element | Document

Returns

Element[]


getThingSlot()

getThingSlot(thing): Element | null

Defined in: extension/data/dom/oldReddit/things.ts:110

Returns the toolbox thing slot (toolbox-thing-slot) within a thing’s entry, or null.

Parameters

thing

Element

Returns

Element | null


getThingSubreddit()

getThingSubreddit(thing): string | null

Defined in: extension/data/dom/oldReddit/things.ts:30

Returns the data-subreddit attribute of a thing element.

Parameters

thing

Element

Returns

string | null


getThingSubredditName()

getThingSubredditName(thing): string | null

Defined in: extension/data/dom/oldReddit/things.ts:71

Returns the subreddit name from a thing’s a.subreddit link text, without the r/ prefix, or null when the link is absent or empty.

Parameters

thing

Element

Returns

string | null


getThingTitleAnchor()

getThingTitleAnchor(thing): HTMLAnchorElement | null

Defined in: extension/data/dom/oldReddit/things.ts:138

Returns the a.title link anchor within a thing, or null.

Parameters

thing

Element

Returns

HTMLAnchorElement | null


getUncheckedComments()

getUncheckedComments(marker): Element[]

Defined in: extension/data/dom/oldReddit/things.ts:153

Returns all div.comment elements not yet marked with marker.

Parameters

marker

string

Returns

Element[]


getUncheckedLinkThings()

getUncheckedLinkThings(marker): Element[]

Defined in: extension/data/dom/oldReddit/things.ts:148

Returns all link things not yet marked with marker.

Parameters

marker

string

Returns

Element[]


isThingControversial()

isThingControversial(thing): boolean

Defined in: extension/data/dom/oldReddit/things.ts:236

Returns true when the comment thing is marked as controversial by Reddit.

Parameters

thing

Element

Returns

boolean


markThingSeen()

markThingSeen(thing, marker?): void

Defined in: extension/data/dom/oldReddit/things.ts:205

Marks a thing as seen with the given class marker (default 'toolbox-seen').

Parameters

thing

Element

marker?

string = 'toolbox-seen'

Returns

void


uncollapseCommentThing()

uncollapseCommentThing(thing): void

Defined in: extension/data/dom/oldReddit/things.ts:254

Expands (uncollapses) a comment thing by removing the .collapsed class and updating the expand button text to [–].

Parameters

thing

Element

Returns

void