toast progress bar
This commit is contained in:
parent
a3740c30fe
commit
621aee3f8d
@ -1,5 +1,5 @@
|
||||
const toastTemplate = `
|
||||
<div class="toast mt-3 show" role="alert" aria-live="assertive" aria-atomic="true">
|
||||
<div class="toast mt-3" role="alert" aria-live="assertive" aria-atomic="true">
|
||||
<div class="toast-header">
|
||||
<i class="toast-icon bi me-2"></i>
|
||||
<strong class="toast-title me-auto">Bootstrap</strong>
|
||||
@ -12,6 +12,8 @@ const toastTemplate = `
|
||||
</div>
|
||||
`
|
||||
|
||||
const toastFadeDelayMs = 5000;
|
||||
|
||||
const toastTypes = {
|
||||
"primary": "bi-bell-fill",
|
||||
"info": "bi-info-circle-fill",
|
||||
@ -23,6 +25,21 @@ const toastTypes = {
|
||||
function showToast(typeName, title, message) {
|
||||
var toast = makeToast(typeName, title, message)
|
||||
$(".toasts-container").prepend(toast);
|
||||
|
||||
toast.toast("show", {autohide: false});
|
||||
|
||||
// var progressPercent = 100;
|
||||
// var progressBar = toast.find(".progress-bar");
|
||||
|
||||
// const toastProgressInterval = setInterval(function() {
|
||||
// progressPercent -= 1;
|
||||
// progressBar.css("width", progressPercent + "%");
|
||||
// if (progressPercent < 0) {
|
||||
// // toast.toast("hide");
|
||||
// // setTimeout(function() {toast.remove(); }, 1500);
|
||||
// clearInterval(toastProgressInterval);
|
||||
// }
|
||||
// }, (toastFadeDelayMs + 1500) / 100);
|
||||
}
|
||||
|
||||
function makeToast(typeName, title, message) {
|
||||
|
@ -458,10 +458,11 @@
|
||||
}
|
||||
|
||||
const uuid = $("#subEditModal").attr("data-uuid");
|
||||
const subName = $("#editSubName").val();
|
||||
|
||||
var formData = new FormData();
|
||||
formData.append("uuid", uuid);
|
||||
formData.append("name", $("#editSubName").val());
|
||||
formData.append("name", subName);
|
||||
formData.append("rss_url", $("#editSubURL").val());
|
||||
formData.append("server", $("#editSubServer").val());
|
||||
formData.append("extra_notes", $("#editSubNotes").val());
|
||||
@ -479,11 +480,13 @@
|
||||
loadSubscriptions();
|
||||
$("#subEditModal").modal("hide");
|
||||
})
|
||||
showToast("success", "Subscription Created", `${subName} successfully created.`);
|
||||
}
|
||||
else {
|
||||
editSubscription(uuid, formData).then(resp => {
|
||||
loadSubscriptions();
|
||||
$("#subEditModal").modal("hide");
|
||||
showToast("success", "Subscription Modified", `${subName} successfully modified.`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user