From 030f3e2ccd02a2786bba701d4b82cd2076de8133 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Tue, 7 May 2013 10:43:54 +0200 Subject: dont highlight tab title when nothing changed, fix #157 --- js/app/controllers/feedcontroller.coffee | 11 ++++++++--- js/public/app.js | 9 ++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/js/app/controllers/feedcontroller.coffee b/js/app/controllers/feedcontroller.coffee index 41e4fa07d..43488ddba 100644 --- a/js/app/controllers/feedcontroller.coffee +++ b/js/app/controllers/feedcontroller.coffee @@ -56,10 +56,15 @@ ActiveFeed, FeedType, $window) -> # and it has nothing to do with the body structure if count > 0 titleCount = @_unreadCountFormatter(count) - @_$window.document.title = - 'News (' + titleCount + ') | ownCloud' + title = 'News (' + titleCount + ') | ownCloud' else - @_$window.document.title = 'News | ownCloud' + title = 'News | ownCloud' + + # only update title when it changed to prevent highlighting the + # tab + if @_$window.document.title != title + @_$window.document.title = title + return count @_$scope.isAddingFolder = => diff --git a/js/public/app.js b/js/public/app.js index ced24417e..91a50de34 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -436,14 +436,17 @@ License along with this library. If not, see . this._$scope.starredBusinessLayer = this._starredBusinessLayer; this._$scope.unreadCountFormatter = this._unreadCountFormatter; this._$scope.getTotalUnreadCount = function() { - var count, titleCount; + var count, title, titleCount; count = _this._subscriptionsBusinessLayer.getUnreadCount(0); if (count > 0) { titleCount = _this._unreadCountFormatter(count); - _this._$window.document.title = 'News (' + titleCount + ') | ownCloud'; + title = 'News (' + titleCount + ') | ownCloud'; } else { - _this._$window.document.title = 'News | ownCloud'; + title = 'News | ownCloud'; + } + if (_this._$window.document.title !== title) { + _this._$window.document.title = title; } return count; }; -- cgit v1.2.3