From e2f01c47e08d26a30ad47068d195b3d21d0df8a1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 13 Mar 2019 14:18:58 +0100 Subject: Playlist support in watch page --- client/src/app/shared/video/infinite-scroller.directive.ts | 3 ++- client/src/app/shared/video/video-thumbnail.component.html | 2 +- client/src/app/shared/video/video-thumbnail.component.ts | 11 ++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'client/src/app/shared/video') diff --git a/client/src/app/shared/video/infinite-scroller.directive.ts b/client/src/app/shared/video/infinite-scroller.directive.ts index a02e9444a..186597a3a 100644 --- a/client/src/app/shared/video/infinite-scroller.directive.ts +++ b/client/src/app/shared/video/infinite-scroller.directive.ts @@ -11,6 +11,7 @@ export class InfiniteScrollerDirective implements OnInit, OnDestroy { @Input() firstLoadedPage = 1 @Input() percentLimit = 70 @Input() autoInit = false + @Input() container = document.body @Output() nearOfBottom = new EventEmitter() @Output() nearOfTop = new EventEmitter() @@ -48,7 +49,7 @@ export class InfiniteScrollerDirective implements OnInit, OnDestroy { .pipe( startWith(null), throttleTime(200, undefined, throttleOptions), - map(() => ({ current: window.scrollY, maximumScroll: document.body.clientHeight - window.innerHeight })), + map(() => ({ current: window.scrollY, maximumScroll: this.container.clientHeight - window.innerHeight })), distinctUntilChanged((o1, o2) => o1.current === o2.current), share() ) diff --git a/client/src/app/shared/video/video-thumbnail.component.html b/client/src/app/shared/video/video-thumbnail.component.html index a6757fc4a..b302ebd0f 100644 --- a/client/src/app/shared/video/video-thumbnail.component.html +++ b/client/src/app/shared/video/video-thumbnail.component.html @@ -1,5 +1,5 @@ diff --git a/client/src/app/shared/video/video-thumbnail.component.ts b/client/src/app/shared/video/video-thumbnail.component.ts index ca43700c7..fe65ade94 100644 --- a/client/src/app/shared/video/video-thumbnail.component.ts +++ b/client/src/app/shared/video/video-thumbnail.component.ts @@ -10,8 +10,11 @@ import { ScreenService } from '@app/shared/misc/screen.service' export class VideoThumbnailComponent { @Input() video: Video @Input() nsfw = false + @Input() routerLink: any[] + @Input() queryParams: any[] - constructor (private screenService: ScreenService) {} + constructor (private screenService: ScreenService) { + } getImageUrl () { if (!this.video) return '' @@ -30,4 +33,10 @@ export class VideoThumbnailComponent { return (currentTime / this.video.duration) * 100 } + + getVideoRouterLink () { + if (this.routerLink) return this.routerLink + + return [ '/videos/watch', this.video.uuid ] + } } -- cgit v1.2.3