aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+about
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-06-16 09:56:24 +0200
committerChocobozzz <me@florianbigard.com>2020-06-16 11:26:46 +0200
commit64e0f8cf12c804a7a2fa582fd954f686cea9a45b (patch)
treee76dd7980665c1ac814ed4acd4fe9ce3a3e11974 /client/src/app/+about
parentc7763eddd14ee6a4a448d5187f46f79b22047d20 (diff)
downloadPeerTube-64e0f8cf12c804a7a2fa582fd954f686cea9a45b.tar.gz
PeerTube-64e0f8cf12c804a7a2fa582fd954f686cea9a45b.tar.zst
PeerTube-64e0f8cf12c804a7a2fa582fd954f686cea9a45b.zip
Fix scrolling with hash in url
Diffstat (limited to 'client/src/app/+about')
-rw-r--r--client/src/app/+about/about-instance/about-instance.component.ts8
-rw-r--r--client/src/app/+about/about-peertube/about-peertube.component.ts8
2 files changed, 14 insertions, 2 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
10export class AboutPeertubeComponent implements AfterViewChecked { 10export 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}