update title to show number of unread items

This commit is contained in:
Nazar Kanaev 2020-07-28 12:01:54 +01:00
parent d7b91b1de1
commit 745ade6121
2 changed files with 13 additions and 1 deletions

View File

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>YARR</title>
<title>yarr!</title>
<link rel="stylesheet" href="./static/stylesheets/bootstrap.min.css">
<link rel="stylesheet" href="./static/stylesheets/app.css">
<link rel="icon shortcut" href="./static/images/anchor.png">

View File

@ -1,5 +1,7 @@
'use strict';
var TITLE = document.title
DOMPurify.addHook('afterSanitizeAttributes', function (node) {
// set all elements owning target to target=_blank
if ('target' in node) {
@ -186,6 +188,16 @@ var vm = new Vue({
},
},
watch: {
'feedStats': {
deep: true,
handler: debounce(function() {
var title = TITLE
if (this.totalStats.unread) {
title += ' ('+this.totalStats.unread+')'
}
document.title = title
}, 500),
},
'filterSelected': function(newVal, oldVal) {
if (oldVal === null) return // do nothing, initial setup
api.settings.update({filter: newVal}).then(this.refreshItems.bind(this))