1$(document).ready(function () {
2
3    if (window.location.href.includes("&submitted=saved")) {
4        createSaveMessage();
5    }
6    if (window.location.href.includes("&submitted=deleted")) {
7        createDeleteMessage();
8    }
9
10});
11async function createSaveMessage() {
12    $('.save-message')[0].style.display = "block";
13    await new Promise(r => setTimeout(r, 4000));
14    $('.save-message')[0].style.animation = "fadeOutAnimation 1s";
15    await new Promise(r => setTimeout(r, 1000));
16    $('.save-message')[0].style.display = "none";
17
18    // removes the param from url without reloading
19    window.history.pushState({}, '', window.location.href.replace("&submitted=saved", ""));
20}
21async function createDeleteMessage() {
22    $('.delete-message')[0].style.display = "block";
23    await new Promise(r => setTimeout(r, 4000));
24    $('.delete-message')[0].style.animation = "fadeOutAnimation 1s";
25    await new Promise(r => setTimeout(r, 1000));
26    $('.delete-message')[0].style.display = "none";
27
28    // removes the param from url without reloading
29    window.history.pushState({}, '', window.location.href.replace("&submitted=deleted", ""));
30}