Skip to content
Snippets Groups Projects
Select Git revision
  • 68563156d8dce6f17c24d5c5f734d4a85e1aea4f
  • master default protected
  • csv_export
  • ndex
  • v1.1.18-rc2
  • v1.1.17
  • v1.1.16
  • v1.1.16-rc12
  • v1.1.16-rc11
  • v1.1.16-rc10
  • v1.1.16-rc9
  • v1.1.16-rc8
  • v1.1.16-rc7
  • v1.1.16-rc4
  • v1.1.16-rc3
  • v1.1.16-rc1
  • v1.1.6-rc1
  • v1.1.15
  • v1.1.15-rc7
  • v1.1.15-rc6
  • v1.1.15-rc3
  • v1.1.15-rc1
  • v1.1.14
  • v1.1.13
24 results

info-tile.component.html

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    app.component.ts 1.94 KiB
    import {Component, ElementRef, ViewChild} from '@angular/core';
    // @ts-ignore
    import theme from '../exampleTheme.json'
    import {NavigationEnd, Router} from "@angular/router";
    import { ThemeService } from 'src/app/services/theme.service';
    
    @Component({
        selector: 'app-root',
        templateUrl: './app.component.html',
        styleUrls: ['./app.component.scss'],
    })
    export class AppComponent {
        public version = "1.1.17"
        public host = "https://drugst.one"
        public cdn = "https://cdn.drugst.one"
        public backendPath = "https://api.drugst.one/"
        // public backendPath = "localhost:8001/"
    
        public theme = theme;
        public currentTabId: number;
        @ViewChild("headerEl", {static: false}) headerEl: ElementRef | undefined;
    
        constructor(private router: Router, public themeService: ThemeService) {
            router.events.subscribe((val) => {
                if (val instanceof NavigationEnd) {
                    if (val.url != null) {
                        // @ts-ignore
                        let page = val.url.substr(1).split("/")[0].split('#')[0];
                        if (page.indexOf("?")>-1){
                            // @ts-ignore
                            this.headerEl.switchTabByName("standalone")
                        }else {
                            // @ts-ignore
                            this.headerEl.switchTabByName(page)
                        }
                    }
                }
            })
            this.currentTabId = 0;
            let cookieDark = localStorage.getItem("darkTheme") === 'true'
            let darkTheme = false;
            if (localStorage.getItem("darkTheme") == null)
                darkTheme = window.matchMedia('(prefers-color-scheme: dark)').matches;
            else
                darkTheme = cookieDark;
            localStorage.setItem("darkTheme", darkTheme + "");
        }
    
        switchTab(tabId: number) {
            if (this.currentTabId !== tabId) {
                this.currentTabId = tabId
                // @ts-ignore
                this.headerEl.tabChange(tabId)
            }
        }
    
    }