summaryrefslogtreecommitdiff
path: root/Static/Js/message.js
blob: 97f39ef9126a0100f8b0061588128bb851d66471 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

// ****************************************************************************
// MESSAGES
// ****************************************************************************

// Redirection
function redirect(page) {
    window.location.href = `/${page}.php`;
}

// Timer pour message
function start_timer(page) {
    let seconds = 2;
    let text = document.getElementById("redirect").innerHTML;
    setInterval(() => {
        if (seconds > 0) {
            document.getElementById("redirect").innerHTML = `${text} ${seconds} .`;
            seconds --;
        } else {
            document.getElementById("redirect").innerHTML = `${text} ${seconds} .`;
            redirect(page);
        }
    },
    1000);
}