summaryrefslogtreecommitdiff
path: root/src/client/app/desktop/views/components/notes.vue
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-04-26 14:38:37 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-04-26 14:38:37 +0900
commit03d09e9d240712a54453de063741cfbe7612709c (patch)
treedab7f759c7ae63e9c7526c6ed126ff4eb8d8729c /src/client/app/desktop/views/components/notes.vue
parentwip (diff)
downloadmisskey-03d09e9d240712a54453de063741cfbe7612709c.tar.gz
misskey-03d09e9d240712a54453de063741cfbe7612709c.tar.bz2
misskey-03d09e9d240712a54453de063741cfbe7612709c.zip
wip
Diffstat (limited to 'src/client/app/desktop/views/components/notes.vue')
-rw-r--r--src/client/app/desktop/views/components/notes.vue22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/client/app/desktop/views/components/notes.vue b/src/client/app/desktop/views/components/notes.vue
index 01e1f5c2f0..fa7a782b7b 100644
--- a/src/client/app/desktop/views/components/notes.vue
+++ b/src/client/app/desktop/views/components/notes.vue
@@ -31,6 +31,7 @@
<script lang="ts">
import Vue from 'vue';
import { url } from '../../../config';
+import getNoteSummary from '../../../../../renderers/get-note-summary';
import XNote from './notes.note.vue';
@@ -53,6 +54,7 @@ export default Vue.extend({
requestInitPromise: null as () => Promise<any[]>,
notes: [],
queue: [],
+ unreadCount: 0,
fetching: true,
moreFetching: false
};
@@ -71,10 +73,12 @@ export default Vue.extend({
},
mounted() {
+ document.addEventListener('visibilitychange', this.onVisibilitychange, false);
window.addEventListener('scroll', this.onScroll);
},
beforeDestroy() {
+ document.removeEventListener('visibilitychange', this.onVisibilitychange);
window.removeEventListener('scroll', this.onScroll);
},
@@ -130,6 +134,12 @@ export default Vue.extend({
}
//#endregion
+ // 投稿が自分のものではないかつ、タブが非表示またはスクロール位置が最上部ではないならタイトルで通知
+ if ((document.hidden || !this.isScrollTop()) && note.userId !== (this as any).os.i.id) {
+ this.unreadCount++;
+ document.title = `(${this.unreadCount}) ${getNoteSummary(note)}`;
+ }
+
if (this.isScrollTop()) {
// Prepend the note
this.notes.unshift(note);
@@ -172,9 +182,21 @@ export default Vue.extend({
this.moreFetching = false;
},
+ clearNotification() {
+ this.unreadCount = 0;
+ document.title = 'Misskey';
+ },
+
+ onVisibilitychange() {
+ if (!document.hidden) {
+ this.clearNotification();
+ }
+ },
+
onScroll() {
if (this.isScrollTop()) {
this.releaseQueue();
+ this.clearNotification();
}
if ((this as any).os.i.clientSettings.fetchOnScroll !== false) {