Remove ElementEvent
This commit is contained in:
parent
6b0c3c7ca9
commit
240458d0c9
|
@ -1,6 +1,4 @@
|
||||||
import { Directive, ElementRef, HostListener, Output, EventEmitter } from '@angular/core'
|
import { Directive, EventEmitter, HostListener, Output } from '@angular/core'
|
||||||
import { Router } from '@angular/router'
|
|
||||||
import { ElementEvent } from '@app/shared/misc/utils'
|
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[timestampRouteTransformer]'
|
selector: '[timestampRouteTransformer]'
|
||||||
|
@ -8,13 +6,13 @@ import { ElementEvent } from '@app/shared/misc/utils'
|
||||||
export class TimestampRouteTransformerDirective {
|
export class TimestampRouteTransformerDirective {
|
||||||
@Output() timestampClicked = new EventEmitter<number>()
|
@Output() timestampClicked = new EventEmitter<number>()
|
||||||
|
|
||||||
constructor (private el: ElementRef, private router: Router) { }
|
|
||||||
|
|
||||||
@HostListener('click', ['$event'])
|
@HostListener('click', ['$event'])
|
||||||
public onClick ($event: ElementEvent) {
|
public onClick ($event: Event) {
|
||||||
if ($event.target.hasAttribute('href')) {
|
const target = $event.target as HTMLLinkElement
|
||||||
|
|
||||||
|
if (target.hasAttribute('href')) {
|
||||||
const ngxLink = document.createElement('a')
|
const ngxLink = document.createElement('a')
|
||||||
ngxLink.href = $event.target.getAttribute('href')
|
ngxLink.href = target.getAttribute('href')
|
||||||
|
|
||||||
// we only care about reflective links
|
// we only care about reflective links
|
||||||
if (ngxLink.host !== window.location.host) return
|
if (ngxLink.host !== window.location.host) return
|
||||||
|
|
|
@ -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 { DatePipe } from '@angular/common'
|
||||||
import { environment } from '../../../environments/environment'
|
import { environment } from '../../../environments/environment'
|
||||||
import { AuthService } from '../../core/auth'
|
import { AuthService } from '../../core/auth'
|
||||||
|
|
||||||
type ElementEvent = Omit<Event, 'target'> & {
|
// Thanks: https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
|
||||||
target: HTMLElement
|
|
||||||
}
|
|
||||||
|
|
||||||
function getParameterByName (name: string, url: string) {
|
function getParameterByName (name: string, url: string) {
|
||||||
if (!url) url = window.location.href
|
if (!url) url = window.location.href
|
||||||
name = name.replace(/[\[\]]/g, '\\$&')
|
name = name.replace(/[\[\]]/g, '\\$&')
|
||||||
|
@ -194,7 +189,6 @@ function isXPercentInViewport (el: HTMLElement, percentVisible: number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
ElementEvent,
|
|
||||||
sortBy,
|
sortBy,
|
||||||
durationToString,
|
durationToString,
|
||||||
lineFeedToHtml,
|
lineFeedToHtml,
|
||||||
|
|
Loading…
Reference in New Issue