From 5f4935f6cecb4c6eb19bbee6cb357ee4f0cc1ae7 Mon Sep 17 00:00:00 2001 From: llj Date: Mon, 9 Jan 2017 14:17:22 +0800 Subject: [PATCH] fix --- static/scripts/app/views/notifications.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/static/scripts/app/views/notifications.js b/static/scripts/app/views/notifications.js index 5637092f2c..e2295e87a5 100644 --- a/static/scripts/app/views/notifications.js +++ b/static/scripts/app/views/notifications.js @@ -44,19 +44,26 @@ define([ $num.addClass('hide'); document.title = _this.orig_doc_title; } + + var $networkNotice = $('#network-top-notice'); + if ($networkNotice.is(':visible')) { + $networkNotice.remove(); + } }, error: function(xhr) { // e.g. 401 UNAUTHORIZED - clearInterval(reqInterval); // stop sending requests - var $el; if (xhr.responseText) { if (xhr.status == 401) { + clearInterval(reqInterval); // stop sending requests $el = $('

' + gettext("You have logged out.") + '' + gettext("Log in") + '

'); + $('#wrapper').prepend($el); } } else { - $el = $('

' + gettext("Please check the network.") + '

'); + if ($('#network-top-notice').length == 0) { + $el = $('

' + gettext("Please check the network.") + '' + gettext("Refresh") + '

'); + $('#wrapper').prepend($el); + } } - $('#wrapper').prepend($el); $('.top-bar-click', $el).click(function() { location.reload(true); });