bootstrap backed replacements for JS prompt and alert

This commit is contained in:
azivner
2018-11-12 20:17:48 +01:00
parent c6e1ad5f15
commit 2523f81f3b
7 changed files with 119 additions and 39 deletions

View File

@@ -0,0 +1,31 @@
const $dialog = $("#info-dialog");
const $infoContent = $("#info-dialog-content");
const $okButton = $("#info-dialog-ok-button");
let resolve;
function info(message) {
glob.activeDialog = $dialog;
$infoContent.text(message);
$dialog.modal();
return new Promise((res, rej) => {
resolve = res;
});
}
$dialog.on('shown.bs.modal', () => $okButton.trigger("focus"));
$dialog.on("hidden.bs.modal", () => {
if (resolve) {
resolve();
}
});
$okButton.click(() => $dialog.modal("hide"));
export default {
info
}