From 776c2d1aaa6805b2695806a7c94b61ef732422d8 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sun, 28 Jul 2019 01:58:49 +0000 Subject: [PATCH] assets/scripts.js: Allow #t12345 hash syntax Similar to YouTube's ?t=12345. Mostly for debugging. --- assets/scripts.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/assets/scripts.js b/assets/scripts.js index fbb9db1..362d45a 100644 --- a/assets/scripts.js +++ b/assets/scripts.js @@ -472,11 +472,16 @@ function playHash(hash) { return; lastHash = hash; if (hash) { - let loc = hash.slice(1).split('/'); - let segmentId = loc[0]; - if (loc.length > 1) - seek(momentsBySegment[segmentId][loc[1]].startMs); - else - seek(getSegmentMs(segmentId)); + hash = hash.slice(1); + if (hash[0] == 't') + seek(Number(Math.round(hash.slice(1) * 1000.0))); + else { + let loc = hash.split('/'); + let segmentId = loc[0]; + if (loc.length > 1) + seek(momentsBySegment[segmentId][loc[1]].startMs); + else + seek(getSegmentMs(segmentId)); + } } }