function toastMessage(message, readTime) {
    // Indicating to the client js that the toast function is already being ran.
    toastShowing = true;

    // Setting the message to display in the toast span.
    toastMsg.innerHTML = message;

    // Setting the opacity of its container to 0 (prep for animation) and unhiding it.
    toastMsgContainer.style.opacity = 0.0;
    toastMsgContainer.style.visibility = "visible";

    // Displaying the toast message to the user.
    var fadeIn = setInterval(function () {
        // If the toast message opacity is not equal to 1... (I don't know why I have to <= 0.99 but otherwise it jumps to 1.01)
        if (toastMsgContainer.style.opacity <= "0.99") {
            // Increment it by 0.01.
            toastMsgContainer.style.opacity =
                parseFloat(toastMsgContainer.style.opacity) + 0.01;
            // If it is equal to 1...
        } else {
            // Stop fading it in, it's already complete.
            clearInterval(fadeIn);
        }
    });

    // Wait a second before fading it out (to give it time to fade in, let the user read it, then fade out).
    setTimeout(function () {
        // Hiding the message from the user.
        var fadeOut = setInterval(function () {
            // If the toast message opacity is greater than 0...
            if (toastMsgContainer.style.opacity > "0.00") {
                // Decrement it by 0.01.
                toastMsgContainer.style.opacity =
                    parseFloat(toastMsgContainer.style.opacity) - 0.01;
                // If it is equal to 0...
            } else {
                // Stop fading it out, it's already complete.
                clearInterval(fadeOut);
                // Hiding the container again.
                toastMsgContainer.style.visibility = "hidden";
                // Indicating to the client js that the toast is not longer being shown, so the toast function can be executed again.
                toastShowing = false;
            }
        });
    }, readTime);
}
// Message to display, how long to let the user read it.
Message to display, how long to let the user read it.
Message to display how long to let the user read it .
function toastMessage(message, readTime) {
    toastShowing = true;
    toastMsg.innerHTML = message;
    toastMsgContainer.style.opacity = 0.0;
    toastMsgContainer.style.visibility = "visible";
    var fadeIn = setInterval(function () {
        if (toastMsgContainer.style.opacity <= "0.99") {
            toastMsgContainer.style.opacity =
                parseFloat(toastMsgContainer.style.opacity) + 0.01;
        } else {
            clearInterval(fadeIn);
        }
    });
    setTimeout(function () {
        var fadeOut = setInterval(function () {
            if (toastMsgContainer.style.opacity > "0.00") {
                toastMsgContainer.style.opacity =
                    parseFloat(toastMsgContainer.style.opacity) - 0.01;
            } else {
                clearInterval(fadeOut);
                toastMsgContainer.style.visibility = "hidden";
                toastShowing = false;
            }
        });
    }, readTime);
}
function toastMessage ( message , readTime ) { toastShowing = true ; toastMsg . innerHTML = message ; toastMsgContainer . style . opacity = 0.0 ; toastMsgContainer . style . visibility = "visible" ; var fadeIn = setInterval ( function ( ) { if ( toastMsgContainer . style . opacity <= "0.99" ) { toastMsgContainer . style . opacity = parseFloat ( toastMsgContainer . style . opacity ) + 0.01 ; } else { clearInterval ( fadeIn ) ; } } ) ; setTimeout ( function ( ) { var fadeOut = setInterval ( function ( ) { if ( toastMsgContainer . style . opacity > "0.00" ) { toastMsgContainer . style . opacity = parseFloat ( toastMsgContainer . style . opacity ) - 0.01 ; } else { clearInterval ( fadeOut ) ; toastMsgContainer . style . visibility = "hidden" ; toastShowing = false ; } } ) ; } , readTime ) ; }
Message to display, how long to let the user read it.
Message to display how long to let the user read it .
// Indicating to the client js that the toast function is already being ran. // Setting the message to display in the toast span. // Setting the opacity of its container to 0 (prep for animation) and unhiding it. // Displaying the toast message to the user. // If the toast message opacity is not equal to 1... (I don't know why I have to <= 0.99 but otherwise it jumps to 1.01) // Increment it by 0.01. // If it is equal to 1... // Stop fading it in, it's already complete. // Wait a second before fading it out (to give it time to fade in, let the user read it, then fade out). // Hiding the message from the user. // If the toast message opacity is greater than 0... // Decrement it by 0.01. // If it is equal to 0... // Stop fading it out, it's already complete. // Hiding the container again. // Indicating to the client js that the toast is not longer being shown, so the toast function can be executed again.