assets/scripts.js: Allow #t12345 hash syntax

Similar to YouTube's ?t=12345.

Mostly for debugging.
This commit is contained in:
Vladimir Panteleev 2019-07-28 01:58:49 +00:00
parent 363b1e32a8
commit 776c2d1aaa

View file

@ -472,11 +472,16 @@ function playHash(hash) {
return; return;
lastHash = hash; lastHash = hash;
if (hash) { if (hash) {
let loc = hash.slice(1).split('/'); 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]; let segmentId = loc[0];
if (loc.length > 1) if (loc.length > 1)
seek(momentsBySegment[segmentId][loc[1]].startMs); seek(momentsBySegment[segmentId][loc[1]].startMs);
else else
seek(getSegmentMs(segmentId)); seek(getSegmentMs(segmentId));
} }
}
} }