From f1c37fa6defc185343d787ee00cd23116b32ee39 Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 18 Jul 2023 17:46:50 +0800 Subject: [PATCH] display feature settings prompt --- static/app.js | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/static/app.js b/static/app.js index 6d006ab..3f8302e 100755 --- a/static/app.js +++ b/static/app.js @@ -562,6 +562,7 @@ allFeaturesRemoveBtns.map((value, index) => { method: "POST", body: JSON.stringify(symbol), }); + displaySavePrompt2(); } else if ((item.getAttribute("class") == "active") && (index == 1 )){ let symbol = item.innerText; @@ -571,12 +572,14 @@ allFeaturesRemoveBtns.map((value, index) => { fetch("/deletePortfolioCryptoSettings", { method: "POST", body: JSON.stringify(symbol), - }); + }); + displaySavePrompt2(); } else if (item.getAttribute("class") == "active") { item.remove(); uploaded_images = []; uploaded_GIFs = []; + displaySavePrompt2(); } } }); @@ -595,6 +598,7 @@ allFeaturesIncreaseBtns.map((value, index) => { prevElement.innerText = currentText; prevElement.setAttribute("class", "active"); item.setAttribute("class", ""); + displaySavePrompt2(); } } }); @@ -614,6 +618,7 @@ allFeaturesDecreaseBtns.map((value, index) => { nextElement.innerText = currentText; nextElement.setAttribute("class", "active"); item.setAttribute("class", ""); + displaySavePrompt2(); break; } } @@ -3186,7 +3191,6 @@ function displaySavePrompt() { },300); // 0.3 seconds } - function closeSavePrompt() { document.getElementById('save-prompt-message').style.display = "none"; } @@ -3208,4 +3212,43 @@ function savePrompt() { } +// SAVE FEATURE SETTINGS PROMPT FUNCTIONS +var savePromptTimeout2; +var isSavePromptRunning2 = false; +function displaySavePrompt2() { + // Check if the function is already running + if (isSavePromptRunning2) { + return; + } + isSavePromptRunning2 = true; + document.getElementById('save-feature-prompt-message').style.display = "block"; + var savePrompt2 = document.getElementById('save-feature-prompt-p'); + // Store the original color + var originalColor2 = savePrompt2.style.color; + // Set the new color for the transition effect + savePrompt2.style.color = "lightgreen"; + // Clear any existing timeout + clearTimeout(savePromptTimeout2); + // Add a delay before reverting back to the original color + savePromptTimeout2 = setTimeout(function() { + savePrompt2.style.color = originalColor2; + isSavePromptRunning2 = false; + },300); // 0.3 seconds +} + +function closeFeatureSavePrompt() { + document.getElementById('save-feature-prompt-message').style.display = "none"; +} + +function featureSavePrompt() { + document.getElementById('save-feature-prompt-message').style.display = "none"; + setTimeout( + function() { + document.getElementById('saved-feature-msg-feedback').style.display = "block"; + }, 100); + setTimeout( + function() { + document.getElementById('saved-feature-msg-feedback').style.display = "none"; + }, 3000); +}