moderator-toolbox-nxg-for-reddit / modules/macros/dom
modules/macros/dom¶
Functions¶
createMacrosHandlers()¶
createMacrosHandlers(
showMacroPreview):MacrosHandlers
Defined in: extension/data/modules/macros/dom.ts:274
Creates the DOM handlers for the Mod Macros module.
Parameters¶
showMacroPreview¶
Whether to show a live markdown preview in the edit popup.
Returns¶
A bundle of event handlers that wire macro selectors into reply areas.
editMacro()¶
editMacro(
dropdown,info,macro,topLevel,showMacroPreview,resetSelect):Promise<void>
Defined in: extension/data/modules/macros/dom.ts:68
Opens the macro edit/preview popup for a selected macro and, on submit, posts the reply and performs the macro’s configured mod/user actions. Exported for testing the training-mode refusal of mod-action macros. Not part of the module’s public API.
Parameters¶
dropdown¶
Element
The macro-select dropdown element the popup anchors to.
info¶
Resolved info (fullname/subreddit/author/permalink) for the target thing.
macro¶
The selected macro configuration.
topLevel¶
boolean
Whether the reply is a top-level (post) reply.
showMacroPreview¶
boolean
Whether to show a live markdown preview.
resetSelect¶
() => void
Resets the macro-select control after the popup closes.
Returns¶
Promise<void>
Interfaces¶
MacrosHandlers¶
Defined in: extension/data/modules/macros/dom.ts:38
Event-handler bundle returned by createMacrosHandlers.
Properties¶
cleanup¶
cleanup: () =>
void
Defined in: extension/data/modules/macros/dom.ts:40
Removes all injected macro select elements from the page.
Returns¶
void
handleNewPage¶
handleNewPage: (
event) =>Promise<void>
Defined in: extension/data/modules/macros/dom.ts:52
Handles Toolbox SPA navigation events, adding or removing macro buttons as appropriate.
Parameters¶
event¶
CustomEvent<TBPageContext>
The TBNewPage custom event carrying page context.
Returns¶
Promise<void>
handleReplyClick¶
handleReplyClick: (
element) =>Promise<void>
Defined in: extension/data/modules/macros/dom.ts:47
Injects a macro button into a reply box when a “reply” link is clicked on old Reddit.
Parameters¶
element¶
Element
The clicked anchor element.
Returns¶
Promise<void>
handleShredditMutations¶
handleShredditMutations:
MutationCallback
Defined in: extension/data/modules/macros/dom.ts:54
MutationObserver callback that injects macro buttons into new Shreddit reply forms.
initOldRedditTop¶
initOldRedditTop: () =>
Promise<void>
Defined in: extension/data/modules/macros/dom.ts:42
Injects a macro button into the top-level reply box on old Reddit post pages.
Returns¶
Promise<void>