From 23221deb4656813b080407d68b34eaa2f4720a6c Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Sat, 30 Apr 2016 16:16:59 -0400 Subject: [PATCH] After error div fades away, old errors can reshow --- src/fallback.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/fallback.js b/src/fallback.js index 6455d68e..9bc8baf2 100644 --- a/src/fallback.js +++ b/src/fallback.js @@ -2,14 +2,23 @@ import describe from "src/base/Describe.js" let _alreadySeen = []; let showErrorDiv = (subject, body) => { - document.getElementById('errorDiv').style.backgroundColor = '#FFA'; - document.getElementById('errorDiv').style.opacity = 1.0; - document.getElementById('errorDiv').style.display = 'block'; + let errDivStyle = document.getElementById('errorDiv').style; + if (errDivStyle.display !== 'block') { + // Faded away. We can re-show messages now. + _alreadySeen = []; + } + + // Error just happened, so this should be showing and highlighted. + errDivStyle.backgroundColor = '#FFA'; + errDivStyle.opacity = 1.0; + errDivStyle.display = 'block'; + if (_alreadySeen.indexOf(body) !== -1) { return; } _alreadySeen.push(body); + // Set shown error details. document.getElementById('errorMessageDiv').innerText = subject; document.getElementById('errorDescDiv').innerText = body; document.getElementById('error-mailto-anchor').innerText = 'Email the issue to craig.gidney@gmail.com';