]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix timestamp click
authorChocobozzz <me@florianbigard.com>
Thu, 13 Jan 2022 12:48:02 +0000 (13:48 +0100)
committerChocobozzz <me@florianbigard.com>
Thu, 13 Jan 2022 12:48:02 +0000 (13:48 +0100)
client/src/app/+videos/+video-watch/shared/timestamp-route-transformer.directive.ts
client/src/app/core/renderer/markdown.service.ts

index 91fe5bf5d34c3e631e0aa23532b082795ac7eb1c..ef9f5a59fd6d74f3c1a90e625dc188898cf8b3c2 100644 (file)
@@ -11,13 +11,11 @@ export class TimestampRouteTransformerDirective {
     const target = $event.target as HTMLLinkElement
 
     if (target.hasAttribute('href') !== true) return
+    if (!target.classList.contains('video-timestamp')) return
 
     const ngxLink = document.createElement('a')
     ngxLink.href = target.getAttribute('href')
 
-    // we only care about reflective links
-    if (ngxLink.host !== window.location.host) return
-
     const ngxLinkParams = new URLSearchParams(ngxLink.search)
     if (ngxLinkParams.has('start') !== true) return
 
index a81d995347739bf934c63ba63f47945ef1e71e84..42e8c4a8814f1d5189ebd5b0f5ad10fb0d7a7bb8 100644 (file)
@@ -90,6 +90,8 @@ export class MarkdownService {
         url: buildVideoLink({ shortUUID: videoShortUUID }),
         startTime: t
       })
+
+      // Sync class name with timestamp-route-transformer directive
       return `<a class="video-timestamp" href="${url}">${str}</a>`
     })
   }