diff options
author | Chocobozzz <me@florianbigard.com> | 2020-01-09 09:30:08 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-01-09 09:30:08 +0100 |
commit | 240458d0c95133bfb03a3f695a1b4e5cb63e20ef (patch) | |
tree | ca54294b9672f33225d561ddeab8b515e3d751c4 | |
parent | 6b0c3c7ca917ad09a011c2821f5bd1a2485aebca (diff) | |
download | PeerTube-240458d0c95133bfb03a3f695a1b4e5cb63e20ef.tar.gz PeerTube-240458d0c95133bfb03a3f695a1b4e5cb63e20ef.tar.zst PeerTube-240458d0c95133bfb03a3f695a1b4e5cb63e20ef.zip |
Remove ElementEvent
-rw-r--r-- | client/src/app/shared/angular/timestamp-route-transformer.directive.ts | 14 | ||||
-rw-r--r-- | client/src/app/shared/misc/utils.ts | 8 |
2 files changed, 7 insertions, 15 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 @@ | |||
1 | import { Directive, ElementRef, HostListener, Output, EventEmitter } from '@angular/core' | 1 | import { Directive, EventEmitter, HostListener, Output } from '@angular/core' |
2 | import { Router } from '@angular/router' | ||
3 | import { 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' | |||
8 | export class TimestampRouteTransformerDirective { | 6 | export 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 |
diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/shared/misc/utils.ts index 096fd61e2..3d1e906a2 100644 --- a/client/src/app/shared/misc/utils.ts +++ b/client/src/app/shared/misc/utils.ts | |||
@@ -1,13 +1,8 @@ | |||
1 | // Thanks: https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript | ||
2 | |||
3 | import { DatePipe } from '@angular/common' | 1 | import { DatePipe } from '@angular/common' |
4 | import { environment } from '../../../environments/environment' | 2 | import { environment } from '../../../environments/environment' |
5 | import { AuthService } from '../../core/auth' | 3 | import { AuthService } from '../../core/auth' |
6 | 4 | ||
7 | type ElementEvent = Omit<Event, 'target'> & { | 5 | // Thanks: https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript |
8 | target: HTMLElement | ||
9 | } | ||
10 | |||
11 | function getParameterByName (name: string, url: string) { | 6 | function getParameterByName (name: string, url: string) { |
12 | if (!url) url = window.location.href | 7 | if (!url) url = window.location.href |
13 | name = name.replace(/[\[\]]/g, '\\$&') | 8 | name = name.replace(/[\[\]]/g, '\\$&') |
@@ -194,7 +189,6 @@ function isXPercentInViewport (el: HTMLElement, percentVisible: number) { | |||
194 | } | 189 | } |
195 | 190 | ||
196 | export { | 191 | export { |
197 | ElementEvent, | ||
198 | sortBy, | 192 | sortBy, |
199 | durationToString, | 193 | durationToString, |
200 | lineFeedToHtml, | 194 | lineFeedToHtml, |