[Aggregator | Trunk]: Add smooth scroll

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-aggregator-portal/trunk@60944 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-04-21 12:36:46 +00:00
parent 3a9c980b6a
commit b6104fcfd9
5 changed files with 59 additions and 61 deletions

View File

@ -1,5 +1,5 @@
import {NgModule} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';
import {Routes, RouterModule, PreloadAllModules} from '@angular/router';
import {OpenaireErrorPageComponent} from './error/errorPage.component';
const routes: Routes = [
@ -96,7 +96,11 @@ const routes: Routes = [
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
imports: [RouterModule.forRoot(routes, {
preloadingStrategy: PreloadAllModules,
onSameUrlNavigation: "reload",
relativeLinkResolution: 'corrected'
})],
exports: [RouterModule]
})
export class AppRoutingModule {

View File

@ -11,6 +11,7 @@ import {ConnectHelper} from "./openaireLibrary/connect/connectHelper";
import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service";
import {Subscriber} from "rxjs";
import {DOCUMENT} from "@angular/common";
import {SmoothScroll} from "./openaireLibrary/utils/smooth-scroll";
@Component({
selector: 'app-root',
@ -53,21 +54,15 @@ export class AppComponent {
agg: AggregatorInfo = null;
subscriptions = [];
constructor(private userManagementService: UserManagementService, private configurationService: ConfigurationService, @Inject(DOCUMENT) private document, private rendererFactory: RendererFactory2) {
constructor(private userManagementService: UserManagementService,
private configurationService: ConfigurationService, private smoothScroll: SmoothScroll,
@Inject(DOCUMENT) private document, private rendererFactory: RendererFactory2) {
this.id = ConnectHelper.getCommunityFromDomain(this.properties.domain);
this.agg = PortalAggregators.getFilterInfoByMenuId(this.id);
this.setStyles();
this.configurationService.initStaticCommunityInformation(PortalAggregators.getCommunityInfoByMenuId(this.id));
}
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
this.configurationService.clearSubscriptions();
this.userManagementService.clearSubscriptions();
}
ngOnInit() {
if (typeof document !== 'undefined') {
this.isClient = true;
@ -97,6 +92,17 @@ export class AppComponent {
}));
}
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
this.configurationService.clearSubscriptions();
this.userManagementService.clearSubscriptions();
this.smoothScroll.clearSubscriptions();
}
private buildMenu() {
this.menuItems = [
{rootItem: new MenuItem("home", "Home", "", "/", false, [], null, {}), items: []},

View File

@ -41,21 +41,17 @@
<meta name="theme-color" content="#ffffff">
<link id="customCss" rel="stylesheet" href="">
<title>Search OpenAIRE</title>
</head>
<body class="" style="">
<div class="uk-offcanvas-content uk-height-viewport">
<app-root></app-root>
</div>
<script type="text/javascript" >
function loadAltmetrics(e,t,n){
var d="createElement",c="getElementsByTagName",m="setAttribute",n=document.getElementById(e);
return n&&n.parentNode&&n.parentNode.removeChild(n),n=document[d+"NS"]&&document.documentElement.namespaceURI,n=n?document[d+"NS"](n,"script"):document[d]("script"),n[m]("id",e),n[m]("src",t),(document[c]("head")[0]||document[c]("body")[0]).appendChild(n),n=new Image,void n[m]("src","https://d1uo4w7k31k5mn.cloudfront.net/donut/0.png")
};
</script>
</head>
<body>
<div class="uk-offcanvas-content uk-height-viewport">
<app-root></app-root>
</div>
</body>
<script type="text/javascript" >
function loadAltmetrics(e,t,n){
var d="createElement",c="getElementsByTagName",m="setAttribute",n=document.getElementById(e);
return n&&n.parentNode&&n.parentNode.removeChild(n),n=document[d+"NS"]&&document.documentElement.namespaceURI,n=n?document[d+"NS"](n,"script"):document[d]("script"),n[m]("id",e),n[m]("src",t),(document[c]("head")[0]||document[c]("body")[0]).appendChild(n),n=new Image,void n[m]("src","https://d1uo4w7k31k5mn.cloudfront.net/donut/0.png")
}
</script>
<script src="https://unpkg.com/smoothscroll-polyfill@0.4.3/dist/smoothscroll.min.js"></script>
</html>

View File

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang="en" dir="ltr" vocab="http://schema.org/">
<head>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
@ -41,21 +41,17 @@
<meta name="theme-color" content="#ffffff">
<link id="customCss" rel="stylesheet" href="">
<title>Search OpenAIRE</title>
</head>
<body class="" style="">
<div class="uk-offcanvas-content uk-height-viewport">
<app-root></app-root>
</div>
<script type="text/javascript" >
function loadAltmetrics(e,t,n){
var d="createElement",c="getElementsByTagName",m="setAttribute",n=document.getElementById(e);
return n&&n.parentNode&&n.parentNode.removeChild(n),n=document[d+"NS"]&&document.documentElement.namespaceURI,n=n?document[d+"NS"](n,"script"):document[d]("script"),n[m]("id",e),n[m]("src",t),(document[c]("head")[0]||document[c]("body")[0]).appendChild(n),n=new Image,void n[m]("src","https://d1uo4w7k31k5mn.cloudfront.net/donut/0.png")
};
</script>
</head>
<body>
<div class="uk-offcanvas-content uk-height-viewport">
<app-root></app-root>
</div>
</body>
<script type="text/javascript">
function loadAltmetrics(e,t,n){
var d="createElement",c="getElementsByTagName",m="setAttribute",n=document.getElementById(e);
return n&&n.parentNode&&n.parentNode.removeChild(n),n=document[d+"NS"]&&document.documentElement.namespaceURI,n=n?document[d+"NS"](n,"script"):document[d]("script"),n[m]("id",e),n[m]("src",t),(document[c]("head")[0]||document[c]("body")[0]).appendChild(n),n=new Image,void n[m]("src","https://d1uo4w7k31k5mn.cloudfront.net/donut/0.png")
}
</script>
<script src="https://unpkg.com/smoothscroll-polyfill@0.4.3/dist/smoothscroll.min.js"></script>
</html>

View File

@ -41,21 +41,17 @@
<meta name="theme-color" content="#ffffff">
<link id="customCss" rel="stylesheet" href="">
<title>Search OpenAIRE</title>
</head>
<body class="" style="">
<div class="uk-offcanvas-content uk-height-viewport">
<app-root></app-root>
</div>
<script type="text/javascript" >
function loadAltmetrics(e,t,n){
var d="createElement",c="getElementsByTagName",m="setAttribute",n=document.getElementById(e);
return n&&n.parentNode&&n.parentNode.removeChild(n),n=document[d+"NS"]&&document.documentElement.namespaceURI,n=n?document[d+"NS"](n,"script"):document[d]("script"),n[m]("id",e),n[m]("src",t),(document[c]("head")[0]||document[c]("body")[0]).appendChild(n),n=new Image,void n[m]("src","https://d1uo4w7k31k5mn.cloudfront.net/donut/0.png")
};
</script>
</head>
<body>
<div class="uk-offcanvas-content uk-height-viewport">
<app-root></app-root>
</div>
</body>
<script type="text/javascript">
function loadAltmetrics(e,t,n){
var d="createElement",c="getElementsByTagName",m="setAttribute",n=document.getElementById(e);
return n&&n.parentNode&&n.parentNode.removeChild(n),n=document[d+"NS"]&&document.documentElement.namespaceURI,n=n?document[d+"NS"](n,"script"):document[d]("script"),n[m]("id",e),n[m]("src",t),(document[c]("head")[0]||document[c]("body")[0]).appendChild(n),n=new Image,void n[m]("src","https://d1uo4w7k31k5mn.cloudfront.net/donut/0.png")
}
</script>
<script src="https://unpkg.com/smoothscroll-polyfill@0.4.3/dist/smoothscroll.min.js"></script>
</html>