mirror of https://github.com/Chocobozzz/PeerTube
Fix relative links in video description
parent
1df8a4d79a
commit
d4eea02801
|
@ -10,7 +10,8 @@ export class TimestampRouteTransformerDirective {
|
|||
public onClick ($event: Event) {
|
||||
const target = $event.target as HTMLLinkElement
|
||||
|
||||
if (target.hasAttribute('href')) {
|
||||
if (target.hasAttribute('href') !== true) return
|
||||
|
||||
const ngxLink = document.createElement('a')
|
||||
ngxLink.href = target.getAttribute('href')
|
||||
|
||||
|
@ -18,7 +19,8 @@ export class TimestampRouteTransformerDirective {
|
|||
if (ngxLink.host !== window.location.host) return
|
||||
|
||||
const ngxLinkParams = new URLSearchParams(ngxLink.search)
|
||||
if (ngxLinkParams.has('start')) {
|
||||
if (ngxLinkParams.has('start') !== true) return
|
||||
|
||||
const separators = ['h', 'm', 's']
|
||||
const start = ngxLinkParams
|
||||
.get('start')
|
||||
|
@ -29,12 +31,9 @@ export class TimestampRouteTransformerDirective {
|
|||
return parseInt(t, 10)
|
||||
})
|
||||
.reduce((acc, t) => acc + t)
|
||||
|
||||
this.timestampClicked.emit(start)
|
||||
}
|
||||
|
||||
$event.preventDefault()
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue