Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Show unread count in the document title #548

Merged
merged 1 commit into from
Sep 9, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions public/js/selfoss-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ var selfoss = {
// update sources
selfoss.refreshSources(data.sources);

selfoss.setUnreadCount(data.unread);

// clean up
$('#content').removeClass('loading');
selfoss.activeAjaxReq = null;
Expand Down Expand Up @@ -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');
}
}

};
Expand Down
1 change: 1 addition & 0 deletions public/js/selfoss-events-entriestoolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ selfoss.events.entriesToolbar = function(parent) {
tagsCountEl.html('');

} );
selfoss.setUnreadCount(unreadstats);
};
updateStats(unread);

Expand Down
2 changes: 1 addition & 1 deletion templates/home.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<meta charset="utf-8">

<title>selfoss</title>
<title>selfoss<?PHP echo $this->statsUnread>0 ? ' ('.$this->statsUnread.')' : ''; ?></title>

<meta name="description" content="selfoss" />
<meta name="author" content="Tobias Zeising" />
Expand Down