mirror of
				https://github.com/nkanaev/yarr.git
				synced 2025-10-31 15:02:57 +00:00 
			
		
		
		
	update title to show number of unread items
This commit is contained in:
		| @@ -2,7 +2,7 @@ | |||||||
| <html lang="en"> | <html lang="en"> | ||||||
| <head> | <head> | ||||||
|     <meta charset="UTF-8"> |     <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/bootstrap.min.css"> | ||||||
|     <link rel="stylesheet" href="./static/stylesheets/app.css"> |     <link rel="stylesheet" href="./static/stylesheets/app.css"> | ||||||
|     <link rel="icon shortcut" href="./static/images/anchor.png"> |     <link rel="icon shortcut" href="./static/images/anchor.png"> | ||||||
|   | |||||||
| @@ -1,5 +1,7 @@ | |||||||
| 'use strict'; | 'use strict'; | ||||||
|  |  | ||||||
|  | var TITLE = document.title | ||||||
|  |  | ||||||
| DOMPurify.addHook('afterSanitizeAttributes', function (node) { | DOMPurify.addHook('afterSanitizeAttributes', function (node) { | ||||||
|   // set all elements owning target to target=_blank |   // set all elements owning target to target=_blank | ||||||
|   if ('target' in node) { |   if ('target' in node) { | ||||||
| @@ -186,6 +188,16 @@ var vm = new Vue({ | |||||||
|     }, |     }, | ||||||
|   }, |   }, | ||||||
|   watch: { |   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) { |     'filterSelected': function(newVal, oldVal) { | ||||||
|       if (oldVal === null) return  // do nothing, initial setup |       if (oldVal === null) return  // do nothing, initial setup | ||||||
|       api.settings.update({filter: newVal}).then(this.refreshItems.bind(this)) |       api.settings.update({filter: newVal}).then(this.refreshItems.bind(this)) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user