From: Chocobozzz Date: Tue, 8 Jan 2019 14:16:54 +0000 (+0100) Subject: Correctly scroll to video comment X-Git-Tag: v1.2.0-rc.1~40 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=43483d12963ed7a82adee2e35a7bcb7e55e54b3e;p=github%2FChocobozzz%2FPeerTube.git Correctly scroll to video comment --- diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts index dc62fe5ae..2616820d2 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.ts @@ -83,11 +83,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { this.highlightedThread = new VideoComment(res.comment) // Scroll to the highlighted thread - setTimeout(() => { - // -60 because of the fixed header - const scrollY = this.commentHighlightBlock.nativeElement.offsetTop - 60 - window.scroll(0, scrollY) - }, 500) + setTimeout(() => this.commentHighlightBlock.nativeElement.scrollIntoView(), 0) } }, 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 7765c4660..67c5254b3 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -375,7 +375,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.remoteServerDown = false let startTime = urlOptions.startTime || (this.video.userHistory ? this.video.userHistory.currentTime : 0) - // Don't start the video if we are at the end + // If we are at the end of the video, reset the timer if (this.video.duration - startTime <= 1) startTime = 0 if (this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())) {