From d31acc5952c0645110e334dbe032d7700e5af8a4 Mon Sep 17 00:00:00 2001 From: rr- Date: Mon, 26 Sep 2016 22:44:32 +0200 Subject: [PATCH] client/views: show "!" in document title on errors Closes #96 --- client/js/models/top_navigation.js | 1 + client/js/util/views.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/client/js/models/top_navigation.js b/client/js/models/top_navigation.js index 5b93d99..ebb3753 100644 --- a/client/js/models/top_navigation.js +++ b/client/js/models/top_navigation.js @@ -53,6 +53,7 @@ class TopNavigation extends events.EventTarget { } setTitle(title) { + document.oldTitle = null; document.title = config.name + (title ? (' – ' + title) : ''); } diff --git a/client/js/util/views.js b/client/js/util/views.js index 0d3f71f..31c19dd 100644 --- a/client/js/util/views.js +++ b/client/js/util/views.js @@ -288,6 +288,8 @@ function showMessage(target, message, className) { } function showError(target, message) { + document.oldTitle = document.title; + document.title = `! ${document.title}`; return showMessage(target, misc.formatInlineMarkdown(message), 'error'); } @@ -300,6 +302,10 @@ function showInfo(target, message) { } function clearMessages(target) { + if (document.oldTitle) { + document.title = document.oldTitle; + document.oldTitle = null; + } const messagesHolder = target.querySelector('.messages'); /* TODO: animate that */ emptyContent(messagesHolder);