mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
Remove useless code
This commit is contained in:
parent
4ee26d7259
commit
5f0329ccf6
@ -2,26 +2,8 @@
|
||||
|
||||
|
||||
/**
|
||||
* Get the number of unread notifications in the title.
|
||||
*
|
||||
* @return {int} the number of unread notifications
|
||||
*/
|
||||
function getUnreadCount() {
|
||||
const match = document.title.match(/^\((\d+)\)/);
|
||||
return parseInt((match ? match[1] : 0), 10);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the title in the browser window while keeping the unread notification count (if any).
|
||||
* Set the title in the browser window.
|
||||
*/
|
||||
export function setDocumentTitle(title) {
|
||||
const count = getUnreadCount();
|
||||
let newTitle = title;
|
||||
|
||||
if (count > 0) {
|
||||
newTitle = `(${count}) ${newTitle}`;
|
||||
}
|
||||
|
||||
document.title = newTitle;
|
||||
document.title = title;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user