Skip to content

Commit

Permalink
added some of the missing StackExchange.helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
Oaphi committed May 17, 2022
1 parent 87b700c commit 2e99941
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions lib/stackexchange.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/**
Expand All @@ -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<boolean>;
/**
* 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
Expand All @@ -84,6 +116,14 @@ declare global {
elementOrSelector: string | JQuery | Element | null,
displayOptions?: Partial<ShowModalOptions>
): void;
/**
* Displays a success message.
*/
showSuccessMessage(
$elem: JQuery,
message: string,
options: object
): JQuery;
/**
* Shows a Stacks toast
* @param messageHtml The message's HTML content
Expand Down

0 comments on commit 2e99941

Please sign in to comment.