display feature settings prompt

This commit is contained in:
Justin 2023-07-18 17:46:50 +08:00 committed by GitHub
parent 44d516012d
commit f1c37fa6de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}