diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index f281fd47..5f8942dc 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -18,6 +18,16 @@ function off(n){ d.getElementsByName(n)[0].value = -1; } + var timeout; + function showToast(text, error = false) + { + var x = gId("toast"); + x.innerHTML = text; + x.className = error ? "error":"show"; + clearTimeout(timeout); + x.style.animation = 'none'; + timeout = setTimeout(function(){ x.className = x.className.replace("show", ""); }, 2900); + } function bLimits(b,p,m) { maxB = b; maxM = m; maxPB = p; } @@ -317,8 +327,8 @@ Reverse (rotated 180°): } function uploadFile() { var req = new XMLHttpRequest(); - //req.addEventListener('load', function(){console.log(this.responseText);}); - req.addEventListener('error', function(e){console.error(e.stack);}); + req.addEventListener('load', function(){showToast(this.responseText)}); + req.addEventListener('error', function(e){showToast(e.stack,true);}); req.open("POST", "/upload"); var formData = new FormData(); formData.append("data", d.Sf.data.files[0], "/ir.json"); @@ -337,7 +347,6 @@ Reverse (rotated 180°):
-