js: Make alert_popup shared.

It allows the click handler for the "x" button, and the stacktrace
toggler to be shared between webapp and the portico pages.

Reimplements #17801.
This commit is contained in:
PIG208
2021-04-26 00:26:03 +08:00
committed by Tim Abbott
parent a84eea9b84
commit 7b60ce1d70
3 changed files with 12 additions and 15 deletions

View File

@@ -1,16 +1,14 @@
import $ from "jquery";
export function initialize(): void {
// this will hide the alerts that you click "x" on.
$("body").on("click", ".alert-box > div .exit", function () {
const $alert = $(this).closest(".alert-box > div");
$alert.addClass("fade-out");
setTimeout(() => {
$alert.removeClass("fade-out show");
}, 300);
});
// this will hide the alerts that you click "x" on.
$("body").on("click", ".alert-box > div .exit", function () {
const $alert = $(this).closest(".alert-box > div");
$alert.addClass("fade-out");
setTimeout(() => {
$alert.removeClass("fade-out show");
}, 300);
});
$(".alert-box").on("click", ".stackframe", function () {
$(this).siblings(".code-context").toggle("fast");
});
}
$(".alert-box").on("click", ".stackframe", function () {
$(this).siblings(".code-context").toggle("fast");
});

View File

@@ -3,6 +3,7 @@ import "core-js/features/symbol";
import "css.escape";
import "../webpack_public_path";
import "../../../tools/debug-require";
import "../alert_popup";
import "../csrf";
import "../blueslip";
import "../../third/bootstrap/js/bootstrap";

View File

@@ -8,7 +8,6 @@ import * as fenced_code from "../shared/js/fenced_code";
import render_edit_content_button from "../templates/edit_content_button.hbs";
import * as activity from "./activity";
import * as alert_popup from "./alert_popup";
import * as alert_words from "./alert_words";
import * as blueslip from "./blueslip";
import * as bot_data from "./bot_data";
@@ -465,7 +464,6 @@ export function initialize_everything() {
// template.
compose.initialize();
message_lists.initialize();
alert_popup.initialize();
alert_words.initialize(alert_words_params);
emojisets.initialize();
people.initialize(page_params.user_id, people_params);