65 lines
2.4 KiB
TypeScript
65 lines
2.4 KiB
TypeScript
import {Component, ElementRef} from '@angular/core';
|
|
import { EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
|
|
import {ActivatedRoute, Router} from '@angular/router';
|
|
import {Location} from '@angular/common';
|
|
import "rxjs/add/observable/zip";
|
|
import {Title, Meta} from '@angular/platform-browser';
|
|
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
|
|
|
|
import { RouterHelper} from '../openaireLibrary/utils/routerHelper.class';
|
|
import { ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
|
|
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
|
|
import { SEOService } from '../openaireLibrary/sharedComponents/SEO/SEO.service';
|
|
|
|
@Component({
|
|
selector: 'home',
|
|
templateUrl: './home.component.html'
|
|
})
|
|
|
|
export class HomeComponent {
|
|
public piwiksub: any;
|
|
|
|
public pageTitle = "OpenAIRE"
|
|
public keyword:string = "";
|
|
|
|
|
|
properties: EnvProperties;
|
|
public subPub;public subData;public subProjects;public subOrg; public subDataPr;
|
|
|
|
constructor (
|
|
private route: ActivatedRoute,
|
|
private _router: Router,
|
|
private location: Location, private _piwikService:PiwikService,
|
|
private _meta: Meta, private _title: Title, private seoService: SEOService
|
|
) {
|
|
|
|
var description = "openAIRE monitor,funder, European commission, statistics";
|
|
|
|
var title = "OpenAIRE | Monitor";
|
|
|
|
this._title.setTitle(title);
|
|
this._meta.updateTag({content:description},"name='description'");
|
|
this._meta.updateTag({content:description},"property='og:description'");
|
|
this._meta.updateTag({content:title},"property='og:title'");
|
|
this.seoService.createLinkForCanonicalURL(false);
|
|
|
|
|
|
//this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
|
|
}
|
|
public ngOnInit() {
|
|
this.route.data
|
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
|
this.properties = data.envSpecific;
|
|
if(this.properties!=null){
|
|
var url = this.properties.baseLink+this._router.url;
|
|
this._meta.updateTag({content:url},"property='og:url'");
|
|
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
|
|
this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE").subscribe();
|
|
}
|
|
|
|
}
|
|
});
|
|
|
|
}
|
|
}
|