From 16c6fc5ccc4d8d11e7092f4aa4445d9cd849ed42 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Sun, 8 Jun 2014 12:42:22 -0400 Subject: [PATCH] Show unread count in the document title Conflicts: public/js/selfoss-base.js --- public/js/selfoss-base.js | 15 +++++++++++++++ public/js/selfoss-events-entriestoolbar.js | 1 + templates/home.phtml | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/public/js/selfoss-base.js b/public/js/selfoss-base.js index 77d87bff55..d34e7fe1c7 100644 --- a/public/js/selfoss-base.js +++ b/public/js/selfoss-base.js @@ -169,6 +169,8 @@ var selfoss = { // update sources selfoss.refreshSources(data.sources); + selfoss.setUnreadCount(data.unread); + // clean up $('#content').removeClass('loading'); selfoss.activeAjaxReq = null; @@ -301,6 +303,19 @@ var selfoss = { } } }); + }, + + /** + * show the unread count in the document title + * + * @param int unread + */ + setUnreadCount: function(unread) { + if(unread>0) { + $(document).attr('title', 'selfoss ('+unread+')'); + } else { + $(document).attr('title', 'selfoss'); + } } }; diff --git a/public/js/selfoss-events-entriestoolbar.js b/public/js/selfoss-events-entriestoolbar.js index 074147955e..9cbf5374c8 100644 --- a/public/js/selfoss-events-entriestoolbar.js +++ b/public/js/selfoss-events-entriestoolbar.js @@ -204,6 +204,7 @@ selfoss.events.entriesToolbar = function(parent) { tagsCountEl.html(''); } ); + selfoss.setUnreadCount(unreadstats); }; updateStats(unread); diff --git a/templates/home.phtml b/templates/home.phtml index c645226fdc..88e7638e3b 100644 --- a/templates/home.phtml +++ b/templates/home.phtml @@ -4,7 +4,7 @@ - selfoss + selfoss<?PHP echo $this->statsUnread>0 ? ' ('.$this->statsUnread.')' : ''; ?>