2020-10-08 17:52:05 +02:00
|
|
|
import {Component, OnInit} from '@angular/core';
|
2020-10-05 18:36:30 +02:00
|
|
|
import {Title} from '@angular/platform-browser';
|
2020-10-08 17:52:05 +02:00
|
|
|
import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
|
2020-10-09 11:35:22 +02:00
|
|
|
import {ActivatedRoute} from "@angular/router";
|
2020-10-05 18:36:30 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'resources',
|
|
|
|
templateUrl: 'resources.component.html',
|
|
|
|
styleUrls: ['resources.component.css'],
|
|
|
|
})
|
|
|
|
export class ResourcesComponent implements OnInit {
|
|
|
|
|
2020-10-08 17:52:05 +02:00
|
|
|
public breadcrumbs: Breadcrumb[] = [
|
|
|
|
{
|
|
|
|
name: 'home',
|
|
|
|
route: '/'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'resources'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2020-10-09 11:35:22 +02:00
|
|
|
constructor(private title: Title, private route: ActivatedRoute) {
|
2020-10-05 18:36:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.title.setTitle('OpenAIRE - Research Graph | Resources');
|
2020-10-09 11:35:22 +02:00
|
|
|
this.route.fragment.subscribe(fragment => {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.goTo(fragment);
|
|
|
|
}, 100);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
goTo(id: string) {
|
|
|
|
const yOffset = -100;
|
|
|
|
const element = document.getElementById(id);
|
|
|
|
if(element) {
|
|
|
|
const y = element.getBoundingClientRect().top + window.pageYOffset + yOffset;
|
|
|
|
window.scrollTo({top: y, behavior: 'smooth'});
|
|
|
|
}
|
2020-10-05 18:36:30 +02:00
|
|
|
}
|
|
|
|
}
|