aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/angular/timestamp-route-transformer.directive.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/angular/timestamp-route-transformer.directive.ts')
-rw-r--r--client/src/app/shared/angular/timestamp-route-transformer.directive.ts14
1 files changed, 6 insertions, 8 deletions
diff --git a/client/src/app/shared/angular/timestamp-route-transformer.directive.ts b/client/src/app/shared/angular/timestamp-route-transformer.directive.ts
index 6e17957f8..f4d9aeb1f 100644
--- a/client/src/app/shared/angular/timestamp-route-transformer.directive.ts
+++ b/client/src/app/shared/angular/timestamp-route-transformer.directive.ts
@@ -1,6 +1,4 @@
1import { Directive, ElementRef, HostListener, Output, EventEmitter } from '@angular/core' 1import { Directive, EventEmitter, HostListener, Output } from '@angular/core'
2import { Router } from '@angular/router'
3import { ElementEvent } from '@app/shared/misc/utils'
4 2
5@Directive({ 3@Directive({
6 selector: '[timestampRouteTransformer]' 4 selector: '[timestampRouteTransformer]'
@@ -8,13 +6,13 @@ import { ElementEvent } from '@app/shared/misc/utils'
8export class TimestampRouteTransformerDirective { 6export class TimestampRouteTransformerDirective {
9 @Output() timestampClicked = new EventEmitter<number>() 7 @Output() timestampClicked = new EventEmitter<number>()
10 8
11 constructor (private el: ElementRef, private router: Router) { }
12
13 @HostListener('click', ['$event']) 9 @HostListener('click', ['$event'])
14 public onClick ($event: ElementEvent) { 10 public onClick ($event: Event) {
15 if ($event.target.hasAttribute('href')) { 11 const target = $event.target as HTMLLinkElement
12
13 if (target.hasAttribute('href')) {
16 const ngxLink = document.createElement('a') 14 const ngxLink = document.createElement('a')
17 ngxLink.href = $event.target.getAttribute('href') 15 ngxLink.href = target.getAttribute('href')
18 16
19 // we only care about reflective links 17 // we only care about reflective links
20 if (ngxLink.host !== window.location.host) return 18 if (ngxLink.host !== window.location.host) return