import {Component, EventEmitter, Inject, Input, Output, PLATFORM_ID, ViewChild} from '@angular/core'; import {ActivatedRoute} from "@angular/router"; import {HelperFunctions} from '../HelperFunctions.class'; import {RouterHelper} from "../routerHelper.class"; import {EnvProperties} from '../properties/env-properties'; import {isPlatformBrowser} from "@angular/common"; import {Author} from "../result-preview/result-preview"; import {AlertModal} from "../modal/alert"; import {properties} from "../../../../environments/environment"; @Component({ selector: 'showAuthors', template: ` {{author.fullName + ";"}}  orcid orcid bw  {{author.fullName + ";"}} 
{{author.fullName}}
ORCID
{{" "}} {{" "}} Harvested from ORCID Public Data File Derived by OpenAIRE algorithms or harvested from 3d party repositories
{{properties.orcidURL+(author.orcid ? author.orcid : author.orcid_pending)}} COPY

{{author.fullName}} in OpenAIRE
+{{authors.length-authorsLimit | number}} Authors
View less authors
` }) export class ShowAuthorsComponent { @Input() authors: Author[]; @Input() authorsLimit: number = 7; @Input() showAll: boolean = true; @Input() modal: AlertModal; @Input() viewAll: boolean = false; public lessBtn: boolean = false; @ViewChild('authorsModal') authorsModal; public properties: EnvProperties = properties; public routerHelper: RouterHelper = new RouterHelper(); testBrowser: boolean; public clipboard; constructor(private route: ActivatedRoute, @Inject(PLATFORM_ID) private platformId: string) { this.testBrowser = isPlatformBrowser(platformId); } ngOnInit() { this.createClipboard(); } public onClick() { if (this.modal) { this.modal.cancel(); } } public viewAllClick() { if(this.authors.length <= this.authorsLimit*2) { this.viewAll = true; this.lessBtn = true; } else { this.openAuthorsModal(); } } public openAuthorsModal() { this.authorsModal.cancelButton = false; this.authorsModal.okButton = false; this.authorsModal.alertTitle = "Authors"; this.authorsModal.open(); } private createClipboard() { if (typeof window !== 'undefined') { delete this.clipboard; let Clipboard; Clipboard = require('clipboard'); this.clipboard = new Clipboard('.orcid_clipboard_btn'); } } }