Remove ElementEvent

pull/2396/head
Chocobozzz 2020-01-09 09:30:08 +01:00
parent 6b0c3c7ca9
commit 240458d0c9
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 7 additions and 15 deletions

View File

@ -1,6 +1,4 @@
import { Directive, ElementRef, HostListener, Output, EventEmitter } from '@angular/core'
import { Router } from '@angular/router'
import { ElementEvent } from '@app/shared/misc/utils'
import { Directive, EventEmitter, HostListener, Output } from '@angular/core'
@Directive({
selector: '[timestampRouteTransformer]'
@ -8,13 +6,13 @@ import { ElementEvent } from '@app/shared/misc/utils'
export class TimestampRouteTransformerDirective {
@Output() timestampClicked = new EventEmitter<number>()
constructor (private el: ElementRef, private router: Router) { }
@HostListener('click', ['$event'])
public onClick ($event: ElementEvent) {
if ($event.target.hasAttribute('href')) {
public onClick ($event: Event) {
const target = $event.target as HTMLLinkElement
if (target.hasAttribute('href')) {
const ngxLink = document.createElement('a')
ngxLink.href = $event.target.getAttribute('href')
ngxLink.href = target.getAttribute('href')
// we only care about reflective links
if (ngxLink.host !== window.location.host) return

View File

@ -1,13 +1,8 @@
// Thanks: https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
import { DatePipe } from '@angular/common'
import { environment } from '../../../environments/environment'
import { AuthService } from '../../core/auth'
type ElementEvent = Omit<Event, 'target'> & {
target: HTMLElement
}
// Thanks: https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
function getParameterByName (name: string, url: string) {
if (!url) url = window.location.href
name = name.replace(/[\[\]]/g, '\\$&')
@ -194,7 +189,6 @@ function isXPercentInViewport (el: HTMLElement, percentVisible: number) {
}
export {
ElementEvent,
sortBy,
durationToString,
lineFeedToHtml,