diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 3c7dc6640b..38827ea35a 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -509,6 +509,7 @@ addedRelays: "追加済みのリレー" serviceworkerInfo: "プッシュ通知を行うには有効する必要があります。" deletedNote: "削除された投稿" invisibleNote: "非公開の投稿" +enableInfiniteScroll: "自動でもっと見る" _theme: explore: "テーマを探す" diff --git a/src/client/components/drive.vue b/src/client/components/drive.vue index 65eb1cb816..3e7b7d04ae 100644 --- a/src/client/components/drive.vue +++ b/src/client/components/drive.vue @@ -19,17 +19,17 @@ @drop.prevent.stop="onDrop" >
{{ $t('empty-draghover') }}
@@ -116,6 +116,13 @@ export default Vue.extend({ fetching: true, + ilFilesObserver: new IntersectionObserver( + (entries) => entries.some((entry) => entry.isIntersecting) + && !this.fetching && this.moreFiles && + this.fetchMoreFiles() + ), + moreFilesElement: null as Element, + faAngleRight }; }, @@ -127,6 +134,12 @@ export default Vue.extend({ }, mounted() { + if (this.$store.state.device.enableInfiniteScroll && this.$refs.loadMoreFiles) { + this.$nextTick(() => { + this.ilFilesObserver.observe((this.$refs.loadMoreFiles as Vue).$el) + }); + } + this.connection = this.$root.stream.useSharedConnection('drive'); this.connection.on('fileCreated', this.onStreamDriveFileCreated); @@ -143,8 +156,17 @@ export default Vue.extend({ } }, + activated() { + if (this.$store.state.device.enableInfiniteScroll) { + this.$nextTick(() => { + this.ilFilesObserver.observe((this.$refs.loadMoreFiles as Vue).$el) + }); + } + }, + beforeDestroy() { this.connection.dispose(); + this.ilFilesObserver.disconnect(); }, methods: { diff --git a/src/client/components/notes.vue b/src/client/components/notes.vue index 515bc58e2e..c83cbd1aa1 100644 --- a/src/client/components/notes.vue +++ b/src/client/components/notes.vue @@ -7,8 +7,8 @@