From bf079b7bfd7f0fb75ceb28e333bb4b74d8840dd4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 14 Jun 2018 11:25:49 +0200 Subject: Automatically jump to the highlighted thread --- .../+video-watch/comment/video-comment-add.component.scss | 2 +- .../+video-watch/comment/video-comments.component.html | 5 +++-- .../+video-watch/comment/video-comments.component.ts | 15 +++++++++++++-- .../src/app/videos/+video-watch/video-watch.component.ts | 12 +++++++----- 4 files changed, 24 insertions(+), 10 deletions(-) (limited to 'client/src') diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.scss b/client/src/app/videos/+video-watch/comment/video-comment-add.component.scss index e586880fc..dbce744bf 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.scss +++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.scss @@ -28,7 +28,7 @@ form { .submit-comment { display: flex; - justify-content: end; + justify-content: flex-end; button { @include peertube-button; diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.html b/client/src/app/videos/+video-watch/comment/video-comments.component.html index 7278f7e57..8871980e9 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.html +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.html @@ -3,7 +3,7 @@
Comments
- @@ -24,8 +24,9 @@ [autoLoading]="true" (nearOfBottom)="onNearOfBottom()" > -
+
{ + // -60 because of the fixed header + console.log(this.commentHighlightBlock.nativeElement.offsetTop) + const scrollY = this.commentHighlightBlock.nativeElement.offsetTop - 60 + window.scroll(0, scrollY) + }, 500) + } }, err => this.notificationsService.error(this.i18n('Error'), err.message) diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts index 498542fff..a760c03e8 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -101,14 +101,13 @@ export class VideoWatchComponent implements OnInit, OnDestroy { ) this.paramsSub = this.route.params.subscribe(routeParams => { - if (this.player) { - this.player.pause() - } - const uuid = routeParams[ 'uuid' ] // Video did not change if (this.video && this.video.uuid === uuid) return + + if (this.player) this.player.pause() + // Video did change this.videoService .getVideo(uuid) @@ -469,7 +468,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { } private isAutoplay () { - // True by default + // We'll jump to the thread id, so do not play the video + if (this.route.snapshot.params['threadId']) return false + + // Otherwise true by default if (!this.user) return true // Be sure the autoPlay is set to false -- cgit v1.2.3