Show More
@@ -27,6 +27,7 b' var THREAD_UPDATE_DELAY = 10000;' | |||
|
27 | 27 | |
|
28 | 28 | var loading = false; |
|
29 | 29 | var lastUpdateTime = null; |
|
30 | var unreadPosts = 0 | |
|
30 | 31 | |
|
31 | 32 | function blink(node) { |
|
32 | 33 | var blinkCount = 2; |
@@ -99,7 +100,7 b' function updateThread() {' | |||
|
99 | 100 | updatePostBumpableStatus(); |
|
100 | 101 | |
|
101 | 102 | if (data.added.length + data.updated.length > 0) { |
|
102 | showNewPostsTitle(); | |
|
103 | showNewPostsTitle(data.added.length); | |
|
103 | 104 | } |
|
104 | 105 | }) |
|
105 | 106 | .error(function(data) { |
@@ -171,15 +172,19 b" var documentOriginalTitle = '';" | |||
|
171 | 172 | /** |
|
172 | 173 | * Show 'new posts' text in the title if the document is not visible to a user |
|
173 | 174 | */ |
|
174 | function showNewPostsTitle() { | |
|
175 | function showNewPostsTitle(newPostCount) { | |
|
175 | 176 | if (document.hidden) { |
|
176 |
documentOriginalTitle = |
|
|
177 |
document |
|
|
177 | if (documentOriginalTitle === '') { | |
|
178 | documentOriginalTitle = document.title; | |
|
179 | } | |
|
180 | unreadPosts = unreadPosts + newPostCount; | |
|
181 | document.title = '[' + unreadPosts + '] ' + documentOriginalTitle; | |
|
178 | 182 | |
|
179 | 183 | document.addEventListener('visibilitychange', function() { |
|
180 | 184 | if (documentOriginalTitle !== '') { |
|
181 | 185 | document.title = documentOriginalTitle; |
|
182 | 186 | documentOriginalTitle = ''; |
|
187 | unreadPosts = 0; | |
|
183 | 188 | } |
|
184 | 189 | |
|
185 | 190 | document.removeEventListener('visibilitychange', null); |
General Comments 0
You need to be logged in to leave comments.
Login now