diff --git a/client/src/pages/video-detail.tsx b/client/src/pages/video-detail.tsx index 0fd0054..0811ea1 100644 --- a/client/src/pages/video-detail.tsx +++ b/client/src/pages/video-detail.tsx @@ -1,3 +1,4 @@ +import { useState } from "react"; import { useQuery } from "@tanstack/react-query"; import { Link, useRoute } from "wouter"; import { ArrowLeft, Play, Clock, Youtube } from "lucide-react"; @@ -29,6 +30,11 @@ export interface YtVideo { youtubeUrl: string; } +export function chapSecs(t: string) { + const p = String(t).split(":").map((x) => parseInt(x, 10) || 0); + return p.length === 3 ? p[0] * 3600 + p[1] * 60 + p[2] : p[0] * 60 + p[1]; +} + export function dauer(s: number) { const m = Math.floor(s / 60); const r = s % 60; @@ -58,6 +64,12 @@ function RelatedCard({ v }: { v: YtVideo }) { export default function VideoDetailPage() { const [, params] = useRoute("/video/:slug"); + // ?t= odpre predvajalnik na tem mestu; enak parameter uporablja + // tudi Clip oznacba, iz katere Google naredi "Wichtige Momente". + const [startAt, setStartAt] = useState(() => { + const n = parseInt(new URLSearchParams(window.location.search).get("t") || "", 10); + return Number.isFinite(n) && n > 0 ? n : 0; + }); const slug = params?.slug || ""; const { data, isLoading } = useQuery<{ item: YtVideo; related: YtVideo[] }>({ queryKey: [`/api/yt-videos/${slug}`], @@ -92,7 +104,8 @@ export default function VideoDetailPage() { YouTube v tem primeru oglasov ne servira. */}
`, + ``, `

${escapeHtml(desc)}

`, chapterHtml, `

Das ganze Video auf YouTube ansehen

`,