ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix scrolling with hash in url
Chocobozzz64e0f8cf12c8
diff --git a/client/src/app/+about/about-instance/about-instance.component.ts b/client/src/app/+about/about-instance/about-instance.component.tsindex e1809d7b7f..15841be74e 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 {serverConfig: ServerConfig+ private lastScrollHash: string+constructor (private viewportScroller: ViewportScroller,private route: ActivatedRoute,@@ -74,7 +76,11 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked {}ngAfterViewChecked () {- if (window.location.hash) this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', ''))+ if (window.location.hash && window.location.hash !== this.lastScrollHash) {+ this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', ''))++ this.lastScrollHash = window.location.hash+ }}openContactModal () {diff --git a/client/src/app/+about/about-peertube/about-peertube.component.ts b/client/src/app/+about/about-peertube/about-peertube.component.tsindex 98c5f93c3f..b175a41bca 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'})export class AboutPeertubeComponent implements AfterViewChecked {+ private lastScrollHash: string+constructor (private viewportScroller: ViewportScroller) {}ngAfterViewChecked () {- if (window.location.hash) this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', ''))+ if (window.location.hash && window.location.hash !== this.lastScrollHash) {+ this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', ''))++ this.lastScrollHash = window.location.hash+ }}}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.tsindex 5f2db98548..f73f3aa1e0 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 {userVideoQuotaUsedDaily = 0userVideoQuotaDailyPercentage = 15+ private lastScrollHash: string+constructor (private viewportScroller: ViewportScroller,private userService: UserService,@@ -64,7 +66,11 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked {}ngAfterViewChecked () {- if (window.location.hash) this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', ''))+ if (window.location.hash && window.location.hash !== this.lastScrollHash) {+ this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', ''))++ this.lastScrollHash = window.location.hash+ }}onAvatarChange (formData: FormData) {diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.tsindex c77dc97deb..5541f55582 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 {const scrollEvent = eventsObs.pipe(filter((e: Event): e is Scroll => e instanceof Scroll))scrollEvent.subscribe(e => {+ console.log(e)if (e.position) {return this.viewportScroller.scrollToPosition(e.position)}