From 2e9994197705b18b6318f13b3bb8ff367580b2a7 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Wed, 18 May 2022 00:31:16 +0300 Subject: [PATCH] added some of the missing StackExchange.helpers --- lib/stackexchange.d.ts | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/lib/stackexchange.d.ts b/lib/stackexchange.d.ts index d5c19b3..1ec2325 100644 --- a/lib/stackexchange.d.ts +++ b/lib/stackexchange.d.ts @@ -59,6 +59,13 @@ declare global { } const helpers: { + /** Appends a hidden .lightbox to the body */ + addLightbox(): JQuery; + /** + * Initializes draggable popups + * @deprecated + */ + bindMovablePopups(): void; /** Hides any visible toasts from the page */ hideToasts(): void; /** @@ -71,11 +78,36 @@ declare global { * @param url The URL */ parseUrl(url: string): HTMLAnchorElement; + /** + * Displays a banner message. + * @param message a string or HTML string + * @param type banner type + */ + showBannerMessage( + message: string, + type: "error" | "info" | "success" | "warning" + ): JQuery; /** * Shows a Stacks confirmation modal * @param modalOptions The modal options */ showConfirmModal(modalOptions: ModalType): Promise; + /** + * Displays a success message. + */ + showErrorMessage( + $elem: JQuery, + message: string, + options: object + ): JQuery; + /** + * Displays a success message. + */ + showInfoMessage( + $elem: JQuery, + message: string, + options: object + ): JQuery; /** * Shows a modal that already exists in the DOM * @param elementOrSelector The modal's HTML element or its selector @@ -84,6 +116,14 @@ declare global { elementOrSelector: string | JQuery | Element | null, displayOptions?: Partial ): void; + /** + * Displays a success message. + */ + showSuccessMessage( + $elem: JQuery, + message: string, + options: object + ): JQuery; /** * Shows a Stacks toast * @param messageHtml The message's HTML content