better UI feedback for prompt msg

This commit is contained in:
Justin 2023-07-18 15:47:33 +08:00 committed by GitHub
parent 11e5970955
commit a52a9e56e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3161,10 +3161,30 @@ function updateCryptoPorftolio() {
// SAVE FEATURES TO DISPLAY PROMPT FUNCTIONS
var savePromptTimeout;
var isSavePromptRunning = false;
function displaySavePrompt() {
// Check if the function is already running
if (isSavePromptRunning) {
return;
}
isSavePromptRunning = true;
document.getElementById('save-prompt-message').style.display = "block";
var savePrompt = document.getElementById('save-prompt-p');
// Store the original color
var originalColor = savePrompt.style.color;
// Set the new color for the transition effect
savePrompt.style.color = "yellow";
// Clear any existing timeout
clearTimeout(savePromptTimeout);
// Add a delay before reverting back to the original color
savePromptTimeout = setTimeout(function() {
savePrompt.style.color = originalColor;
isSavePromptRunning = false;
},300); // 0.3 seconds
}
function closeSavePrompt() {
document.getElementById('save-prompt-message').style.display = "none";
}