diff --git a/static/app.js b/static/app.js index 530c292..86b10bd 100755 --- a/static/app.js +++ b/static/app.js @@ -754,10 +754,13 @@ var allFeaturesLimit = [ +var createLi = false; + +// function addingItems() { allFeaturesTextAddBtn.map((value, index) => { if (value !== null) { value.addEventListener("click", () => { - if (value == messagesTextAddBtn) { + if ((value == messagesTextAddBtn) && (createLi === true)) { // custom message let messageName = document.getElementById("inputText13").value; let scrollSpeed1 = document.getElementById("inputScrollSpeed13").value; @@ -801,6 +804,7 @@ allFeaturesTextAddBtn.map((value, index) => { // getCustomMsg // ? localStorage.setItem("customMsg", JSON.stringify(newValues)) // : localStorage.setItem("customMsg", JSON.stringify([values])); + var tag = document.createElement("li"); var msg = "You've reached the maximum limit of items to add for this feature"; @@ -814,8 +818,9 @@ allFeaturesTextAddBtn.map((value, index) => { allFeatures[index].appendChild(tag); changeVarValue(); addEventOnFeaturesList(); - } - } + createLi = false; + + }} } else { var msg = "You've reached the maximum limit of items to add for this feature"; @@ -825,25 +830,20 @@ allFeaturesTextAddBtn.map((value, index) => { } else{ + + if (createLi === true) { var tag = document.createElement("li"); tag.innerHTML = allFeaturesText[index].value; allFeatures[index].appendChild(tag); changeVarValue(); addEventOnFeaturesList(); + createLi = false; } } - }); + }}); } }); -var startButton = document.getElementById("start-btn"); -// start the display -startButton.addEventListener("click", () => { - fetch("/start", { - method: "PUT", - }); -}); - var brightnessButton = document.getElementById("brightness-btn"); // start the display brightnessButton.addEventListener("click", () => {