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);
let segmentId = loc[0]; if (hash[0] == 't')
if (loc.length > 1) seek(Number(Math.round(hash.slice(1) * 1000.0)));
seek(momentsBySegment[segmentId][loc[1]].startMs); else {
else let loc = hash.split('/');
seek(getSegmentMs(segmentId)); let segmentId = loc[0];
if (loc.length > 1)
seek(momentsBySegment[segmentId][loc[1]].startMs);
else
seek(getSegmentMs(segmentId));
}
} }
} }