diff --git a/static/script.js b/static/script.js index bcb4964..cf75f0e 100644 --- a/static/script.js +++ b/static/script.js @@ -26,7 +26,7 @@ function summarizeButtonClick(button) { var container = button.parentNode; container.classList.add('alert'); - container.classList.add('alert-warning'); + container.classList.add('alert-warn'); container.innerHTML = loadingMsg; var request = new XMLHttpRequest(); @@ -47,14 +47,20 @@ function summarizeButtonClick(button) { return request.onerror(e); } - container.classList.remove('alert-warning'); - container.classList.add('alert-success'); - container.innerHTML = response.response.output_text.replace('\n', '
'); + if (response.response.error) { + container.classList.remove('alert-warn'); + container.classList.add('alert-error'); + } else { + container.classList.remove('alert-warn'); + container.classList.add('alert-success'); + } + + container.innerHTML = response.response.output_text; } request.onerror = function(e) { badAjax(this.status == 403); - container.classList.remove('alert-warning'); + container.classList.remove('alert-warn'); container.classList.add('alert-error'); container.innerHTML = errorMsg; }