- toggleDarkTheme () {
- // switch properties
- this.switchProperty('mainBackgroundColor')
- this.switchProperty('mainForegroundColor')
- this.switchProperty('submenuColor')
- this.switchProperty('inputColor')
- this.switchProperty('inputPlaceholderColor')
+ 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()
+ }