+ this.redirectService.redirectToHomepage()
+ }
+
+ openLanguageChooser () {
+ this.languageChooserModal.show()
+ }
+
+ openHotkeysCheatSheet () {
+ this.hotkeysService.cheatSheetToggle.next(!this.helpVisible)
+ }
+
+ openQuickSettings () {
+ this.quickSettingsModal.show()
+ }
+
+ toggleUseP2P () {
+ if (!this.user) return
+ this.user.webTorrentEnabled = !this.user.webTorrentEnabled
+
+ this.userService.updateMyProfile({ webTorrentEnabled: this.user.webTorrentEnabled })
+ .subscribe(() => this.authService.refreshUserInformation())
+ }
+
+ langForLocale (localeId: string) {
+ if (localeId === '_unknown') return $localize`Unknown`
+
+ return this.languages.find(lang => lang.id === localeId).label
+ }
+
+ onActiveLinkScrollToAnchor (link: HTMLAnchorElement) {
+ const linkURL = link.getAttribute('href')
+ const linkHash = link.getAttribute('fragment')
+
+ // On same url without fragment restore top scroll position
+ if (!linkHash && this.router.url.includes(linkURL)) {
+ scrollToTop('smooth')
+ }
+
+ // On same url with fragment restore anchor scroll position
+ if (linkHash && this.router.url === linkURL) {
+ this.viewportScroller.scrollToAnchor(linkHash)
+ }
+
+ if (this.screenService.isInSmallView()) {
+ this.menuService.toggleMenu()
+ }
+ }
+
+ // Lock menu scroll when menu scroll to avoid fleeing / detached dropdown
+ onMenuScrollEvent () {
+ document.querySelector('menu').scrollTo(0, 0)