diff --git a/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.html b/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.html
index cee5b88e..620cb0d6 100644
--- a/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.html
+++ b/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.html
@@ -1,6 +1,6 @@
-
diff --git a/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.scss b/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.scss
index 482b7b5b..9ead0866 100644
--- a/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.scss
+++ b/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.scss
@@ -164,14 +164,14 @@
bottom: 60%;
display: none;
- el-leftBtn
+ &.leftBtn
{
left: 0;
padding-left: 10px;
padding-right: 2px;
}
- el-rightBtn
+ &.rightBtn
{
right: 0;
padding-right: 10px;
diff --git a/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.ts b/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.ts
index 58a0db05..954ccfa0 100644
--- a/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.ts
+++ b/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.ts
@@ -1,59 +1,60 @@
-import { Component, OnInit, Input, SimpleChange } from '@angular/core';
-import { Episode } from "../../models/episode";
+import { Component, ElementRef, Input, ViewChild } from '@angular/core';
+import { MatButton } from "@angular/material/button";
import { DomSanitizer } from "@angular/platform-browser";
+import { Episode } from "../../models/episode";
@Component({
selector: 'app-episodes-list',
templateUrl: './episodes-list.component.html',
styleUrls: ['./episodes-list.component.scss']
})
-export class EpisodesListComponent implements OnInit
+export class EpisodesListComponent
{
@Input() displayShowTitle: boolean = false;
@Input() episodes: Episode[];
- private root: HTMLElement;
+ @ViewChild("scrollView", { static: true }) private scrollView: ElementRef;
+ @ViewChild("leftBtn", { static: false }) private leftBtn: MatButton;
+ @ViewChild("rightBtn", { static: false }) private rightBtn: MatButton;
+ @ViewChild("episode", { static: false }) private episode: ElementRef;
- constructor(private sanitizer: DomSanitizer) { }
+ constructor(private sanitizer: DomSanitizer) { }
- ngOnInit()
- {
- this.root = document.getElementById("episodes");
- }
+ scrollLeft()
+ {
+ let scroll: number = this.roundScroll(this.scrollView.nativeElement.offsetWidth * 0.80);
+ this.scrollView.nativeElement.scrollBy({ top: 0, left: -scroll, behavior: "smooth" });
+ }
+
+ scrollRight()
+ {
+ let scroll: number = this.roundScroll(this.scrollView.nativeElement.offsetWidth * 0.80);
+ this.scrollView.nativeElement.scrollBy({ top: 0, left: scroll, behavior: "smooth" });
+ }
+
+ roundScroll(offset: number): number
+ {
+ let episodeSize: number = this.episode.nativeElement.scrollWidth;
+
+ offset = Math.round(offset / episodeSize) * episodeSize;
+ if (offset == 0)
+ offset = episodeSize;
+ return offset;
+ }
+
+ onScroll()
+ {
+ if (this.scrollView.nativeElement.scrollLeft <= 0)
+ this.leftBtn._elementRef.nativeElement.classList.add("d-none");
+ else
+ this.leftBtn._elementRef.nativeElement.classList.remove("d-none");
+ if (this.scrollView.nativeElement.scrollLeft >= this.scrollView.nativeElement.scrollWidth - this.scrollView.nativeElement.clientWidth)
+ this.rightBtn._elementRef.nativeElement.classList.add("d-none");
+ else
+ this.rightBtn._elementRef.nativeElement.classList.remove("d-none");
+ }
sanitize(url: string)
{
return this.sanitizer.bypassSecurityTrustStyle("url(" + url + ")");
}
-
- scrollLeft()
- {
- let scroll: number = this.roundScroll(this.root.offsetWidth * 0.80);
- this.root.scrollBy({ top: 0, left: -scroll, behavior: "smooth" });
-
- document.getElementById("el-rightBtn").classList.remove("d-none");
-
- if (this.root.scrollLeft - scroll <= 0)
- document.getElementById("el-leftBtn").classList.add("d-none");
- }
-
- scrollRight()
- {
- let scroll: number = this.roundScroll(this.root.offsetWidth * 0.80);
- this.root.scrollBy({ top: 0, left: scroll, behavior: "smooth" });
- document.getElementById("el-leftBtn").classList.remove("d-none");
-
- if (this.root.scrollLeft + scroll >= this.root.scrollWidth - this.root.clientWidth)
- document.getElementById("el-rightBtn").classList.add("d-none");
- }
-
- roundScroll(offset: number): number
- {
- let episodeSize: number = document.getElementById("el-1").scrollWidth;
- offset = Math.round(offset / episodeSize) * episodeSize;
-
- if (offset == 0)
- offset = episodeSize;
-
- return offset;
- }
}
diff --git a/Kyoo/ClientApp/src/app/people-list/people-list.component.html b/Kyoo/ClientApp/src/app/people-list/people-list.component.html
index 58aade08..1c14cefb 100644
--- a/Kyoo/ClientApp/src/app/people-list/people-list.component.html
+++ b/Kyoo/ClientApp/src/app/people-list/people-list.component.html
@@ -1,11 +1,11 @@
-
diff --git a/Kyoo/ClientApp/src/app/people-list/people-list.component.scss b/Kyoo/ClientApp/src/app/people-list/people-list.component.scss
index 8a7686d7..dfdaedd3 100644
--- a/Kyoo/ClientApp/src/app/people-list/people-list.component.scss
+++ b/Kyoo/ClientApp/src/app/people-list/people-list.component.scss
@@ -123,33 +123,17 @@
bottom: 40%;
display: none;
- pl-leftBtn
+ &.leftBtn
{
left: 0;
padding-left: 10px;
padding-right: 2px;
}
- pl-rightBtn
+ &.rightBtn
{
right: 0;
padding-right: 10px;
padding-left: 2px;
}
}
-
-#leftBtn
-{
- position: absolute;
- left: 0;
- top: 33%;
- outline: none;
-}
-
-#rightBtn
-{
- position: absolute;
- right: 0;
- top: 33%;
- outline: none;
-}
diff --git a/Kyoo/ClientApp/src/app/people-list/people-list.component.ts b/Kyoo/ClientApp/src/app/people-list/people-list.component.ts
index e8fc1109..4cf46f98 100644
--- a/Kyoo/ClientApp/src/app/people-list/people-list.component.ts
+++ b/Kyoo/ClientApp/src/app/people-list/people-list.component.ts
@@ -1,4 +1,5 @@
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, ElementRef, Input, ViewChild } from '@angular/core';
+import { MatButton } from "@angular/material/button";
import { DomSanitizer } from "@angular/platform-browser";
import { People } from "../../models/people";
@@ -7,38 +8,37 @@ import { People } from "../../models/people";
templateUrl: './people-list.component.html',
styleUrls: ['./people-list.component.scss']
})
-export class PeopleListComponent implements OnInit
+export class PeopleListComponent
{
@Input() people: People[];
- private peopleScroll: HTMLElement;
+ @ViewChild("scrollView", { static: true }) private scrollView: ElementRef;
+ @ViewChild("leftBtn", { static: false }) private leftBtn: MatButton;
+ @ViewChild("rightBtn", { static: false }) private rightBtn: MatButton;
constructor(private sanitizer: DomSanitizer) { }
- ngOnInit()
- {
- this.peopleScroll = document.getElementById("peopleScroll");
- }
-
scrollLeft()
{
- let scroll: number = this.peopleScroll.offsetWidth * 0.80;
- this.peopleScroll.scrollBy({ top: 0, left: -scroll, behavior: "smooth" });
-
- document.getElementById("pl-rightBtn").classList.remove("d-none");
-
- if (this.peopleScroll.scrollLeft - scroll <= 0)
- document.getElementById("pl-leftBtn").classList.add("d-none");
+ let scroll: number = this.scrollView.nativeElement.offsetWidth * 0.80;
+ this.scrollView.nativeElement.scrollBy({ top: 0, left: -scroll, behavior: "smooth" });
}
scrollRight()
{
- let scroll: number = this.peopleScroll.offsetWidth * 0.80;
- this.peopleScroll.scrollBy({ top: 0, left: scroll, behavior: "smooth" });
- console.log(document.getElementById("pl-leftBtn"));
- document.getElementById("pl-leftBtn").classList.remove("d-none");
+ let scroll: number = this.scrollView.nativeElement.offsetWidth * 0.80;
+ this.scrollView.nativeElement.scrollBy({ top: 0, left: scroll, behavior: "smooth" });
+ }
- if (this.peopleScroll.scrollLeft + scroll >= this.peopleScroll.scrollWidth - this.peopleScroll.clientWidth)
- document.getElementById("pl-rightBtn").classList.add("d-none");
+ onScroll()
+ {
+ if (this.scrollView.nativeElement.scrollLeft <= 0)
+ this.leftBtn._elementRef.nativeElement.classList.add("d-none");
+ else
+ this.leftBtn._elementRef.nativeElement.classList.remove("d-none");
+ if (this.scrollView.nativeElement.scrollLeft >= this.scrollView.nativeElement.scrollWidth - this.scrollView.nativeElement.clientWidth)
+ this.rightBtn._elementRef.nativeElement.classList.add("d-none");
+ else
+ this.rightBtn._elementRef.nativeElement.classList.remove("d-none");
}
getPeopleIcon(slug: string)
diff --git a/Kyoo/ClientApp/src/app/shows-list/shows-list.component.html b/Kyoo/ClientApp/src/app/shows-list/shows-list.component.html
index 27f668f3..82643e6b 100644
--- a/Kyoo/ClientApp/src/app/shows-list/shows-list.component.html
+++ b/Kyoo/ClientApp/src/app/shows-list/shows-list.component.html
@@ -1,5 +1,5 @@