diff options
Diffstat (limited to 'client/src')
4 files changed, 22 insertions, 3 deletions
diff --git a/client/src/app/+about/about-instance/about-instance.component.ts b/client/src/app/+about/about-instance/about-instance.component.ts index e1809d7b7..15841be74 100644 --- a/client/src/app/+about/about-instance/about-instance.component.ts +++ b/client/src/app/+about/about-instance/about-instance.component.ts | |||
@@ -35,6 +35,8 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked { | |||
35 | 35 | ||
36 | serverConfig: ServerConfig | 36 | serverConfig: ServerConfig |
37 | 37 | ||
38 | private lastScrollHash: string | ||
39 | |||
38 | constructor ( | 40 | constructor ( |
39 | private viewportScroller: ViewportScroller, | 41 | private viewportScroller: ViewportScroller, |
40 | private route: ActivatedRoute, | 42 | private route: ActivatedRoute, |
@@ -74,7 +76,11 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked { | |||
74 | } | 76 | } |
75 | 77 | ||
76 | ngAfterViewChecked () { | 78 | ngAfterViewChecked () { |
77 | if (window.location.hash) this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', '')) | 79 | if (window.location.hash && window.location.hash !== this.lastScrollHash) { |
80 | this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', '')) | ||
81 | |||
82 | this.lastScrollHash = window.location.hash | ||
83 | } | ||
78 | } | 84 | } |
79 | 85 | ||
80 | openContactModal () { | 86 | openContactModal () { |
diff --git a/client/src/app/+about/about-peertube/about-peertube.component.ts b/client/src/app/+about/about-peertube/about-peertube.component.ts index 98c5f93c3..b175a41bc 100644 --- a/client/src/app/+about/about-peertube/about-peertube.component.ts +++ b/client/src/app/+about/about-peertube/about-peertube.component.ts | |||
@@ -8,11 +8,17 @@ import { ViewportScroller } from '@angular/common' | |||
8 | }) | 8 | }) |
9 | 9 | ||
10 | export class AboutPeertubeComponent implements AfterViewChecked { | 10 | export class AboutPeertubeComponent implements AfterViewChecked { |
11 | private lastScrollHash: string | ||
12 | |||
11 | constructor ( | 13 | constructor ( |
12 | private viewportScroller: ViewportScroller | 14 | private viewportScroller: ViewportScroller |
13 | ) {} | 15 | ) {} |
14 | 16 | ||
15 | ngAfterViewChecked () { | 17 | ngAfterViewChecked () { |
16 | if (window.location.hash) this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', '')) | 18 | if (window.location.hash && window.location.hash !== this.lastScrollHash) { |
19 | this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', '')) | ||
20 | |||
21 | this.lastScrollHash = window.location.hash | ||
22 | } | ||
17 | } | 23 | } |
18 | } | 24 | } |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts index 5f2db9854..f73f3aa1e 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts | |||
@@ -23,6 +23,8 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked { | |||
23 | userVideoQuotaUsedDaily = 0 | 23 | userVideoQuotaUsedDaily = 0 |
24 | userVideoQuotaDailyPercentage = 15 | 24 | userVideoQuotaDailyPercentage = 15 |
25 | 25 | ||
26 | private lastScrollHash: string | ||
27 | |||
26 | constructor ( | 28 | constructor ( |
27 | private viewportScroller: ViewportScroller, | 29 | private viewportScroller: ViewportScroller, |
28 | private userService: UserService, | 30 | private userService: UserService, |
@@ -64,7 +66,11 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked { | |||
64 | } | 66 | } |
65 | 67 | ||
66 | ngAfterViewChecked () { | 68 | ngAfterViewChecked () { |
67 | if (window.location.hash) this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', '')) | 69 | if (window.location.hash && window.location.hash !== this.lastScrollHash) { |
70 | this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', '')) | ||
71 | |||
72 | this.lastScrollHash = window.location.hash | ||
73 | } | ||
68 | } | 74 | } |
69 | 75 | ||
70 | onAvatarChange (formData: FormData) { | 76 | onAvatarChange (formData: FormData) { |
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index c77dc97de..5541f5558 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts | |||
@@ -123,6 +123,7 @@ export class AppComponent implements OnInit, AfterViewInit { | |||
123 | const scrollEvent = eventsObs.pipe(filter((e: Event): e is Scroll => e instanceof Scroll)) | 123 | const scrollEvent = eventsObs.pipe(filter((e: Event): e is Scroll => e instanceof Scroll)) |
124 | 124 | ||
125 | scrollEvent.subscribe(e => { | 125 | scrollEvent.subscribe(e => { |
126 | console.log(e) | ||
126 | if (e.position) { | 127 | if (e.position) { |
127 | return this.viewportScroller.scrollToPosition(e.position) | 128 | return this.viewportScroller.scrollToPosition(e.position) |
128 | } | 129 | } |