+ 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()
+ }
+ }
+
+ private buildUserLanguages () {
+ if (!this.user) {
+ this.videoLanguages = []
+ return
+ }
+
+ if (!this.user.videoLanguages) {
+ this.videoLanguages = [$localize`any language`]
+ return
+ }
+
+ this.videoLanguages = this.user.videoLanguages
+ .map(locale => this.langForLocale(locale))
+ .map(value => value === undefined ? '?' : value)
+ }
+
+ private computeAdminAccess () {